Mesa (master): glsl_to_nir: skip ir_var_shader_shared variables

Timothy Arceri tarceri at kemper.freedesktop.org
Mon Apr 24 02:48:26 UTC 2017


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

Author: Timothy Arceri <timothy.arceri at collabora.com>
Date:   Thu Jan 19 10:41:57 2017 +1100

glsl_to_nir: skip ir_var_shader_shared variables

These should be lowered away in GLSL IR but if we don't get dead
code to clean them up it causes issues in glsl_to_nir.

We wan't to drop as many GLSL IR opts in future as we can so this
makes glsl_to_nir just ignore the vars if it sees them.

In future we will want to just use the nir lowering pass that
Vulkan currently uses.

Acked-by: Elie Tournier <elie.tournier at collabora.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/compiler/glsl/glsl_to_nir.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index b98d6cb4ac..189eb24ac6 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -308,6 +308,13 @@ constant_copy(ir_constant *ir, void *mem_ctx)
 void
 nir_visitor::visit(ir_variable *ir)
 {
+   /* TODO: In future we should switch to using the NIR lowering pass but for
+    * now just ignore these variables as GLSL IR should have lowered them.
+    * Anything remaining are just dead vars that weren't cleaned up.
+    */
+   if (ir->data.mode == ir_var_shader_shared)
+      return;
+
    nir_variable *var = ralloc(shader, nir_variable);
    var->type = ir->type;
    var->name = ralloc_strdup(var, ir->name);




More information about the mesa-commit mailing list