mesa/st: don't use NIR_PASS_V

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26976>
This commit is contained in:
Alyssa Rosenzweig
2024-01-10 09:57:35 -04:00
committed by Marge Bot
parent 52eb7e1ada
commit aee66f4c8f
7 changed files with 89 additions and 89 deletions

View File

@@ -346,15 +346,15 @@ st_release_program(struct st_context *st, struct gl_program **p)
void
st_finalize_nir_before_variants(struct nir_shader *nir)
{
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies);
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_var_copies);
if (nir->options->lower_all_io_to_temps ||
nir->options->lower_all_io_to_elements ||
nir->info.stage == MESA_SHADER_VERTEX ||
nir->info.stage == MESA_SHADER_GEOMETRY) {
NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
NIR_PASS(_, nir, nir_lower_io_arrays_to_elements_no_indirects, false);
} else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, true);
NIR_PASS(_, nir, nir_lower_io_arrays_to_elements_no_indirects, true);
}
/* st_nir_assign_vs_in_locations requires correct shader info. */
@@ -369,23 +369,23 @@ st_prog_to_nir_postprocess(struct st_context *st, nir_shader *nir,
{
struct pipe_screen *screen = st->screen;
NIR_PASS_V(nir, nir_lower_reg_intrinsics_to_ssa);
NIR_PASS(_, nir, nir_lower_reg_intrinsics_to_ssa);
nir_validate_shader(nir, "after st/ptn lower_reg_intrinsics_to_ssa");
/* Lower outputs to temporaries to avoid reading from output variables (which
* is permitted by the language but generally not implemented in HW).
*/
NIR_PASS_V(nir, nir_lower_io_to_temporaries,
NIR_PASS(_, nir, nir_lower_io_to_temporaries,
nir_shader_get_entrypoint(nir),
true, false);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, st_nir_lower_wpos_ytransform, prog, screen);
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
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);
/* Optimise NIR */
NIR_PASS_V(nir, nir_opt_constant_folding);
NIR_PASS(_, nir, nir_opt_constant_folding);
gl_nir_opts(nir);
st_finalize_nir_before_variants(nir);
@@ -602,7 +602,7 @@ lower_ucp(struct st_context *st,
struct gl_program_parameter_list *params)
{
if (nir->info.outputs_written & VARYING_BIT_CLIP_DIST0)
NIR_PASS_V(nir, nir_lower_clip_disable, ucp_enables);
NIR_PASS(_, nir, nir_lower_clip_disable, ucp_enables);
else {
struct pipe_screen *screen = st->screen;
bool can_compact = screen->get_param(screen,
@@ -623,16 +623,16 @@ lower_ucp(struct st_context *st,
if (nir->info.stage == MESA_SHADER_VERTEX ||
nir->info.stage == MESA_SHADER_TESS_EVAL) {
NIR_PASS_V(nir, nir_lower_clip_vs, ucp_enables,
NIR_PASS(_, nir, nir_lower_clip_vs, ucp_enables,
true, can_compact, clipplane_state);
} else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
NIR_PASS_V(nir, nir_lower_clip_gs, ucp_enables,
NIR_PASS(_, nir, nir_lower_clip_gs, ucp_enables,
can_compact, clipplane_state);
}
NIR_PASS_V(nir, nir_lower_io_to_temporaries,
NIR_PASS(_, nir, nir_lower_io_to_temporaries,
nir_shader_get_entrypoint(nir), true, false);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
}
}
@@ -661,18 +661,18 @@ st_create_common_variant(struct st_context *st,
const nir_shader_compiler_options *options = ((nir_shader *)state.ir.nir)->options;
if (key->clamp_color) {
NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
NIR_PASS(_, state.ir.nir, nir_lower_clamp_color_outputs);
finalize = true;
}
if (key->passthrough_edgeflags) {
NIR_PASS_V(state.ir.nir, nir_lower_passthrough_edgeflags);
NIR_PASS(_, state.ir.nir, nir_lower_passthrough_edgeflags);
finalize = true;
}
if (key->export_point_size) {
/* if flag is set, shader must export psiz */
_mesa_add_state_reference(params, point_size_state);
NIR_PASS_V(state.ir.nir, nir_lower_point_size_mov,
NIR_PASS(_, state.ir.nir, nir_lower_point_size_mov,
point_size_state);
finalize = true;
@@ -690,7 +690,7 @@ st_create_common_variant(struct st_context *st,
tex_opts.saturate_s = key->gl_clamp[0];
tex_opts.saturate_t = key->gl_clamp[1];
tex_opts.saturate_r = key->gl_clamp[2];
NIR_PASS_V(state.ir.nir, nir_lower_tex, &tex_opts);
NIR_PASS(_, state.ir.nir, nir_lower_tex, &tex_opts);
}
if (finalize || !st->allow_st_finalize_nir_twice) {
@@ -713,7 +713,7 @@ st_create_common_variant(struct st_context *st,
}
if (key->is_draw_shader) {
NIR_PASS_V(state.ir.nir, gl_nir_lower_images, false);
NIR_PASS(_, state.ir.nir, gl_nir_lower_images, false);
v->base.driver_shader = draw_create_vertex_shader(st->draw, &state);
}
else
@@ -883,38 +883,38 @@ st_create_fp_variant(struct st_context *st,
if (fp->ati_fs) {
if (key->fog) {
NIR_PASS_V(state.ir.nir, st_nir_lower_fog, key->fog, fp->Parameters);
NIR_PASS_V(state.ir.nir, nir_lower_io_to_temporaries,
NIR_PASS(_, state.ir.nir, st_nir_lower_fog, key->fog, fp->Parameters);
NIR_PASS(_, state.ir.nir, nir_lower_io_to_temporaries,
nir_shader_get_entrypoint(state.ir.nir),
true, false);
nir_lower_global_vars_to_local(state.ir.nir);
}
NIR_PASS_V(state.ir.nir, st_nir_lower_atifs_samplers, key->texture_index);
NIR_PASS(_, state.ir.nir, st_nir_lower_atifs_samplers, key->texture_index);
finalize = true;
}
if (key->clamp_color) {
NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
NIR_PASS(_, state.ir.nir, nir_lower_clamp_color_outputs);
finalize = true;
}
if (key->lower_flatshade) {
NIR_PASS_V(state.ir.nir, nir_lower_flatshade);
NIR_PASS(_, state.ir.nir, nir_lower_flatshade);
finalize = true;
}
if (key->lower_alpha_func != COMPARE_FUNC_ALWAYS) {
_mesa_add_state_reference(params, alpha_ref_state);
NIR_PASS_V(state.ir.nir, nir_lower_alpha_test, key->lower_alpha_func,
NIR_PASS(_, state.ir.nir, nir_lower_alpha_test, key->lower_alpha_func,
false, alpha_ref_state);
finalize = true;
}
if (key->lower_two_sided_color) {
bool face_sysval = st->ctx->Const.GLSLFrontFacingIsSysVal;
NIR_PASS_V(state.ir.nir, nir_lower_two_sided_color, face_sysval);
NIR_PASS(_, state.ir.nir, nir_lower_two_sided_color, face_sysval);
finalize = true;
}
@@ -939,7 +939,7 @@ st_create_fp_variant(struct st_context *st,
tex_opts.saturate_s = key->gl_clamp[0];
tex_opts.saturate_t = key->gl_clamp[1];
tex_opts.saturate_r = key->gl_clamp[2];
NIR_PASS_V(state.ir.nir, nir_lower_tex, &tex_opts);
NIR_PASS(_, state.ir.nir, nir_lower_tex, &tex_opts);
finalize = true;
}
@@ -953,7 +953,7 @@ st_create_fp_variant(struct st_context *st,
options.sampler = variant->bitmap_sampler;
options.swizzle_xxxx = st->bitmap.tex_format == PIPE_FORMAT_R8_UNORM;
NIR_PASS_V(state.ir.nir, nir_lower_bitmap, &options);
NIR_PASS(_, state.ir.nir, nir_lower_bitmap, &options);
finalize = true;
}
@@ -987,7 +987,7 @@ st_create_fp_variant(struct st_context *st,
memcpy(options.texcoord_state_tokens, texcoord_state,
sizeof(options.texcoord_state_tokens));
NIR_PASS_V(state.ir.nir, nir_lower_drawpixels, &options);
NIR_PASS(_, state.ir.nir, nir_lower_drawpixels, &options);
finalize = true;
}
@@ -1021,7 +1021,7 @@ st_create_fp_variant(struct st_context *st,
options.bt709_external = key->external.bt709;
options.bt2020_external = key->external.bt2020;
options.yuv_full_range_external = key->external.yuv_full_range;
NIR_PASS_V(state.ir.nir, nir_lower_tex, &options);
NIR_PASS(_, state.ir.nir, nir_lower_tex, &options);
finalize = true;
need_lower_tex_src_plane = true;
}
@@ -1034,7 +1034,7 @@ st_create_fp_variant(struct st_context *st,
/* This pass needs to happen *after* nir_lower_sampler */
if (unlikely(need_lower_tex_src_plane)) {
NIR_PASS_V(state.ir.nir, st_nir_lower_tex_src_plane,
NIR_PASS(_, state.ir.nir, st_nir_lower_tex_src_plane,
~fp->SamplersUsed,
key->external.lower_nv12 | key->external.lower_nv21 |
key->external.lower_xy_uxvx | key->external.lower_xy_vxux |
@@ -1050,7 +1050,7 @@ st_create_fp_variant(struct st_context *st,
* breaks with mesa. Replace the shadow sampler with a normal one here
*/
if (!fp->shader_program && ~key->depth_textures & fp->ShadowSamplers) {
NIR_PASS_V(state.ir.nir, nir_remove_tex_shadow,
NIR_PASS(_, state.ir.nir, nir_remove_tex_shadow,
~key->depth_textures & fp->ShadowSamplers);
finalize = true;
}
@@ -1371,7 +1371,7 @@ st_program_string_notify( struct gl_context *ctx,
if (st->lower_point_size &&
gl_nir_can_add_pointsize_to_program(&st->ctx->Const, prog)) {
prog->skip_pointsize_xfb = true;
NIR_PASS_V(prog->nir, gl_nir_add_point_size);
NIR_PASS(_, prog->nir, gl_nir_add_point_size);
}
}