diff --git a/src/amd/common/ac_nir_opt_outputs.c b/src/amd/common/ac_nir_opt_outputs.c index ea382ba989a..eac9c9de2ae 100644 --- a/src/amd/common/ac_nir_opt_outputs.c +++ b/src/amd/common/ac_nir_opt_outputs.c @@ -58,7 +58,7 @@ static void ac_remove_varying(struct ac_out_info *out) /* Remove the output. (all channels) */ for (unsigned i = 0; i < ARRAY_SIZE(out->chan); i++) { if (out->chan[i].store_intr) { - nir_remove_varying(out->chan[i].store_intr); + nir_remove_varying(out->chan[i].store_intr, MESA_SHADER_FRAGMENT); out->chan[i].store_intr = NULL; out->chan[i].value = NULL; } diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 761f5a05226..a67abd45c26 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3516,12 +3516,12 @@ nir_slot_is_sysval_output_and_varying(gl_varying_slot slot, * stage. If the instruction has no other use, it's removed. */ bool -nir_remove_varying(nir_intrinsic_instr *intr) +nir_remove_varying(nir_intrinsic_instr *intr, gl_shader_stage next_shader) { nir_io_semantics sem = nir_intrinsic_io_semantics(intr); if ((!sem.no_sysval_output && - nir_slot_is_sysval_output(sem.location, MESA_SHADER_NONE)) || + nir_slot_is_sysval_output(sem.location, next_shader)) || nir_instr_xfb_write_mask(intr)) { /* Demote the store instruction. */ sem.no_varying = true; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 3784bc604fd..fcbdedc811a 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4784,7 +4784,7 @@ bool nir_slot_is_sysval_output(gl_varying_slot slot, bool nir_slot_is_varying(gl_varying_slot slot); bool nir_slot_is_sysval_output_and_varying(gl_varying_slot slot, gl_shader_stage next_shader); -bool nir_remove_varying(nir_intrinsic_instr *intr); +bool nir_remove_varying(nir_intrinsic_instr *intr, gl_shader_stage next_shader); void nir_remove_sysval_output(nir_intrinsic_instr *intr); bool nir_lower_amul(nir_shader *shader, diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 2e1a3d83f75..a7bfee2f926 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1490,7 +1490,7 @@ static bool si_nir_kill_outputs(nir_shader *nir, const union si_shader_key *key) if (nir_slot_is_varying(sem.location) && key->ge.opt.kill_outputs & (1ull << si_shader_io_get_unique_index(sem.location, true))) { - nir_remove_varying(intr); + nir_remove_varying(intr, MESA_SHADER_FRAGMENT); progress = true; }