zink: layout issues on tilers
One of the last remaining perf issues I'm aware of that would impact tilers is renderpass splitting due to layout changes. Specifically the case of ATTACHMENT -> SHADER_READ (or FEEDBACK_LOOP if the app is being stupid enough).
With tc optimizing, it's possible to know in advance how fb attachments will be used, but it's not (currently) possible to know how they will be used once they're not fb attachments. A common pattern is something like:
- renderpass A with fb attachment X
- renderpass B with fb attachment Y
- bind samplers
- draw
- bind new samplers
- samplerview X (previously attachment X) now needs to split the renderpass for a SHADER_READ layout change (currently ATTACHMENT)
There's a few options I've come up with, and they're all terrible:
- always transition attachments to SHADER_READ on unbind
- do one cmdbuf per renderpass so it's always possible to add layout changes onto the previous cmdbuf
- add some really terrible tracking to tc that will annihilate the cpu
Maybe there's better ones? Maybe there's some way to do this as a vk extension somehow? I don't know.