diff options
author | Marek Olšák <[email protected]> | 2011-09-25 18:13:50 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-09-26 15:25:04 +0200 |
commit | 0b3270b9b72c2ca4fad172752045d8fa93c1ad6e (patch) | |
tree | 0b7033979780969ded358fde8c1f635cb4837f26 /src/gallium/drivers/r300/r300_emit.c | |
parent | 455a19b1b3d7ca0a40c65d89e45209dbd8ac7b35 (diff) |
u_vbuf_mgr: cleanup original vs real vertex buffer arrays
It can now override both buffer offsets and strides in additions to resources.
Overriding buffer offsets was kinda hackish and could cause issues with
non-native vertex formats.
Diffstat (limited to 'src/gallium/drivers/r300/r300_emit.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b953bd10f43..62dcbf6e0df 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -823,8 +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->vertex_buffer; - struct pipe_resource **valid_vbuf = r300->vbuf_mgr->real_vertex_buffer; + struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer; struct pipe_vertex_element *velem = r300->velems->velem; struct r300_resource *buf; int i; @@ -862,7 +861,7 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset, } for (i = 0; i < vertex_array_count; i++) { - buf = r300_resource(valid_vbuf[velem[i].vertex_buffer_index]); + buf = r300_resource(vbuf[velem[i].vertex_buffer_index].buffer); OUT_CS_RELOC(buf); } } else { @@ -914,7 +913,7 @@ void r300_emit_vertex_arrays(struct r300_context* r300, int offset, } for (i = 0; i < vertex_array_count; i++) { - buf = r300_resource(valid_vbuf[velem[i].vertex_buffer_index]); + buf = r300_resource(vbuf[velem[i].vertex_buffer_index].buffer); OUT_CS_RELOC(buf); } } @@ -1222,15 +1221,17 @@ validate: r300_resource(r300->vbo)->domain, 0); /* ...vertex buffers for HWTCL path... */ if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) { - struct pipe_resource **buf = r300->vbuf_mgr->real_vertex_buffer; - struct pipe_resource **last = r300->vbuf_mgr->real_vertex_buffer + + 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; - for (; buf != last; buf++) { - if (!*buf) + struct pipe_resource *buf; + for (; vbuf != last; vbuf++) { + buf = vbuf->buffer; + if (!buf) continue; - r300->rws->cs_add_reloc(r300->cs, r300_resource(*buf)->cs_buf, - r300_resource(*buf)->domain, 0); + r300->rws->cs_add_reloc(r300->cs, r300_resource(buf)->cs_buf, + r300_resource(buf)->domain, 0); } } /* ...and index buffer for HWTCL path. */ |