mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
nir/lower_to_scalar: fix opt_varying with output reads
no_varying cannot be used to eliminate stores on locations which may
be subsequently read
Fixes: 0058989357 ("nir/lower_io_to_scalar: don't create output stores that have no effect")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35325>
This commit is contained in:
parent
c3034fa82c
commit
208450fc57
1 changed files with 10 additions and 3 deletions
|
|
@ -159,9 +159,16 @@ lower_store_output_to_scalar(nir_builder *b, nir_intrinsic_instr *intr)
|
|||
* they are not a sysval output, they don't feed the next shader, and
|
||||
* they don't write xfb. Don't create such stores.
|
||||
*/
|
||||
if ((sem.no_sysval_output ||
|
||||
!nir_slot_is_sysval_output(sem.location, MESA_SHADER_NONE)) &&
|
||||
(sem.no_varying ||
|
||||
bool tcs_read = b->shader->info.stage == MESA_SHADER_TESS_CTRL &&
|
||||
(sem.location >= VARYING_SLOT_VAR0_16BIT ?
|
||||
b->shader->info.outputs_read_16bit &
|
||||
BITFIELD_BIT(sem.location - VARYING_SLOT_VAR0_16BIT) :
|
||||
sem.location >= VARYING_SLOT_PATCH0 ?
|
||||
b->shader->info.patch_outputs_read &
|
||||
BITFIELD_BIT(sem.location - VARYING_SLOT_PATCH0) :
|
||||
b->shader->info.outputs_read & BITFIELD64_BIT(sem.location));
|
||||
if ((sem.no_sysval_output || !nir_slot_is_sysval_output(sem.location, MESA_SHADER_NONE)) &&
|
||||
((sem.no_varying && !tcs_read) ||
|
||||
!nir_slot_is_varying(sem.location, MESA_SHADER_NONE)) &&
|
||||
!has_xfb)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue