nir,pan/mdg: Move lower_helper_writes to common
This NIR pass lowers stores to:
if (!gl_HelperInvocaton) { store(); }
This implements the API requirement that helper invocations do not have visible side effects, and the lowering is required on any hardware that cannot directly mask helper invocation's side effects. The pass was written for Midgard (which has this issue) but is also needed for Asahi. Let's share the code.
This probably isn't totally right for atomics (they'll read back garbage for helper threads) but it seems to be good enough for the CTS...
Signed-off-by: Alyssa Rosenzweig alyssa@rosenzweig.io
Edited by Alyssa Rosenzweig