nir: Add new option to lower invocation ID from invocation index.

Add this as an option to nir_lower_compute_system_values_options
instead of just relying on the shader's options.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13466>
This commit is contained in:
Timur Kristóf 2021-10-28 16:26:37 +02:00 committed by Marge Bot
parent 7562e34463
commit 6a502a0a2c
2 changed files with 3 additions and 1 deletions

View file

@ -5067,6 +5067,7 @@ typedef struct nir_lower_compute_system_values_options {
bool has_base_workgroup_id:1;
bool shuffle_local_ids_for_quad_derivatives:1;
bool lower_local_invocation_index:1;
bool lower_cs_local_id_from_index:1;
} nir_lower_compute_system_values_options;
bool nir_lower_compute_system_values(nir_shader *shader,

View file

@ -275,7 +275,8 @@ lower_compute_system_value_instr(nir_builder *b,
/* If lower_cs_local_id_from_index is true, then we derive the local
* index from the local id.
*/
if (b->shader->options->lower_cs_local_id_from_index) {
if (b->shader->options->lower_cs_local_id_from_index ||
(options && options->lower_cs_local_id_from_index)) {
/* We lower gl_LocalInvocationID from gl_LocalInvocationIndex based
* on this formula:
*