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 <caio.oliveira@intel.com>
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: