nir: add next_stage parameter to nir_remove_varying
so that e.g. the POS output is removed if the next stage is not FS. Reviewed-by: Qiang Yu <yuq825@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user