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>
This commit is contained in:
Iago Toral Quiroga
2017-01-09 12:31:53 +01:00
parent 99e9dca149
commit a9f497c678

View 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;