glsl: add stage references for UBO uniforms
authorTapani Pälli <tapani.palli@intel.com>
Mon, 11 May 2015 10:24:20 +0000 (13:24 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 18 May 2015 12:23:09 +0000 (15:23 +0300)
Patch marks uniforms inside UBO properly referenced by stages.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90397

src/glsl/linker.cpp

index ea73c6f9da140996e4efbd305d7d030aef5d522d..ecdc025710f6d340d3e0606f5e1444f3095a02b1 100644 (file)
@@ -2700,6 +2700,16 @@ build_program_resource_list(struct gl_context *ctx,
 
       uint8_t stageref =
          build_stageref(shProg, shProg->UniformStorage[i].name);
+
+      /* Add stagereferences for uniforms in a uniform block. */
+      int block_index = shProg->UniformStorage[i].block_index;
+      if (block_index != -1) {
+         for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
+             if (shProg->UniformBlockStageIndex[j][block_index] != -1)
+                stageref |= (1 << j);
+         }
+      }
+
       if (!add_program_resource(shProg, GL_UNIFORM,
                                 &shProg->UniformStorage[i], stageref))
          return;