summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_buffer.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-10 21:29:06 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-24 01:39:21 +0200
commita52b3338c6e51421e3836ae210cd98d9c1ec337b (patch)
tree0b9d312f88760bbdc91bdd3e9d48195bfde6dce0 /src/gallium/drivers/r600/r600_buffer.c
parent7d36478d888accd18d55cc76ba41af0ad7d3baf8 (diff)
u_vbuf: remove u_vbuf_resource
Diffstat (limited to 'src/gallium/drivers/r600/r600_buffer.c')
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 440af5622fa..c22d36147df 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -69,7 +69,7 @@ static void r600_set_constants_dirty_if_bound(struct r600_context *rctx,
while (mask) {
unsigned i = u_bit_scan(&mask);
- if (state->cb[i].buffer == &rbuffer->b.b.b) {
+ if (state->cb[i].buffer == &rbuffer->b.b) {
found = true;
state->dirty_mask |= 1 << i;
}
@@ -101,20 +101,20 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
/* Create a new one in the same pipe_resource. */
/* XXX We probably want a different alignment for buffers and textures. */
- r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.b.width0, 4096,
- rbuffer->b.b.b.bind, rbuffer->b.b.b.usage);
+ r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096,
+ rbuffer->b.b.bind, rbuffer->b.b.usage);
/* We changed the buffer, now we need to bind it where the old one was bound. */
/* Vertex buffers. */
for (i = 0; i < rctx->vbuf_mgr->nr_vertex_buffers; i++) {
- if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b.b) {
+ if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b) {
r600_inval_vertex_cache(rctx);
r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
}
}
/* Streamout buffers. */
for (i = 0; i < rctx->num_so_targets; i++) {
- if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b.b) {
+ if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b) {
r600_context_streamout_end(rctx);
rctx->streamout_start = TRUE;
rctx->streamout_append_bitmask = ~0;
@@ -126,8 +126,8 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
}
}
- if (rbuffer->b.user_ptr)
- return (uint8_t*)rbuffer->b.user_ptr + transfer->box.x;
+ if (rbuffer->b.b.user_ptr)
+ return rbuffer->b.b.user_ptr + transfer->box.x;
data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage);
if (!data)
@@ -142,7 +142,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe,
struct r600_resource *rbuffer = r600_resource(transfer->resource);
struct r600_context *rctx = (struct r600_context*)pipe;
- if (rbuffer->b.user_ptr)
+ if (rbuffer->b.b.user_ptr)
return;
rctx->ws->buffer_unmap(rbuffer->buf);
@@ -219,18 +219,17 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
rbuffer = util_slab_alloc(&rscreen->pool_buffers);
- rbuffer->b.b.b = *templ;
- pipe_reference_init(&rbuffer->b.b.b.reference, 1);
- rbuffer->b.b.b.screen = screen;
- rbuffer->b.b.b.user_ptr = NULL;
- rbuffer->b.b.vtbl = &r600_buffer_vtbl;
- rbuffer->b.user_ptr = NULL;
+ rbuffer->b.b = *templ;
+ pipe_reference_init(&rbuffer->b.b.reference, 1);
+ rbuffer->b.b.screen = screen;
+ rbuffer->b.b.user_ptr = NULL;
+ rbuffer->b.vtbl = &r600_buffer_vtbl;
if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
util_slab_free(&rscreen->pool_buffers, rbuffer);
return NULL;
}
- return &rbuffer->b.b.b;
+ return &rbuffer->b.b;
}
struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
@@ -242,20 +241,19 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
rbuffer = util_slab_alloc(&rscreen->pool_buffers);
- pipe_reference_init(&rbuffer->b.b.b.reference, 1);
- rbuffer->b.b.vtbl = &r600_buffer_vtbl;
- rbuffer->b.b.b.screen = screen;
- rbuffer->b.b.b.target = PIPE_BUFFER;
- rbuffer->b.b.b.format = PIPE_FORMAT_R8_UNORM;
- rbuffer->b.b.b.usage = PIPE_USAGE_IMMUTABLE;
- rbuffer->b.b.b.bind = bind;
- rbuffer->b.b.b.width0 = bytes;
- rbuffer->b.b.b.height0 = 1;
- rbuffer->b.b.b.depth0 = 1;
- rbuffer->b.b.b.array_size = 1;
- rbuffer->b.b.b.flags = 0;
- rbuffer->b.b.b.user_ptr = ptr;
- rbuffer->b.user_ptr = ptr;
+ pipe_reference_init(&rbuffer->b.b.reference, 1);
+ rbuffer->b.vtbl = &r600_buffer_vtbl;
+ rbuffer->b.b.screen = screen;
+ rbuffer->b.b.target = PIPE_BUFFER;
+ rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM;
+ rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE;
+ rbuffer->b.b.bind = bind;
+ rbuffer->b.b.width0 = bytes;
+ rbuffer->b.b.height0 = 1;
+ rbuffer->b.b.depth0 = 1;
+ rbuffer->b.b.array_size = 1;
+ rbuffer->b.b.flags = 0;
+ rbuffer->b.b.user_ptr = ptr;
rbuffer->buf = NULL;
- return &rbuffer->b.b.b;
+ return &rbuffer->b.b;
}