nir/gather_info: Handle store_zs_agx

This acts as a depth/stencil write. The AGX compiler checks outputs_written to
determine what conservative depth settings the driver needs. Nominally, this
should work: the original store_output(FRAG_RESULT_DEPTH) intrinsic causes the
DEPTH outputs_written bit to be set, so the metadata is still correct after
lowering store_output to store_zs_agx. However, there are a handful of places
that call nir_gather_info late, which *resets* the existing outputs_written
value and regathers, causing Asahi to use the wrong conservative depth settings
when shuffling NIR pass order and breaking gl_FragDepth.

To fix, handle store_zs_agx conservatively when gathering info so we don't have
to play games with the pass order or stashing info in a sideband.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20563>
This commit is contained in:
Alyssa Rosenzweig
2023-01-07 14:46:18 -05:00
committed by Marge Bot
parent 93c40e3353
commit 2976548e4a

View File

@@ -870,6 +870,11 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
shader->info.uses_memory_barrier = true;
break;
case nir_intrinsic_store_zs_agx:
shader->info.outputs_written |= BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
BITFIELD64_BIT(FRAG_RESULT_STENCIL);
break;
default:
shader->info.uses_bindless |= intrinsic_is_bindless(instr);
if (nir_intrinsic_writes_external_memory(instr))