summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;