spirv: gl_PrimitiveID in the fragment shader is handled as an input
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 9 Jan 2017 11:31:53 +0000 (12:31 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Wed, 11 Jan 2017 07:59:28 +0000 (08:59 +0100)
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>
src/compiler/spirv/vtn_variables.c

index e564fb03cbe459b060d1948d3497b126b86f7bf3..3ecb54f32db2285921654ce64b2268254abbb66f 100644 (file)
@@ -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;