summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2017-01-09 12:31:53 +0100
committerIago Toral Quiroga <itoral@igalia.com>2017-01-11 08:59:28 +0100
commita9f497c6787cb8a609f0214c698b396ecbb8742d (patch)
treed3aa2ebb346c1a54e2fd3f193b28b280a3dd6d7e
parent99e9dca149e2484c9472a0518eee5e2099bdb251 (diff)
spirv: gl_PrimitiveID in the fragment shader is handled as an input
Geometry and Tessellation stages do handle this as a system value instead. Fixes: dEQP-VK.geometry.basic.primitive_id Reviewed-by: Dave Airlie <ailried@redhat.com>
-rw-r--r--src/compiler/spirv/vtn_variables.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index e564fb03cb..3ecb54f32d 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -908,7 +908,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
set_mode_system_value(mode);
break;
case SpvBuiltInPrimitiveId:
- if (*mode == nir_var_shader_out) {
+ if (b->shader->stage == MESA_SHADER_FRAGMENT) {
+ assert(*mode == nir_var_shader_in);
+ *location = VARYING_SLOT_PRIMITIVE_ID;
+ } else if (*mode == nir_var_shader_out) {
*location = VARYING_SLOT_PRIMITIVE_ID;
} else {
*location = SYSTEM_VALUE_PRIMITIVE_ID;