nir: Add pass to lower image atomics
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 19 May 2023 03:20:15 +0000 (23:20 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 22 May 2023 14:33:13 +0000 (14:33 +0000)
commitde648020af04ad27277c92777061c59603a9fec6
tree7a4168a2955dd6a7ce74f5d056249afc7fcc3fcf
parent66656822e317bf0d12cbcadc5b62bbc0d05b5b2b
nir: Add pass to lower image atomics

Hardware that lacks dedicated image atomics can still implement image atomics
with regular atomics on global memory, as long as there is a way to get the
address of a texel in memory. I've open-coded this lowering in my first 2
compilers, so before I add another crappy vendored version in my 3rd, let's add
a common NIR pass to do the lowering.

Thanks to unified atomics, the pass itself is fairly concise.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23120>
src/compiler/nir/meson.build
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_image_atomics_to_global.c [new file with mode: 0644]