[Mesa-dev] [PATCH v2 07/28] spirv/nir: don't set interface_type if it is not a struct

Alejandro PiƱeiro apinheiro at igalia.com
Thu Sep 27 09:51:46 UTC 2018


vnt_variables uses interface_type on several use cases, but on nir
variable it is more limited. From nir.h:

   /**
     * For variables that are in an interface block or are an instance of an
     * interface block, this is the \c GLSL_TYPE_INTERFACE type for that block.
     *
     * \sa ir_variable::location
     */

But interface blocks expects the type to be an struct, so those cases
should not be filled. For example, glsl checks if a variable is in an
uniform block if it is an uniform and has an interface type.

One example of why this is needed: gl_PatchVerticesIn is lowered to an
uniform. Without this change, it would include a interface_type. Then,
we would try to initialize the uniform block, and find that it doesn't
have any component.
---
 src/compiler/spirv/vtn_variables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 9f92ea0417c..7de02b91efc 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1781,6 +1781,8 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
             var->var->members[i].mode = nir_mode;
             var->var->members[i].patch = var->patch;
          }
+      } else {
+         var->var->interface_type = NULL;
       }
 
       /* For inputs and outputs, we need to grab locations and builtin
-- 
2.14.1



More information about the mesa-dev mailing list