nir: Add a nir_foreach_gl_uniform_variable helper for GL linking
There are a bunch of cases where we really do want to walk the list that is nir->uniforms because we want all things declared "uniform" in the GLSL. Add a helper for this but restrict it to the GL linking code. Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
This commit is contained in:

committed by
Marge Bot

parent
feb32f898c
commit
e3e1c50067
@@ -265,7 +265,7 @@ gl_nir_set_uniform_initializers(struct gl_context *ctx,
|
||||
nir_shader *nir = sh->Program->nir;
|
||||
assert(nir);
|
||||
|
||||
nir_foreach_variable(var, &nir->uniforms) {
|
||||
nir_foreach_gl_uniform_variable(var, nir) {
|
||||
if (var->constant_initializer) {
|
||||
struct set_uniform_initializer_closure data = {
|
||||
.shader_prog = prog,
|
||||
|
@@ -1515,8 +1515,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
||||
if (!sh)
|
||||
continue;
|
||||
|
||||
nir_shader *nir = sh->Program->nir;
|
||||
nir_foreach_variable(var, &nir->uniforms)
|
||||
nir_foreach_gl_uniform_variable(var, sh->Program->nir)
|
||||
update_array_sizes(prog, var, state.referenced_uniforms, stage);
|
||||
}
|
||||
}
|
||||
@@ -1531,7 +1530,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
||||
if (!sh)
|
||||
continue;
|
||||
|
||||
nir_foreach_variable(var, &sh->Program->nir->uniforms) {
|
||||
nir_foreach_gl_uniform_variable(var, sh->Program->nir) {
|
||||
const struct glsl_type *type = var->type;
|
||||
const char *name = var->name;
|
||||
if (nir_variable_is_in_block(var) &&
|
||||
@@ -1582,7 +1581,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
||||
state.shader_shadow_samplers = 0;
|
||||
state.params = fill_parameters ? sh->Program->Parameters : NULL;
|
||||
|
||||
nir_foreach_variable(var, &nir->uniforms) {
|
||||
nir_foreach_gl_uniform_variable(var, nir) {
|
||||
state.current_var = var;
|
||||
state.current_ifc_type = NULL;
|
||||
state.offset = 0;
|
||||
|
@@ -35,6 +35,9 @@ struct gl_nir_linker_options {
|
||||
bool fill_parameters;
|
||||
};
|
||||
|
||||
#define nir_foreach_gl_uniform_variable(var, shader) \
|
||||
nir_foreach_variable(var, &(shader)->uniforms)
|
||||
|
||||
bool gl_nir_link_spirv(struct gl_context *ctx,
|
||||
struct gl_shader_program *prog,
|
||||
const struct gl_nir_linker_options *options);
|
||||
|
Reference in New Issue
Block a user