summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-08-31 17:16:01 -0700
committerJason Ekstrand <[email protected]>2015-08-31 17:16:49 -0700
commit86c3476668775513a720f116bffb619e98ecfe6d (patch)
tree2e44afe9abbdccefd175d5c74f1331e56df5315a
parent6350c97412d993de1ae876312bab9689a7f34839 (diff)
nir/spirv: Use VERTEX_ID_ZERO_BASE for VertexId
In Vulkan, VertexId and InstanceId will be zero-based and new intrinsics, VertexIndex and InstanceIndex, will be added for non-zer-based. See also, Khronos bug #14255
-rw-r--r--src/glsl/nir/spirv_to_nir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c
index c3a16986fc1..27a864f5993 100644
--- a/src/glsl/nir/spirv_to_nir.c
+++ b/src/glsl/nir/spirv_to_nir.c
@@ -644,7 +644,10 @@ vtn_get_builtin_location(SpvBuiltIn builtin, int *location,
/* XXX figure this out */
unreachable("unhandled builtin");
case SpvBuiltInVertexId:
- *location = SYSTEM_VALUE_VERTEX_ID;
+ /* Vulkan defines VertexID to be zero-based and reserves the new
+ * builtin keyword VertexIndex to indicate the non-zero-based value.
+ */
+ *location = SYSTEM_VALUE_VERTEX_ID_ZERO_BASE;
*mode = nir_var_system_value;
break;
case SpvBuiltInInstanceId: