add_uniform_to_shader(struct gl_context *ctx,
struct gl_shader_program *shader_program,
struct gl_program_parameter_list *params)
- : ctx(ctx), params(params), idx(-1)
+ : ctx(ctx), shader_program(shader_program), params(params), idx(-1)
{
/* empty */
}
bool last_field);
struct gl_context *ctx;
+ struct gl_shader_program *shader_program;
struct gl_program_parameter_list *params;
int idx;
ir_variable *var;
*/
if (this->idx < 0)
this->idx = index;
+
+ /* Each Parameter will hold the index to the backing uniform storage.
+ * This avoids relying on names to match parameters and uniform
+ * storages later when associating uniform storage.
+ */
+ unsigned location;
+ const bool found =
+ shader_program->UniformHash->get(location, params->Parameters[index].Name);
+ assert(found);
+
+ for (unsigned i = 0; i < num_params; i++) {
+ struct gl_program_parameter *param = ¶ms->Parameters[index + i];
+ param->UniformStorageIndex = location;
+ param->MainUniformStorageIndex = params->Parameters[this->idx].UniformStorageIndex;
+ }
}
/**