Mesa (master): r300-gallium: Properly redo shaders when constant buffer changes size.

Corbin Simpson csimpson at kemper.freedesktop.org
Tue Mar 31 00:00:10 UTC 2009


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

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Mon Mar 30 16:58:20 2009 -0700

r300-gallium: Properly redo shaders when constant buffer changes size.

---

 src/gallium/drivers/r300/r300_state.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 8c38f7c..c9a20c9 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -132,6 +132,7 @@ static void
                              const struct pipe_constant_buffer* buffer)
 {
     struct r300_context* r300 = r300_context(pipe);
+    int i = r300->shader_constants[shader].user_count;
 
     /* This entire chunk of code seems ever-so-slightly baked.
      * It's as if I've got pipe_buffer* matryoshkas... */
@@ -149,6 +150,12 @@ static void
     }
 
     r300->dirty_state |= R300_NEW_CONSTANTS;
+
+    /* If the number of constants have changed, invalidate the shader. */
+    if (r300->shader_constants[shader].user_count != i) {
+        r300->fs->translated = FALSE;
+        r300_translate_fragment_shader(r300, r300->fs);
+    }
 }
 
 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.




More information about the mesa-commit mailing list