return NULL;
}
+nir_variable *
+nir_find_state_variable(nir_shader *s,
+ gl_state_index16 tokens[STATE_LENGTH])
+{
+ nir_foreach_variable_with_modes(var, s, nir_var_uniform) {
+ if (var->num_state_slots == 1 &&
+ !memcmp(var->state_slots[0].tokens, tokens,
+ sizeof(var->state_slots[0].tokens)))
+ return var;
+ }
+ return NULL;
+}
+
/* Annoyingly, qsort_r is not in the C standard library and, in particular, we
* can't count on it on MSV and Android. So we stuff the CMP function into
* each array element. It's a bit messy and burns more memory but the list of
nir_variable_mode mode,
unsigned location);
+nir_variable *nir_find_state_variable(nir_shader *s,
+ gl_state_index16 tokens[STATE_LENGTH]);
+
void nir_sort_variables_with_modes(nir_shader *shader,
int (*compar)(const nir_variable *,
const nir_variable *),
};
static nir_variable *
-find_state_var(nir_shader *s,
- gl_state_index16 tokens[STATE_LENGTH])
-{
- nir_foreach_variable_with_modes(var, s, nir_var_uniform) {
- if (var->num_state_slots == 1 &&
- !memcmp(var->state_slots[0].tokens, tokens,
- sizeof(var->state_slots[0].tokens)))
- return var;
- }
- return NULL;
-}
-
-static nir_variable *
register_state_var(struct tnl_program *p,
gl_state_index s0,
gl_state_index s1,
tokens[1] = s1;
tokens[2] = s2;
tokens[3] = s3;
- nir_variable *var = find_state_var(p->b->shader, tokens);
+ nir_variable *var = nir_find_state_variable(p->b->shader, tokens);
if (var)
return var;