This series is enough to get atomic counters going on freedreno. I half-heartedly started adding image and generic buffer support, but some freedreno-side issues (to do with instruction encoding) would have prevented me from testing it all the way.
The idea is that BUFFER[n] represents a shader buffer, and IMAGE[n] represents a shader image. The LOAD/STORE/ATOM* instructions can take either as a resource, and treat the offset/coordinate argument accordingly. I didn't double-check if any image functions ever need more than 4 coordinate args, if so a LOAD2 variant can be added later. Atomic counters are then implemented as LOAD + ATOMUADD on top of buffers. For the TGSI -> NIR bits (required for freedreno), that all gets reimplemented on top of the ssbo intrinsics. The two outstanding issues are that atomic buffer bindings are messed up, see Timothy Arceri's patch [PATCH 14/24] i965: fix atomic buffer index for bindings other than 0 If that gets accepted, a similar solution can be implemented in st/mesa. The other issue is that freedreno doesn't treat discards the way the piglit test likes. This is the age-old "should discard exit the shader" question, and the spec seems to say yes. However I seem to recall there being applications which relied on the answer to be "no" due to derivatives. Either way, this issue shouldn't really block this series. Note that nouveau support for this is blocked on figuring out how to get global memory access to actually work from the graphics pipeline. I have no plans on looking at either r600 or radeonsi for this functionality. Ilia Mirkin (11): tgsi: add ureg support for image decls ureg: add buffer support to ureg tgsi: add a is_store property tgsi: update atomic op docs gallium: add PIPE_SHADER_CAP_MAX_BUFFERS st/mesa: add atomic buffer support ttn: add buffer support freedreno: add support for state tracking shader buffers freedreno/ir3: upload shader buffer addresses after ubos freedreno/ir3: add support for ssbo intrinsics freedreno: enable ARB_shader_atomic_counters docs/relnotes/11.1.0.html | 1 + src/gallium/auxiliary/gallivm/lp_bld_limits.h | 1 + src/gallium/auxiliary/nir/tgsi_to_nir.c | 118 +++++- src/gallium/auxiliary/tgsi/tgsi_build.c | 62 +-- src/gallium/auxiliary/tgsi/tgsi_dump.c | 10 +- src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 + src/gallium/auxiliary/tgsi/tgsi_info.c | 446 ++++++++++----------- src/gallium/auxiliary/tgsi/tgsi_info.h | 1 + src/gallium/auxiliary/tgsi/tgsi_parse.c | 4 +- src/gallium/auxiliary/tgsi/tgsi_parse.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_strings.c | 3 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 10 +- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 104 +++++ src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 + src/gallium/docs/source/screen.rst | 4 + src/gallium/docs/source/tgsi.rst | 93 ++--- src/gallium/drivers/freedreno/freedreno_context.h | 2 + src/gallium/drivers/freedreno/freedreno_draw.c | 8 + src/gallium/drivers/freedreno/freedreno_resource.c | 8 + src/gallium/drivers/freedreno/freedreno_screen.c | 2 + src/gallium/drivers/freedreno/freedreno_state.c | 24 ++ src/gallium/drivers/freedreno/ir3/ir3.c | 2 +- src/gallium/drivers/freedreno/ir3/ir3.h | 20 + .../drivers/freedreno/ir3/ir3_compiler_nir.c | 77 +++- src/gallium/drivers/freedreno/ir3/ir3_depth.c | 3 +- src/gallium/drivers/freedreno/ir3/ir3_legalize.c | 4 +- src/gallium/drivers/freedreno/ir3/ir3_shader.c | 42 ++ src/gallium/drivers/freedreno/ir3/ir3_shader.h | 4 +- .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 12 +- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 2 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 2 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 2 + src/gallium/drivers/svga/svga_screen.c | 3 + src/gallium/drivers/vc4/vc4_screen.c | 2 + src/gallium/include/pipe/p_defines.h | 3 +- src/gallium/include/pipe/p_shader_tokens.h | 8 +- src/mesa/Makefile.sources | 1 + src/mesa/program/ir_to_mesa.cpp | 4 +- src/mesa/state_tracker/st_atom.c | 5 + src/mesa/state_tracker/st_atom.h | 5 + src/mesa/state_tracker/st_atom_atomicbuf.c | 151 +++++++ src/mesa/state_tracker/st_cb_bufferobjects.c | 3 + src/mesa/state_tracker/st_context.c | 1 + src/mesa/state_tracker/st_context.h | 1 + src/mesa/state_tracker/st_extensions.c | 15 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 133 +++++- 49 files changed, 1089 insertions(+), 333 deletions(-) create mode 100644 src/mesa/state_tracker/st_atom_atomicbuf.c -- 2.4.9 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev