nir/gl_nir_linker: Call add_vars_with_modes once for GL_PROGRAM_INPUT
Now that nir_foreach_variable_with_modes can handle multiple modes at one time, we can simplify things a bit and only walk the list once. Reviewed-by: Iago Toral Quiroga <itoral@igalia.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
789ec95dcd
commit
fc1363cc60
@@ -311,12 +311,12 @@ add_shader_variable(const struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
add_vars_with_mode(const struct gl_context *ctx,
|
add_vars_with_modes(const struct gl_context *ctx,
|
||||||
struct gl_shader_program *prog, struct set *resource_set,
|
struct gl_shader_program *prog, struct set *resource_set,
|
||||||
nir_shader *nir, nir_variable_mode mode,
|
nir_shader *nir, nir_variable_mode modes,
|
||||||
unsigned stage, GLenum programInterface)
|
unsigned stage, GLenum programInterface)
|
||||||
{
|
{
|
||||||
nir_foreach_variable_with_modes(var, nir, mode) {
|
nir_foreach_variable_with_modes(var, nir, modes) {
|
||||||
if (var->data.how_declared == nir_var_hidden)
|
if (var->data.how_declared == nir_var_hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -405,18 +405,14 @@ add_interface_variables(const struct gl_context *ctx,
|
|||||||
|
|
||||||
switch (programInterface) {
|
switch (programInterface) {
|
||||||
case GL_PROGRAM_INPUT: {
|
case GL_PROGRAM_INPUT: {
|
||||||
bool result = add_vars_with_mode(ctx, prog, resource_set,
|
return add_vars_with_modes(ctx, prog, resource_set,
|
||||||
nir, nir_var_shader_in,
|
nir, nir_var_shader_in | nir_var_system_value,
|
||||||
stage, programInterface);
|
stage, programInterface);
|
||||||
result &= add_vars_with_mode(ctx, prog, resource_set,
|
|
||||||
nir, nir_var_system_value,
|
|
||||||
stage, programInterface);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
case GL_PROGRAM_OUTPUT:
|
case GL_PROGRAM_OUTPUT:
|
||||||
return add_vars_with_mode(ctx, prog, resource_set,
|
return add_vars_with_modes(ctx, prog, resource_set,
|
||||||
nir, nir_var_shader_out,
|
nir, nir_var_shader_out,
|
||||||
stage, programInterface);
|
stage, programInterface);
|
||||||
default:
|
default:
|
||||||
assert("!Should not get here");
|
assert("!Should not get here");
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user