[Mesa-dev] [PATCH] glsl_to_tgsi: Invalidate and revalidate uniform backing storage

Ian Romanick idr at freedesktop.org
Wed Nov 16 11:13:44 PST 2011


From: Ian Romanick <ian.d.romanick at intel.com>

If glUniform1i and friends are going to dump data directly in
driver-allocated, the pointers have to be updated when the storage
moves.  This should fix the regressions seen with commit 7199096.

I'm not sure if this is the only place that needs this treatment.  I'm
a little uncertain about the various functions in st_glsl_to_tgsi that
modify the TGSI IR and try to propagate changes about that up to the
gl_program.  That seems sketchy to me.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Vadim Girlin <vadimgirlin at gmail.com>
Cc: Bryan Cain <bryancain3 at gmail.com>
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0bf6766..c8385bb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4571,6 +4571,13 @@ st_translate_program(
    t->pointSizeOutIndex = -1;
    t->prevInstWrotePointSize = GL_FALSE;
 
+   for (i = 0; i < program->shader_program->NumUserUniformStorage; i++) {
+      struct gl_uniform_storage *const storage =
+	 &program->shader_program->UniformStorage[i];
+
+      _mesa_uniform_detach_all_driver_storage(storage);
+   }
+
    /*
     * Declare input attributes.
     */
@@ -4797,6 +4804,13 @@ st_translate_program(
                        t->insn[t->labels[i].branch_target]);
    }
 
+   /* This has to be done last.  Any operation the can cause
+    * prog->ParameterValues to get reallocated (e.g., anything that adds a
+    * program constant) has to happen before creating this linkage.
+    */
+   _mesa_associate_uniform_storage(ctx, program->shader_program,
+				   proginfo->Parameters);
+
 out:
    if (t) {
       FREE(t->insn);
-- 
1.7.6.4



More information about the mesa-dev mailing list