From 954224b7147e8197555856d9833e8cfb2342d4d5 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Thu, 28 Feb 2019 19:07:36 +0100 Subject: [PATCH] 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 --- src/compiler/spirv/vtn_variables.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: -- 2.30.2