nir/spirv: Make get_builtin_variable take a nir_variable_mode
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 23 Oct 2015 00:28:25 +0000 (17:28 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 23 Oct 2015 00:28:25 +0000 (17:28 -0700)
We'll want this in a moment for validation but, for now, it just gets
stompped by get_builtin_variable.

src/glsl/nir/spirv_to_nir.c

index 52b82e0d674137c394d191925d6b77749745fefb..c8594085d5ef0af20c455a8105745a85b0a4ea01 100644 (file)
@@ -834,6 +834,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
 
 static nir_variable *
 get_builtin_variable(struct vtn_builder *b,
+                     nir_variable_mode mode,
                      const struct glsl_type *type,
                      SpvBuiltIn builtin)
 {
@@ -841,7 +842,6 @@ get_builtin_variable(struct vtn_builder *b,
 
    if (!var) {
       int location;
-      nir_variable_mode mode;
       vtn_get_builtin_location(builtin, &location, &mode);
 
       var = nir_variable_create(b->shader, mode, type, "builtin");
@@ -1349,7 +1349,9 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
             /* If we encounter a builtin, we throw away the ress of the
              * access chain, jump to the builtin, and keep building.
              */
-            nir_variable *builtin = get_builtin_variable(b, deref_type->type,
+            nir_variable *builtin = get_builtin_variable(b,
+                                                         base->var->data.mode,
+                                                         deref_type->type,
                                                          deref_type->builtin);
             val->deref = nir_deref_var_create(b, builtin);
             tail = &val->deref->deref;