mesa/st: lower base invoc and workgroup id

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26800>
This commit is contained in:
Karol Herbst 2024-03-22 12:31:19 +01:00 committed by Marge Bot
parent e040a08e5e
commit a2c96b8e7f
3 changed files with 15 additions and 3 deletions

View File

@ -627,8 +627,10 @@ st_link_glsl_to_nir(struct gl_context *ctx,
NIR_PASS(_, nir, st_nir_lower_wpos_ytransform, shader->Program,
st->screen);
/* needed to lower base_workgroup_id and base_global_invocation_id */
struct nir_lower_compute_system_values_options cs_options = {};
NIR_PASS(_, nir, nir_lower_system_values);
NIR_PASS(_, nir, nir_lower_compute_system_values, NULL);
NIR_PASS(_, nir, nir_lower_compute_system_values, &cs_options);
if (nir->info.io_lowered)
continue; /* the rest is for non-lowered IO only */

View File

@ -43,7 +43,12 @@ st_nir_finish_builtin_nir(struct st_context *st, nir_shader *nir)
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_var_copies);
NIR_PASS(_, nir, nir_lower_system_values);
NIR_PASS(_, nir, nir_lower_compute_system_values, NULL);
struct nir_lower_compute_system_values_options cs_options = {
.has_base_global_invocation_id = false,
.has_base_workgroup_id = false,
};
NIR_PASS(_, nir, nir_lower_compute_system_values, &cs_options);
if (nir->options->lower_to_scalar) {
nir_variable_mode mask =

View File

@ -382,7 +382,12 @@ st_prog_to_nir_postprocess(struct st_context *st, nir_shader *nir,
NIR_PASS(_, nir, st_nir_lower_wpos_ytransform, prog, screen);
NIR_PASS(_, nir, nir_lower_system_values);
NIR_PASS(_, nir, nir_lower_compute_system_values, NULL);
struct nir_lower_compute_system_values_options cs_options = {
.has_base_global_invocation_id = false,
.has_base_workgroup_id = false,
};
NIR_PASS(_, nir, nir_lower_compute_system_values, &cs_options);
/* Optimise NIR */
NIR_PASS(_, nir, nir_opt_constant_folding);