summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2016-12-02 14:16:07 +0100
committerIago Toral Quiroga <[email protected]>2016-12-03 20:50:57 +0100
commit66e7effc8542aa725eb9c08d826ece009526cd50 (patch)
tree92ee0a29f9c9788811c21238cc2104ada5ad4242 /src
parenta7b510f656dfbda0afb1de78926037a337449140 (diff)
spirv: Builtin Layer is an input for fragment shaders
This change makes it so we emit a load_input intrinsic when Layer is read in a fragment shader. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/spirv/vtn_variables.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 917aa9d84a2..a38d3593f43 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -819,7 +819,12 @@ vtn_get_builtin_location(struct vtn_builder *b,
break;
case SpvBuiltInLayer:
*location = VARYING_SLOT_LAYER;
- *mode = nir_var_shader_out;
+ if (b->shader->stage == MESA_SHADER_FRAGMENT)
+ *mode = nir_var_shader_in;
+ else if (b->shader->stage == MESA_SHADER_GEOMETRY)
+ *mode = nir_var_shader_out;
+ else
+ unreachable("invalid stage for SpvBuiltInLayer");
break;
case SpvBuiltInViewportIndex:
*location = VARYING_SLOT_VIEWPORT;