Skip to content

mesa: Reordering lowered atomics relative to SSBOs

Emma Anholt requested to merge anholt/mesa:ssbo-numbering into master

When you have a program with atomic counters or SSBOs, we were rewriting SSBOs to be up at the top half of the index space and atomics to be SSBO accesses in the lower half.

freedreno then had a remapping table in the compiled shader to compact them in the hardware's descriptor tables, since having a single SSBO shader take up 13/24 slots in that table (with the corresponding table upload cost) seemed wasteful. That remapping table was getting thoroughly in the way of my work on turnip, so I set about to remove it.

Instead of the previous rewriting, this series makes it so that SSBOs stay at their nice sensible numbers corresponding to the shader, and the rewritten atomics appear in the high numbers for a quick code size and sanity win. Then, we can easily (though calling anything involving binding tables and uniform storage and multiple stages of lowering "easy" may be overstating my confidence and competence) compact the atomics down next to the maximum SSBO used by the program, so that your shader now only uses 2 SSBOs for a program with 1 SSBO and 1 atomic counter. After all that, we garbage collect freedreno's mapping code, enabling SSBO arrays in turnip and paving the way for SSBO array indirection.

Merge request reports