Mesa (master): r300g: support user buffers as constant buffers

Marek Olšák mareko at kemper.freedesktop.org
Wed Dec 29 17:42:29 UTC 2010


Module: Mesa
Branch: master
Commit: 48ed458e8730a6c63fd98ad531e5d51335db1b11
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=48ed458e8730a6c63fd98ad531e5d51335db1b11

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed Dec 29 04:04:32 2010 +0100

r300g: support user buffers as constant buffers

---

 src/gallium/drivers/r300/r300_state.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 3eed0c2..f748fe5 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1827,6 +1827,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
     struct r300_constant_buffer *cbuf;
+    struct r300_buffer *rbuf = r300_buffer(buf);
     uint32_t *mapped;
 
     switch (shader) {
@@ -1840,10 +1841,15 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
             return;
     }
 
-    if (buf == NULL || buf->width0 == 0 ||
-        (mapped = (uint32_t*)r300_buffer(buf)->constant_buffer) == NULL) {
+    if (buf == NULL || buf->width0 == 0)
+        return;
+
+    if (rbuf->user_buffer)
+        mapped = (uint32_t*)rbuf->user_buffer;
+    else if (rbuf->constant_buffer)
+        mapped = (uint32_t*)rbuf->constant_buffer;
+    else
         return;
-    }
 
     if (shader == PIPE_SHADER_FRAGMENT ||
         (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) {




More information about the mesa-commit mailing list