Layouts and barriers

A storage keeps a layout for each subresource. vk_surf_use changes the layout of its view's range, and the barrier names that range. So a pass draws into level N while a draw samples level N - 1, as a downsample chain does, with each level in its own layout.

VK_IMAGE_LAYOUT_GENERAL for every subresource would be simpler. It is not the design: on AMD it can turn off the compression of a color target.

A draw that samples the subresource it renders to is a feedback loop, which today's path handles (through a copy, or the target read in place). That stays.

writer_barriers (surface.c vk_surf_written_flush) batches the barriers of the surfaces a pass wrote. It works on Surfs now, and works on storage ranges after the change.


Made from docs/dev/one-image.md at 69237645142c. GPL-3.0-or-later.