Mesa (master): i965: call brw_nir_lower_uniforms() after uniform linking is complete

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 3 10:55:58 UTC 2020


Module: Mesa
Branch: master
Commit: f518508a817aa5af1eee988439f73ecf6279e9c5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f518508a817aa5af1eee988439f73ecf6279e9c5

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed May  6 14:01:41 2020 +1000

i965: call brw_nir_lower_uniforms() after uniform linking is complete

i965 currently uses the NIR uniform linker for spirv support. Until
now the only reason there has been no issue with calling the
lowering pass before the linker is because no garbage collection
is done between the calls.

An upcoming change to the linker will add an optimisation to resize
unform arrays where possible. Because lowering causes the array
defs to no longer be used the new optimisation ends up resizing the
arrays to 0. To fix this we move the lowering call after the
linking calls.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

---

 src/mesa/drivers/dri/i965/brw_program.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index cbb5b312efd..6bb6f84182d 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -161,8 +161,6 @@ brw_create_nir(struct brw_context *brw,
       }
    }
 
-   NIR_PASS_V(nir, brw_nir_lower_uniforms, is_scalar);
-
    return nir;
 }
 
@@ -183,6 +181,7 @@ brw_nir_lower_resources(nir_shader *nir, struct gl_shader_program *shader_prog,
                         struct gl_program *prog,
                         const struct gen_device_info *devinfo)
 {
+   NIR_PASS_V(nir, brw_nir_lower_uniforms, nir->options->lower_to_scalar);
    NIR_PASS_V(prog->nir, gl_nir_lower_samplers, shader_prog);
    prog->info.textures_used = prog->nir->info.textures_used;
    prog->info.textures_used_by_txf = prog->nir->info.textures_used_by_txf;



More information about the mesa-commit mailing list