summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_variables.c
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2019-02-28 19:07:36 +0100
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-08-06 09:11:27 -0700
commit954224b7147e8197555856d9833e8cfb2342d4d5 (patch)
treeff4b1c5d26f2c8d2005b8317dc72c97c1d503334 /src/compiler/spirv/vtn_variables.c
parent382f92a81436a78f059daae86b4dfd2845635f92 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_variables.c')
-rw-r--r--src/compiler/spirv/vtn_variables.c7
1 files 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: