diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 2b10a977901..963ec4d19bc 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -6174,6 +6174,7 @@ typedef struct nir_lower_compute_system_values_options { bool lower_local_invocation_index : 1; bool lower_cs_local_id_to_index : 1; bool lower_workgroup_id_to_index : 1; + bool global_id_is_32bit : 1; /* At shader execution time, check if WorkGroupId should be 1D * and compute it quickly. Fall back to slow computation if not. */ diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index cb4ed2a4c94..d20829a9bcf 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -719,6 +719,8 @@ lower_compute_system_value_instr(nir_builder *b, base_group_id), nir_u2uN(b, group_size, bit_size)), nir_u2uN(b, local_id, bit_size)); + } else if (options && options->global_id_is_32bit && bit_size > 32) { + return nir_u2uN(b, nir_load_global_invocation_id(b, 32), bit_size); } else { return NULL; }