From c4f30a9100bfba7800162bdef267743a2419ec19 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 25 Jan 2018 19:15:41 +0100 Subject: 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 [v1] Reviewed-by: Jason Ekstrand --- src/compiler/spirv/vtn_variables.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/compiler') 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: -- cgit v1.2.3