diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index 1f35780bd6c..4d161d4871d 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -3323,8 +3323,8 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen, do { progress = false; - NIR_PASS_V(s, nir_lower_vars_to_ssa); - NIR_PASS_V(s, nir_split_64bit_vec3_and_vec4); + NIR_PASS(progress, s, nir_lower_vars_to_ssa); + NIR_PASS(progress, s, nir_split_64bit_vec3_and_vec4); NIR_PASS(progress, s, nir_copy_prop); NIR_PASS(progress, s, nir_opt_algebraic); @@ -3386,7 +3386,7 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen, NIR_PASS(progress, s, nir_opt_offsets, &offset_options); } while (progress); - NIR_PASS_V(s, nir_lower_var_copies); + NIR_PASS(_, s, nir_lower_var_copies); } /* Scalarizes all 64-bit ALU ops. Note that we only actually need to @@ -3761,9 +3761,11 @@ ntt_lower_atomic_pre_dec(nir_shader *s) } /* Lowers texture projectors if we can't do them as TGSI_OPCODE_TXP. */ -static void +static bool nir_to_tgsi_lower_txp(nir_shader *s) { + bool progress = false; + nir_lower_tex_options lower_tex_options = { .lower_txp = 0, }; @@ -3796,7 +3798,8 @@ nir_to_tgsi_lower_txp(nir_shader *s) /* nir_lower_tex must be run even if no options are set, because we need the * LOD to be set for query_levels and for non-fragment shaders. */ - NIR_PASS_V(s, nir_lower_tex, &lower_tex_options); + NIR_PASS(progress, s, nir_lower_tex, &lower_tex_options); + return progress; } static bool @@ -3898,8 +3901,8 @@ const void *nir_to_tgsi_options(struct nir_shader *s, * having matching declarations. */ if (s->info.stage == MESA_SHADER_FRAGMENT) { - NIR_PASS_V(s, nir_lower_indirect_derefs, nir_var_shader_in, UINT32_MAX); - NIR_PASS_V(s, nir_remove_dead_variables, nir_var_shader_in, NULL); + NIR_PASS(_, s, nir_lower_indirect_derefs, nir_var_shader_in, UINT32_MAX); + NIR_PASS(_, s, nir_remove_dead_variables, nir_var_shader_in, NULL); } /* Lower tesslevel indirect derefs for tessellation shader. @@ -3908,90 +3911,90 @@ const void *nir_to_tgsi_options(struct nir_shader *s, */ if (s->info.stage == MESA_SHADER_TESS_CTRL || s->info.stage == MESA_SHADER_TESS_EVAL) { - NIR_PASS_V(s, nir_lower_indirect_derefs, 0 , UINT32_MAX); + NIR_PASS(_, s, nir_lower_indirect_derefs, 0 , UINT32_MAX); } - NIR_PASS_V(s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, - type_size, nir_lower_io_use_interpolated_input_intrinsics); + NIR_PASS(_, s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, + type_size, nir_lower_io_use_interpolated_input_intrinsics); - nir_to_tgsi_lower_txp(s); - NIR_PASS_V(s, nir_to_tgsi_lower_tex); + NIR_PASS(_, s, nir_to_tgsi_lower_txp); + NIR_PASS(_, s, nir_to_tgsi_lower_tex); /* While TGSI can represent PRIMID as either an input or a system value, * glsl-to-tgsi had the GS (not TCS or TES) primid as an input, and drivers * depend on that. */ if (s->info.stage == MESA_SHADER_GEOMETRY) - NIR_PASS_V(s, nir_lower_primid_sysval_to_input); + NIR_PASS(_, s, nir_lower_primid_sysval_to_input); if (s->info.num_abos) - NIR_PASS_V(s, ntt_lower_atomic_pre_dec); + NIR_PASS(_, s, ntt_lower_atomic_pre_dec); if (!original_options->lower_uniforms_to_ubo) { - NIR_PASS_V(s, nir_lower_uniforms_to_ubo, - screen->caps.packed_uniforms, - !native_integers); + NIR_PASS(_, s, nir_lower_uniforms_to_ubo, + screen->caps.packed_uniforms, + !native_integers); } /* Do lowering so we can directly translate f64/i64 NIR ALU ops to TGSI -- * TGSI stores up to a vec2 in each slot, so to avoid a whole bunch of op * duplication logic we just make it so that we only see vec2s. */ - NIR_PASS_V(s, nir_lower_alu_to_scalar, scalarize_64bit, NULL); - NIR_PASS_V(s, nir_to_tgsi_lower_64bit_to_vec2); + NIR_PASS(_, s, nir_lower_alu_to_scalar, scalarize_64bit, NULL); + NIR_PASS(_, s, nir_to_tgsi_lower_64bit_to_vec2); if (!screen->caps.load_constbuf) - NIR_PASS_V(s, nir_lower_ubo_vec4); + NIR_PASS(_, s, nir_lower_ubo_vec4); ntt_optimize_nir(s, screen, options); - NIR_PASS_V(s, nir_lower_indirect_derefs, no_indirects_mask, UINT32_MAX); + NIR_PASS(_, s, nir_lower_indirect_derefs, no_indirects_mask, UINT32_MAX); /* Lower demote_if to if (cond) { demote } because TGSI doesn't have a DEMOTE_IF. */ - NIR_PASS_V(s, nir_lower_discard_if, nir_lower_demote_if_to_cf); + NIR_PASS(_, s, nir_lower_discard_if, nir_lower_demote_if_to_cf); - NIR_PASS_V(s, nir_lower_frexp); + NIR_PASS(_, s, nir_lower_frexp); bool progress; do { progress = false; NIR_PASS(progress, s, nir_opt_algebraic_late); if (progress) { - NIR_PASS_V(s, nir_copy_prop); - NIR_PASS_V(s, nir_opt_dce); - NIR_PASS_V(s, nir_opt_cse); + NIR_PASS(_, s, nir_copy_prop); + NIR_PASS(_, s, nir_opt_dce); + NIR_PASS(_, s, nir_opt_cse); } } while (progress); - NIR_PASS_V(s, nir_opt_combine_barriers, NULL, NULL); + NIR_PASS(_, s, nir_opt_combine_barriers, NULL, NULL); if (screen->shader_caps[pipe_shader_type_from_mesa(s->info.stage)].integers) { - NIR_PASS_V(s, nir_lower_bool_to_int32); + NIR_PASS(_, s, nir_lower_bool_to_int32); } else { - NIR_PASS_V(s, nir_lower_int_to_float); - NIR_PASS_V(s, nir_lower_bool_to_float, - !options->lower_cmp && !options->lower_fabs); + NIR_PASS(_, s, nir_lower_int_to_float); + NIR_PASS(_, s, nir_lower_bool_to_float, + !options->lower_cmp && !options->lower_fabs); /* bool_to_float generates MOVs for b2f32 that we want to clean up. */ - NIR_PASS_V(s, nir_copy_prop); - NIR_PASS_V(s, nir_opt_dce); + NIR_PASS(_, s, nir_copy_prop); + NIR_PASS(_, s, nir_opt_dce); } nir_move_options move_all = nir_move_const_undef | nir_move_load_ubo | nir_move_load_input | nir_move_comparisons | nir_move_copies | nir_move_load_ssbo; - NIR_PASS_V(s, nir_opt_move, move_all); + NIR_PASS(_, s, nir_opt_move, move_all); - NIR_PASS_V(s, nir_convert_from_ssa, true, false); - NIR_PASS_V(s, nir_lower_vec_to_regs, ntt_vec_to_mov_writemask_cb, NULL); + NIR_PASS(_, s, nir_convert_from_ssa, true, false); + NIR_PASS(_, s, nir_lower_vec_to_regs, ntt_vec_to_mov_writemask_cb, NULL); /* locals_to_reg_intrinsics will leave dead derefs that are good to clean up. */ - NIR_PASS_V(s, nir_lower_locals_to_regs, 32); - NIR_PASS_V(s, nir_opt_dce); + NIR_PASS(_, s, nir_lower_locals_to_regs, 32); + NIR_PASS(_, s, nir_opt_dce); /* See comment in ntt_get_alu_src for supported modifiers */ - NIR_PASS_V(s, nir_legacy_trivialize, !options->lower_fabs); + NIR_PASS(_, s, nir_legacy_trivialize, !options->lower_fabs); if (NIR_DEBUG(TGSI)) { fprintf(stderr, "NIR before translation to TGSI:\n");