glsl: Fix handling of function calls inside nested loops.
[mesa.git] / src / glsl / link_uniform_initializers.cpp
index 1b7609a4725b3a22433e1b98e812e13ce60b0631..786aaf0b44082f60aebc40f0c7162873bc71e696 100644 (file)
@@ -69,6 +69,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
         break;
       case GLSL_TYPE_ARRAY:
       case GLSL_TYPE_STRUCT:
+      case GLSL_TYPE_ATOMIC_UINT:
       case GLSL_TYPE_INTERFACE:
       case GLSL_TYPE_VOID:
       case GLSL_TYPE_ERROR:
@@ -116,6 +117,16 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
             }
          }
       }
+   } else if (storage->block_index != -1) {
+      /* This is a field of a UBO.  val is the binding index. */
+      for (int i = 0; i < MESA_SHADER_TYPES; i++) {
+         int stage_index = prog->UniformBlockStageIndex[i][storage->block_index];
+
+         if (stage_index != -1) {
+            struct gl_shader *sh = prog->_LinkedShaders[i];
+            sh->UniformBlocks[stage_index].Binding = binding;
+         }
+      }
    }
 
    storage->initialized = true;