Mesa (master): glsl: tidy up uniform storage value count code in NIR linker
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Apr 18 12:15:31 UTC 2020
Module: Mesa
Branch: master
Commit: 723edf859ff2cf7dd0d4c2cb01a7d941af055265
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=723edf859ff2cf7dd0d4c2cb01a7d941af055265
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Wed Feb 26 13:17:02 2020 +1100
glsl: tidy up uniform storage value count code in NIR linker
This makes the code cleaner and better reflects what the existing
glsl IR linker does possibly fixing subtle bugs.
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>
---
src/compiler/glsl/gl_nir_link_uniforms.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c
index 2a545a9023c..c859c2d0b55 100644
--- a/src/compiler/glsl/gl_nir_link_uniforms.c
+++ b/src/compiler/glsl/gl_nir_link_uniforms.c
@@ -1058,8 +1058,6 @@ nir_link_uniform(struct gl_context *ctx,
state->shader_shadow_samplers |= shadow << i;
}
}
-
- state->num_values += values;
} else if (glsl_type_is_image(type_no_array)) {
/* @FIXME: image_index should match that of the same image
* uniform in other shaders. This means we need to match image
@@ -1092,10 +1090,8 @@ nir_link_uniform(struct gl_context *ctx,
stage_program->sh.ImageAccess[i] = access;
}
- if (!uniform->is_shader_storage) {
+ if (!uniform->is_shader_storage)
state->num_shader_uniform_components += values;
- state->num_values += values;
- }
} else {
if (glsl_get_base_type(type_no_array) == GLSL_TYPE_SUBROUTINE) {
uniform->opaque[stage].index = state->next_subroutine;
@@ -1109,10 +1105,8 @@ nir_link_uniform(struct gl_context *ctx,
state->next_subroutine += MAX2(1, uniform->array_elements);
}
- if (!state->var_is_in_block && !is_gl_identifier(uniform->name)) {
+ if (!state->var_is_in_block)
state->num_shader_uniform_components += values;
- state->num_values += values;
- }
}
if (uniform->remap_location != UNMAPPED_UNIFORM_LOC &&
@@ -1128,6 +1122,10 @@ nir_link_uniform(struct gl_context *ctx,
(prog->data->NumUniformStorage - 1));
}
+ if (!is_gl_identifier(uniform->name) && !uniform->is_shader_storage &&
+ !state->var_is_in_block)
+ state->num_values += values;
+
return MAX2(uniform->array_elements, 1);
}
}
More information about the mesa-commit
mailing list