mesa: handle atomic counter lowering for drivers with big ssbo offset aligns
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 27 May 2022 17:34:09 +0000 (13:34 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sun, 5 Jun 2022 23:16:36 +0000 (23:16 +0000)
commit06859ba69c8c29ccd4835cee7083bb3b53abe450
treef8c76773d81a3af6431adc5624f0e5dd0da8ed1b
parent5b5eb77a87dfba362fffba680f603f01cdd2fcd9
mesa: handle atomic counter lowering for drivers with big ssbo offset aligns

according to the spec, atomic counters can be bound at any offset divisible by 4,
which means that any driver that uses the ssbo lowering pass and doesn't have
a min offset align of 4 is potentially broken

to handle this, use a statevar to inject the misaligned remainder of the offset
into the shader as a uniform. for well-aligned counter binds, the uniform offset
will be 0

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16749>
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_atomics_to_ssbo.c
src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c
src/mesa/state_tracker/st_atom_atomicbuf.c
src/mesa/state_tracker/st_glsl_to_nir.cpp