summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-09-05 13:16:49 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2015-09-05 13:17:21 -0700
commit35fcd37fcf27ac570e96c76807bf3c18d10d0729 (patch)
tree9aec854922f0cb96fcb5f4b8801642c86f3fe1e0
parent9be43ef99cba08aab37b97be09b1f40f23288dcb (diff)
nir/spirv: Handle decorations after assigning variable locations
-rw-r--r--src/glsl/nir/spirv_to_nir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c
index 8c2b31cf3ec..30104f0d09a 100644
--- a/src/glsl/nir/spirv_to_nir.c
+++ b/src/glsl/nir/spirv_to_nir.c
@@ -1282,8 +1282,6 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
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;
@@ -1295,6 +1293,12 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
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.