Mesa (master): glsl: remove dead uniforms in the nir linker
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 3 02:43:24 UTC 2020
Module: Mesa
Branch: master
Commit: a494b6241016d3d5995902748b40c70ae8d1ecbd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a494b6241016d3d5995902748b40c70ae8d1ecbd
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Wed Apr 29 12:20:47 2020 +1000
glsl: remove dead uniforms in the nir linker
This is now possible as we do uniform linking via a nir based linker.
Shader-db results for IRIS (SKL):
total instructions in shared programs: 14947192 -> 14946397 (<.01%)
instructions in affected programs: 39498 -> 38703 (-2.01%)
helped: 230
HURT: 18
total cycles in shared programs: 324868402 -> 324847058 (<.01%)
cycles in affected programs: 706701 -> 685357 (-3.02%)
helped: 599
HURT: 449
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>
---
src/compiler/glsl/gl_nir_linker.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c
index 2fa1290bad4..7c38f28cd3c 100644
--- a/src/compiler/glsl/gl_nir_linker.c
+++ b/src/compiler/glsl/gl_nir_linker.c
@@ -654,6 +654,14 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog)
bool
gl_nir_link_glsl(struct gl_context *ctx, struct gl_shader_program *prog)
{
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ struct gl_linked_shader *shader = prog->_LinkedShaders[i];
+ if (shader) {
+ nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
+ &can_remove_uniform);
+ }
+ }
+
if (!gl_nir_link_uniforms(ctx, prog, true))
return false;
More information about the mesa-commit
mailing list