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

Author: Jason Ekstrand <jason.ekstr...@intel.com>
Date:   Thu Nov 10 22:31:32 2016 -0800

nir/spirv: Fix handling of gl_PrimitiveId

Before, we were always treating it as an output which bogus.  The only
stage in which this it can be an output is the geometry stage.  In all
other stages, it's an input which, in the back-end, we actually want to be
a system value.

Cc: "13.0" <mesa-sta...@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airl...@redhat.com>

---

 src/compiler/spirv/vtn_variables.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/vtn_variables.c 
b/src/compiler/spirv/vtn_variables.c
index bbcca14..c064de8 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -806,8 +806,12 @@ vtn_get_builtin_location(struct vtn_builder *b,
       set_mode_system_value(mode);
       break;
    case SpvBuiltInPrimitiveId:
-      *location = VARYING_SLOT_PRIMITIVE_ID;
-      *mode = nir_var_shader_out;
+      if (*mode == nir_var_shader_out) {
+         *location = VARYING_SLOT_PRIMITIVE_ID;
+      } else {
+         *location = SYSTEM_VALUE_PRIMITIVE_ID;
+         set_mode_system_value(mode);
+      }
       break;
    case SpvBuiltInInvocationId:
       *location = SYSTEM_VALUE_INVOCATION_ID;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to