ac/nir/tess: Only write tess factors that the TES reads.
Otherwise we would write to a memory location reserved
for another per-patch output.
Fixes: 2cf7f282df
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11324
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29696>
This commit is contained in:
@@ -803,7 +803,13 @@ hs_store_tess_factors_for_tes(nir_builder *b, tess_levels tessfactors, lower_tes
|
||||
nir_def *offchip_offset = nir_load_ring_tess_offchip_offset_amd(b);
|
||||
nir_def *zero = nir_imm_int(b, 0);
|
||||
|
||||
if (st->tcs_tess_level_outer_mask) {
|
||||
/* For linked shaders, we must only write the tess factors that the TES actually reads,
|
||||
* otherwise we would write to a memory location reserved for another per-patch output.
|
||||
*/
|
||||
const bool tes_reads_outer = st->tes_inputs_read & VARYING_BIT_TESS_LEVEL_OUTER;
|
||||
const bool tes_reads_inner = st->tes_inputs_read & VARYING_BIT_TESS_LEVEL_INNER;
|
||||
|
||||
if (st->tcs_tess_level_outer_mask && tes_reads_outer) {
|
||||
const unsigned tf_outer_loc = hs_output_vram_map_io_location(b->shader, false, VARYING_SLOT_TESS_LEVEL_OUTER, st);
|
||||
nir_def *vmem_off_outer = hs_per_patch_output_vmem_offset(b, st, NULL, tf_outer_loc * 16);
|
||||
|
||||
@@ -813,7 +819,7 @@ hs_store_tess_factors_for_tes(nir_builder *b, tess_levels tessfactors, lower_tes
|
||||
.access = ACCESS_COHERENT);
|
||||
}
|
||||
|
||||
if (tessfactors.inner && st->tcs_tess_level_inner_mask) {
|
||||
if (tessfactors.inner && st->tcs_tess_level_inner_mask && tes_reads_inner) {
|
||||
const unsigned tf_inner_loc = hs_output_vram_map_io_location(b->shader, false, VARYING_SLOT_TESS_LEVEL_INNER, st);
|
||||
nir_def *vmem_off_inner = hs_per_patch_output_vmem_offset(b, st, NULL, tf_inner_loc * 16);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user