diff options
author | Marek Olšák <[email protected]> | 2012-03-31 05:32:25 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-24 01:39:21 +0200 |
commit | 2d03d4f4a365d7af5f4dac20700009152eba1682 (patch) | |
tree | 38295ad6418c93f609d0d194bf94988d0d8fe254 /src/gallium/drivers/r300 | |
parent | 31714ea4d5a20285f398286fe45b53d0609926dd (diff) |
u_vbuf: override set_vertex_buffers
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 22 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 12 |
6 files changed, 26 insertions, 31 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 920612b8de5..103780ffe63 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -67,8 +67,8 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers, r300->vbuf_mgr->vertex_buffer); } else { - util_blitter_save_vertex_buffers(r300->blitter, r300->swtcl_nr_vertex_buffers, - r300->swtcl_vertex_buffer); + util_blitter_save_vertex_buffers(r300->blitter, r300->nr_vertex_buffers, + r300->vertex_buffer); } if (op & R300_SAVE_FRAMEBUFFER) { diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 23fac301095..74d5e8ed36c 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -80,7 +80,7 @@ static void r300_release_referenced_objects(struct r300_context *r300) } /* Manually-created vertex buffers. */ - pipe_resource_reference(&r300->dummy_vb, NULL); + pipe_resource_reference(&r300->dummy_vb.buffer, NULL); pipe_resource_reference(&r300->vbo, NULL); r300->context.delete_depth_stencil_alpha_state(&r300->context, @@ -480,7 +480,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, vb.height0 = 1; vb.depth0 = 1; - r300->dummy_vb = screen->resource_create(screen, &vb); + r300->dummy_vb.buffer = screen->resource_create(screen, &vb); } { diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index de582666ec9..086799dbadd 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -470,7 +470,7 @@ struct r300_context { /* When no vertex buffer is set, this one is used instead to prevent * hardlocks. */ - struct pipe_resource *dummy_vb; + struct pipe_vertex_buffer dummy_vb; /* The currently active query. */ struct r300_query *query_current; @@ -580,8 +580,8 @@ struct r300_context { struct u_vbuf *vbuf_mgr; struct pipe_index_buffer index_buffer; - struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS]; - unsigned swtcl_nr_vertex_buffers; + struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; + unsigned nr_vertex_buffers; struct util_slab_mempool pool_transfers; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index e4afe786d65..467339f6a62 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -823,7 +823,7 @@ void r300_emit_textures_state(struct r300_context *r300, void r300_emit_vertex_arrays(struct r300_context* r300, int offset, boolean indexed, int instance_id) { - struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer; + struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->velems->velem; struct r300_resource *buf; int i; @@ -1223,10 +1223,11 @@ validate: r300_resource(r300->vbo)->domain); /* ...vertex buffers for HWTCL path... */ if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) { - struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer; - struct pipe_vertex_buffer *last = r300->vbuf_mgr->real_vertex_buffer + - r300->vbuf_mgr->nr_real_vertex_buffers; + struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; + struct pipe_vertex_buffer *last = r300->vertex_buffer + + r300->nr_vertex_buffers; struct pipe_resource *buf; + for (; vbuf != last; vbuf++) { buf = vbuf->buffer; if (!buf) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 49013c061b7..84162bfa638 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -148,7 +148,7 @@ static void r300_emit_draw_init(struct r300_context *r300, unsigned mode, static void r300_split_index_bias(struct r300_context *r300, int index_bias, int *buffer_offset, int *index_offset) { - struct pipe_vertex_buffer *vb, *vbufs = r300->vbuf_mgr->real_vertex_buffer; + struct pipe_vertex_buffer *vb, *vbufs = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->velems->velem; unsigned i, size; int max_neg_bias; @@ -367,7 +367,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300, velem = &r300->velems->velem[i]; size[i] = r300->velems->format_size[i] / 4; vbi = velem->vertex_buffer_index; - vbuf = &r300->vbuf_mgr->real_vertex_buffer[vbi]; + vbuf = &r300->vertex_buffer[vbi]; stride[i] = vbuf->stride / 4; /* Map the buffer. */ @@ -401,7 +401,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300, vbi = r300->velems->velem[i].vertex_buffer_index; if (map[vbi]) { - r300->rws->buffer_unmap(r300_resource(r300->vbuf_mgr->real_vertex_buffer[vbi].buffer)->buf); + r300->rws->buffer_unmap(r300_resource(r300->vertex_buffer[vbi].buffer)->buf); map[vbi] = NULL; } } @@ -754,11 +754,7 @@ static void r300_draw_vbo(struct pipe_context* pipe, } r300_update_derived_state(r300); - - /* Start the vbuf manager and update buffers if needed. */ - if (u_vbuf_draw_begin(r300->vbuf_mgr, &info) & U_VBUF_BUFFERS_UPDATED) { - r300->vertex_arrays_dirty = TRUE; - } + u_vbuf_draw_begin(r300->vbuf_mgr, &info); /* Draw. */ if (info.indexed) { @@ -831,10 +827,10 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, (indexed ? PREP_INDEXED : 0), indexed ? 256 : 6); - for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) { - if (r300->swtcl_vertex_buffer[i].buffer) { + for (i = 0; i < r300->nr_vertex_buffers; i++) { + if (r300->vertex_buffer[i].buffer) { void *buf = pipe_buffer_map(pipe, - r300->swtcl_vertex_buffer[i].buffer, + r300->vertex_buffer[i].buffer, PIPE_TRANSFER_READ | PIPE_TRANSFER_UNSYNCHRONIZED, &vb_transfer[i]); @@ -856,8 +852,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, draw_flush(r300->draw); r300->draw_vbo_locked = FALSE; - for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) { - if (r300->swtcl_vertex_buffer[i].buffer) { + for (i = 0; i < r300->nr_vertex_buffers; i++) { + if (r300->vertex_buffer[i].buffer) { pipe_buffer_unmap(pipe, vb_transfer[i]); draw_set_mapped_vertex_buffer(r300->draw, i, NULL); } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index ab5c18158d1..3345bae0990 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1593,22 +1593,20 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, const struct pipe_vertex_buffer* buffers) { struct r300_context* r300 = r300_context(pipe); - struct pipe_vertex_buffer dummy_vb = {0}; /* There must be at least one vertex buffer set, otherwise it locks up. */ if (!count) { - dummy_vb.buffer = r300->dummy_vb; - buffers = &dummy_vb; + buffers = &r300->dummy_vb; count = 1; } + util_copy_vertex_buffers(r300->vertex_buffer, + &r300->nr_vertex_buffers, + buffers, count); + if (r300->screen->caps.has_tcl) { - u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers); r300->vertex_arrays_dirty = TRUE; } else { - util_copy_vertex_buffers(r300->swtcl_vertex_buffer, - &r300->swtcl_nr_vertex_buffers, - buffers, count); draw_set_vertex_buffers(r300->draw, count, buffers); } } |