summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-09-04 09:28:54 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-09-10 14:36:46 -0700
commit4dd1ef9d0a39c52231e880b4900655991a7ced1d (patch)
tree73383a5e9927daffe234436c25498d19cad3ec62 /src/mesa/program
parent664e4a610dc8c0f2adc50de645a07cf4e2b622fd (diff)
mesa: Fill Parameter storage indices even when not using SPIR-V
When creating Parameters, fill in the associated uniform storage indices, like it is done with the NIR linker used for SPIR-V. This will allow later code to not rely on names (which would never work for SPIR-V where names are optional). Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 053912a8410..30e8606b253 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2390,7 +2390,7 @@ public:
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 */
}
@@ -2411,6 +2411,7 @@ private:
bool last_field);
struct gl_context *ctx;
+ struct gl_shader_program *shader_program;
struct gl_program_parameter_list *params;
int idx;
ir_variable *var;
@@ -2472,6 +2473,21 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
*/
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 = &params->Parameters[index + i];
+ param->UniformStorageIndex = location;
+ param->MainUniformStorageIndex = params->Parameters[this->idx].UniformStorageIndex;
+ }
}
/**