r300g: Bind constantbuf to Draw immediately, don't wait for render.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 29 Mar 2010 22:10:18 +0000 (15:10 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 30 Mar 2010 04:33:19 +0000 (21:33 -0700)
Doesn't hurt, and reduces code duplication.

src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_state.c

index 93bf388776c7b70279c86b7cdd08c845116aeb6e..1fb7eac2b344f9b5ef0abf4c754f21d614793f4e 100644 (file)
@@ -569,13 +569,6 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe,
 
     draw_set_mapped_element_buffer(r300->draw, 0, NULL);
 
-    draw_set_mapped_constant_buffer(r300->draw,
-                                   PIPE_SHADER_VERTEX,
-                                    0,
-                                   r300->shader_constants[PIPE_SHADER_VERTEX].constants,
-                                   r300->shader_constants[PIPE_SHADER_VERTEX].count *
-                (sizeof(float) * 4));
-
     draw_arrays(r300->draw, mode, start, count);
 
     for (i = 0; i < r300->vertex_buffer_count; i++) {
@@ -614,13 +607,6 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
     draw_set_mapped_element_buffer_range(r300->draw, indexSize,
                                          minIndex, maxIndex, indices);
 
-    draw_set_mapped_constant_buffer(r300->draw,
-                                   PIPE_SHADER_VERTEX,
-                                    0,
-            r300->shader_constants[PIPE_SHADER_VERTEX].constants,
-            r300->shader_constants[PIPE_SHADER_VERTEX].count *
-                (sizeof(float) * 4));
-
     draw_arrays(r300->draw, mode, start, count);
 
     for (i = 0; i < r300->vertex_buffer_count; i++) {
index b7b5e1ef03bf3849a5a331430ab42178d4a39fc1..ace71d657ef35acdc31503b9230e54cce2eae2f6 100644 (file)
@@ -1365,10 +1365,14 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
         if (r300screen->caps->has_tcl) {
             r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
             r300->pvs_flush.dirty = TRUE;
+        } else if (r300->draw) {
+            draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
+                0, r300->shader_constants[PIPE_SHADER_VERTEX].constants,
+                buf->size);
         }
-    }
-    else if (shader == PIPE_SHADER_FRAGMENT)
+    } else if (shader == PIPE_SHADER_FRAGMENT) {
         r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+    }
 }
 
 void r300_init_state_functions(struct r300_context* r300)