diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-08-21 09:38:10 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-09-10 14:36:46 -0700 |
commit | 1a96811fe1059de097a70121a8d1b905089422fd (patch) | |
tree | 6269f1fbb8e1a189371875a57cb2abb8cef08797 /src/mesa | |
parent | 4f33f96c4517f86f6f720f745cd49f8a0754393b (diff) |
mesa/st: Do not rely on name to identify special uniforms
Every uniform that have the "gl_" name also have some state slots. So
use the state_slots like we did in 57b61849310 ("i965: account for NIR
uniforms without name").
This removes the dependency on names, which are optional when using
ARB_gl_spirv.
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index b9ce22c4a6e..dac5ba2378d 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -183,7 +183,7 @@ st_nir_assign_uniform_locations(struct gl_context *ctx, loc = imageidx; imageidx += type_size(uniform->type); } - } else if (strncmp(uniform->name, "gl_", 3) == 0) { + } else if (uniform->state_slots) { const gl_state_index16 *const stateTokens = uniform->state_slots[0].tokens; /* This state reference has already been setup by ir_to_mesa, but we'll * get the same index back here. @@ -409,10 +409,8 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, * get sent to the shader. */ nir_foreach_variable(var, &nir->uniforms) { - if (strncmp(var->name, "gl_", 3) == 0) { - const nir_state_slot *const slots = var->state_slots; - assert(var->state_slots != NULL); - + const nir_state_slot *const slots = var->state_slots; + if (slots != NULL) { const struct glsl_type *type = glsl_without_array(var->type); for (unsigned int i = 0; i < var->num_state_slots; i++) { unsigned comps; |