[Mesa-dev] [RFC 4/6] i965/nir: Lower samplers before uniforms

Jason Ekstrand jason at jlekstrand.net
Sat Feb 6 05:10:53 UTC 2016


We are about to start doing load_var of a sampler to get the binding table
index.  If we're going to do this, then we need to have the load_var
instructions when we run lower_samplers.  If we let lower_io run on
uniforms first, then they will get replaced with bogus load_uniform
intrinsics which we don't want.
---
 src/mesa/drivers/dri/i965/brw_nir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index 287f935..9817391 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -605,14 +605,14 @@ brw_create_nir(struct brw_context *brw,
 
    nir = brw_preprocess_nir(nir, is_scalar);
 
-   OPT(nir_lower_system_values);
-   OPT_V(brw_nir_lower_uniforms, is_scalar);
-
    if (shader_prog) {
       OPT_V(nir_lower_samplers, shader_prog);
       OPT_V(nir_lower_atomics, shader_prog);
    }
 
+   OPT(nir_lower_system_values);
+   OPT_V(brw_nir_lower_uniforms, is_scalar);
+
    if (nir->stage != MESA_SHADER_TESS_CTRL &&
        nir->stage != MESA_SHADER_TESS_EVAL) {
       nir = brw_nir_lower_io(nir, devinfo, is_scalar);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list