virgl, nir_to_tgsi: Add a hack for promoting partial memory barriers
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 6 Sep 2023 22:38:58 +0000 (15:38 -0700)
committerMarge Bot <emma+marge@anholt.net>
Sat, 9 Sep 2023 04:41:24 +0000 (04:41 +0000)
commitfb3e37a0140571ea374311a4325dad5d770df15c
treec38369ba6fbc363484350bfb2e5966c42418972a
parentdd92fd8fcc983f113b0af8c49024eb21d971a51f
virgl, nir_to_tgsi: Add a hack for promoting partial memory barriers

Most drivers will want nir_opt_barrier_modes() to optimize out
unnecessary memory barrier modes.  However, virgl has to translate
back to GLSL, which means it can really only handle partial memory
barriers in compute shaders today, because there isn't a proper
way to express them otherwise.  Just ask nir_to_tgsi to promote
these back to full barriers as a workaround.

See KHR-GL43.shader_storage_buffer_object.advanced-readWrite-case1
on virpipe-on-gl as a case where this hack is needed.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24842>
src/gallium/auxiliary/nir/nir_to_tgsi.c
src/gallium/auxiliary/nir/nir_to_tgsi.h
src/gallium/drivers/virgl/virgl_context.c