panfrost: Only write depth / stencil once if MRT is used

We can't assume that RT0 will be written, so this has to be based on
whether a combined store has already been emitted, not the location of
the store.

Emit a non-special combined_store intrinsic that only writes colour
for the other RTs, as reordering stores breaks the Midgard compiler.

Fixes: d37e901e35 ("pan/mdg: Add new depth store lowering")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6527
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16685>
This commit is contained in:
Icecream95 2022-05-24 18:25:47 +12:00 committed by Marge Bot
parent 0a53ebabcd
commit a4323b0979
1 changed files with 6 additions and 1 deletions

View File

@ -173,7 +173,12 @@ pan_nir_lower_zs_store(nir_shader *nir)
nir_builder_init(&b, function->impl);
b.cursor = nir_after_block_before_jump(instr->block);
pan_nir_emit_combined_store(&b, intr, writeout | PAN_WRITEOUT_C, stores);
/* Trying to write depth twice results in the
* wrong blend shader being executed on
* Midgard */
unsigned this_store = PAN_WRITEOUT_C | (replaced ? 0 : writeout);
pan_nir_emit_combined_store(&b, intr, this_store, stores);
nir_instr_remove(instr);