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>
/* 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;
}
* 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;
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,
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;
}