Merge branch 'nir-spirv' into vulkan
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 5 Sep 2015 20:17:53 +0000 (13:17 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 5 Sep 2015 20:17:53 +0000 (13:17 -0700)
1  2 
src/glsl/nir/spirv_to_nir.c

index dde0a986ac2e4434dd618d158ba5588617b0689f,30104f0d09a90bc94330107ded6ca9c4aaec0e91..ef2a273da7ef5a8f46e9102538e69c9d6b8631a2
@@@ -649,10 -649,7 +649,10 @@@ vtn_get_builtin_location(SpvBuiltIn bui
        /* XXX figure this out */
        unreachable("unhandled builtin");
     case SpvBuiltInVertexId:
 -      *location = SYSTEM_VALUE_VERTEX_ID;
 +      /* Vulkan defines VertexID to be zero-based and reserves the new
 +       * builtin keyword VertexIndex to indicate the non-zero-based value.
 +       */
 +      *location = SYSTEM_VALUE_VERTEX_ID_ZERO_BASE;
        *mode = nir_var_system_value;
        break;
     case SpvBuiltInInstanceId:
@@@ -1285,8 -1282,6 +1285,6 @@@ vtn_handle_variables(struct vtn_builde
        val->deref = nir_deref_var_create(b, var);
        val->deref_type = type;
  
-       vtn_foreach_decoration(b, val, var_decoration_cb, var);
        if (b->execution_model == SpvExecutionModelFragment &&
            var->data.mode == nir_var_shader_out) {
           var->data.location += FRAG_RESULT_DATA0;
           var->data.location += VARYING_SLOT_VAR0;
        }
  
+       /* We handle decorations last because decorations might cause us to
+        * over-write other things such as the variable's location and we want
+        * those changes to stick.
+        */
+       vtn_foreach_decoration(b, val, var_decoration_cb, var);
        /* If this was a uniform block, then we're not going to actually use the
         * variable (we're only going to use it to compute offsets), so don't
         * declare it in the shader.