From: Antia Puentes Date: Thu, 28 Feb 2019 18:07:36 +0000 (+0100) Subject: nir/spirv: Fix gl_BaseVertex for non-indexed draws for OpenGL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=954224b7147e8197555856d9833e8cfb2342d4d5;p=mesa.git nir/spirv: Fix gl_BaseVertex for non-indexed draws for OpenGL Lowers BaseVertex to the correct system value for OpenGL. v2: use options->environment rather than adding a new flag to spirv_to_nir_options Reviewed-by: Caio Marcelo de Oliveira Filho --- diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index d4e3cac5db3..843801cae5a 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1411,9 +1411,12 @@ vtn_get_builtin_location(struct vtn_builder *b, break; case SpvBuiltInBaseVertex: /* OpenGL gl_BaseVertex (SYSTEM_VALUE_BASE_VERTEX) is not the same - * semantic as SPIR-V BaseVertex (SYSTEM_VALUE_FIRST_VERTEX). + * semantic as Vulkan BaseVertex (SYSTEM_VALUE_FIRST_VERTEX). */ - *location = SYSTEM_VALUE_FIRST_VERTEX; + if (b->options->environment == NIR_SPIRV_OPENGL) + *location = SYSTEM_VALUE_BASE_VERTEX; + else + *location = SYSTEM_VALUE_FIRST_VERTEX; set_mode_system_value(b, mode); break; case SpvBuiltInBaseInstance: