[Mesa-dev] [PATCH 3/3] glsl: call GLSL IR lowering passes earlier

Timothy Arceri timothy.arceri at collabora.com
Thu Dec 29 02:40:02 UTC 2016


He we call all GLSL IR lowering passes before assigning uniform/varying
locations which will be useful for converting to NIR earlier and
performing optimisations before assigning locations.
---
 src/compiler/glsl/linker.cpp | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index fa1062e..a700384 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4629,6 +4629,13 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
       if (options->LowerBufferInterfaceBlocks)
          lower_ubo_reference(prog->_LinkedShaders[i],
                              options->ClampBlockIndicesToArrayBounds);
+
+      if (i == MESA_SHADER_COMPUTE)
+         lower_shared_reference(prog->_LinkedShaders[i],
+                                &prog->Comp.SharedSize);
+
+      lower_vector_derefs(prog->_LinkedShaders[i]);
+      do_vec_index_to_swizzle(prog->_LinkedShaders[i]->ir);
    }
 
    /* If there is no fragment shader we need to set transform feedback.
@@ -4745,21 +4752,6 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
    if (!prog->data->LinkStatus)
       return false;
 
-   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
-      if (prog->_LinkedShaders[i] == NULL)
-         continue;
-
-      const struct gl_shader_compiler_options *options =
-         &ctx->Const.ShaderCompilerOptions[i];
-
-      if (i == MESA_SHADER_COMPUTE)
-         lower_shared_reference(prog->_LinkedShaders[i],
-                                &prog->Comp.SharedSize);
-
-      lower_vector_derefs(prog->_LinkedShaders[i]);
-      do_vec_index_to_swizzle(prog->_LinkedShaders[i]->ir);
-   }
-
    return true;
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list