summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-05-11 23:33:50 +0200
committerMarek Olšák <[email protected]>2012-05-12 00:50:53 +0200
commit9d6b46b1cd459ee6c0db4bfe518adb6928c5b59f (patch)
treec61d903ed3521a6e76c76bcf5f710b9d04df1d5f /src/gallium/drivers/r300/r300_state.c
parent735d0d93a7d748c2e0c0f13fcd6da0c13b678da9 (diff)
r300g/swtcl: move vertex buffer updates into set_vertex_buffers
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index cecbfd213f3..812fe39155a 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1588,29 +1588,45 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
}
}
-static void r300_set_vertex_buffers(struct pipe_context* pipe,
+static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe,
unsigned count,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- if (r300->screen->caps.has_tcl) {
- /* There must be at least one vertex buffer set, otherwise it locks up. */
- if (!count) {
- buffers = &r300->dummy_vb;
- count = 1;
- }
+ /* There must be at least one vertex buffer set, otherwise it locks up. */
+ if (!count) {
+ buffers = &r300->dummy_vb;
+ count = 1;
+ }
- util_copy_vertex_buffers(r300->vertex_buffer,
- &r300->nr_vertex_buffers,
- buffers, count);
+ util_copy_vertex_buffers(r300->vertex_buffer,
+ &r300->nr_vertex_buffers,
+ buffers, count);
- r300->vertex_arrays_dirty = TRUE;
- } else {
- util_copy_vertex_buffers(r300->vertex_buffer,
- &r300->nr_vertex_buffers,
- buffers, count);
- draw_set_vertex_buffers(r300->draw, count, buffers);
+ r300->vertex_arrays_dirty = TRUE;
+}
+
+static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe,
+ unsigned count,
+ const struct pipe_vertex_buffer* buffers)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ unsigned i;
+
+ util_copy_vertex_buffers(r300->vertex_buffer,
+ &r300->nr_vertex_buffers,
+ buffers, count);
+ draw_set_vertex_buffers(r300->draw, count, buffers);
+
+ for (i = 0; i < count; i++) {
+ if (buffers[i].user_buffer) {
+ draw_set_mapped_vertex_buffer(r300->draw, i,
+ buffers[i].user_buffer);
+ } else if (buffers[i].buffer) {
+ draw_set_mapped_vertex_buffer(r300->draw, i,
+ r300_resource(buffers[i].buffer)->malloced_buffer);
+ }
}
}
@@ -1952,11 +1968,11 @@ void r300_init_state_functions(struct r300_context* r300)
r300->context.set_viewport_state = r300_set_viewport_state;
- r300->context.set_vertex_buffers = r300_set_vertex_buffers;
-
if (r300->screen->caps.has_tcl) {
+ r300->context.set_vertex_buffers = r300_set_vertex_buffers_hwtcl;
r300->context.set_index_buffer = r300_set_index_buffer_hwtcl;
} else {
+ r300->context.set_vertex_buffers = r300_set_vertex_buffers_swtcl;
r300->context.set_index_buffer = r300_set_index_buffer_swtcl;
}