[Mesa-dev] [PATCH v2 1/5] st/glsl_to_nir: call nir_lower_load_const_to_scalar() in the st

Timothy Arceri tarceri at itsqueeze.com
Wed Dec 19 10:03:32 UTC 2018


This will help the new opt introduced in the following patches
allowing us to remove extra duplicate varyings.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
 src/gallium/drivers/radeonsi/si_shader_nir.c | 2 --
 src/mesa/state_tracker/st_glsl_to_nir.cpp    | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 0a692277f6..3883337b00 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -823,8 +823,6 @@ si_lower_nir(struct si_shader_selector* sel)
 
 	ac_lower_indirect_derefs(sel->nir, sel->screen->info.chip_class);
 
-	NIR_PASS_V(sel->nir, nir_lower_load_const_to_scalar);
-
 	bool progress;
 	do {
 		progress = false;
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index ed9f643e89..5176756433 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -702,8 +702,10 @@ st_link_nir(struct gl_context *ctx,
 
       nir_shader *nir = shader->Program->nir;
 
-      if (is_scalar[i])
+      if (is_scalar[i]) {
          NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
+         NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
+      }
 
       st_nir_opts(nir, is_scalar[i]);
    }
-- 
2.19.2



More information about the mesa-dev mailing list