gallium: change set_constant_buffer to be UBO-friendly
[mesa.git] / src / gallium / drivers / r300 / r300_state.c
index a5bc662f5fdb7fdd75e87f8e01ed754052b7aac5..058e6f881f0fafbb0e832d756e76b07e568b549f 100644 (file)
@@ -1819,9 +1819,10 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
 
 static void r300_set_constant_buffer(struct pipe_context *pipe,
                                      uint shader, uint index,
-                                     struct pipe_resource *buf)
+                                     struct pipe_constant_buffer *cb)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct pipe_resource *buf = cb ? cb->buffer : NULL;
     struct r300_constant_buffer *cbuf;
     struct r300_resource *rbuf = r300_resource(buf);
     uint32_t *mapped;
@@ -1840,8 +1841,8 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
     if (buf == NULL || buf->width0 == 0)
         return;
 
-    if (rbuf->b.user_ptr)
-        mapped = (uint32_t*)rbuf->b.user_ptr;
+    if (rbuf->b.b.user_ptr)
+        mapped = (uint32_t*)rbuf->b.b.user_ptr;
     else if (rbuf->constant_buffer)
         mapped = (uint32_t*)rbuf->constant_buffer;
     else