summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_variables.c
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2018-01-25 19:15:41 +0100
committerIan Romanick <[email protected]>2018-04-19 15:57:45 -0700
commitc4f30a9100bfba7800162bdef267743a2419ec19 (patch)
tree876a7bb8b042cdee72951a051d8589065fa86e81 /src/compiler/spirv/vtn_variables.c
parentc32e1035cb4f1e0c2c1bd45611e3a35e7caf57b6 (diff)
spirv: Lower BaseVertex to FIRST_VERTEX instead of BASE_VERTEX
The base vertex in Vulkan is different from GL in that for non-indexed primitives the value is taken from the firstVertex parameter instead of being set to zero. This coincides with the new SYSTEM_VALUE_FIRST_VERTEX instead of BASE_VERTEX. v2 (idr): Add comment describing why SYSTEM_VALUE_FIRST_VERTEX is used for SpvBuiltInBaseVertex. Suggested by Jason. Reviewed-by: Ian Romanick <[email protected]> [v1] Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_variables.c')
-rw-r--r--src/compiler/spirv/vtn_variables.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 0673fe80675..9679ff6526c 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1296,7 +1296,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
set_mode_system_value(b, mode);
break;
case SpvBuiltInBaseVertex:
- *location = SYSTEM_VALUE_BASE_VERTEX;
+ /* OpenGL gl_BaseVertex (SYSTEM_VALUE_BASE_VERTEX) is not the same
+ * semantic as SPIR-V BaseVertex (SYSTEM_VALUE_FIRST_VERTEX).
+ */
+ *location = SYSTEM_VALUE_FIRST_VERTEX;
set_mode_system_value(b, mode);
break;
case SpvBuiltInBaseInstance: