Mesa (master): spirv: gl_PrimitiveID in the fragment shader is handled as an input

Iago Toral Quiroga itoral at kemper.freedesktop.org
Wed Jan 11 08:04:17 UTC 2017


Module: Mesa
Branch: master
Commit: a9f497c6787cb8a609f0214c698b396ecbb8742d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9f497c6787cb8a609f0214c698b396ecbb8742d

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Mon Jan  9 12:31:53 2017 +0100

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 at redhat.com>

---

 src/compiler/spirv/vtn_variables.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index e564fb0..3ecb54f 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;




More information about the mesa-commit mailing list