mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-11 05:50:14 +01:00
nir: Add option to not lower gl_InstanceIndex
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Reviewed-by: Emma Anholt <anholt@igalia.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34902>
This commit is contained in:
parent
0a30611c10
commit
4bc060ea11
2 changed files with 11 additions and 2 deletions
|
|
@ -200,8 +200,12 @@ lower_system_value_instr(nir_builder *b, nir_instr *instr, void *_state)
|
|||
|
||||
switch (var->data.location) {
|
||||
case SYSTEM_VALUE_INSTANCE_INDEX:
|
||||
return nir_iadd(b, nir_load_instance_id(b),
|
||||
nir_load_base_instance(b));
|
||||
if (b->shader->options->instance_id_includes_base_index) {
|
||||
return nir_load_instance_id(b);
|
||||
} else {
|
||||
return nir_iadd(b, nir_load_instance_id(b),
|
||||
nir_load_base_instance(b));
|
||||
}
|
||||
|
||||
case SYSTEM_VALUE_GLOBAL_INVOCATION_ID: {
|
||||
return nir_iadd(b, nir_load_global_invocation_id(b, bit_size),
|
||||
|
|
|
|||
|
|
@ -356,6 +356,11 @@ typedef struct nir_shader_compiler_options {
|
|||
*/
|
||||
bool lower_base_vertex;
|
||||
|
||||
/* Indicates that gl_InstanceIndex already includes base index
|
||||
* and doesn't require further lowering.
|
||||
*/
|
||||
bool instance_id_includes_base_index;
|
||||
|
||||
/**
|
||||
* If enabled, gl_HelperInvocation will be lowered as:
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue