zink: cache/reuse more resources
We can do a lot more caching to (probably) improve performance:
-
descriptor sets -
also only performing on-demand descriptor updates instead of forcing it - (not in scope for this ticket but something to consider) also potentially reordering draws based on resource r/w usage (i.e., avoiding barriers) and some kind of runtime render graph which would be feasible if we can thread up batch usage to be actively sequencing multiple batches
-
Ideally we should only have to call update_descriptors()
when an change is actually required instead of every time.
-
VkPipelineCache
Now that we have in-memory pipeline caching, it might be worthwhile to see what kinds of increases this mechanism might yield.
-
backing resource caching (for invalidates)
Thinking that to start with a zink_resource
can just cache a couple extra backing images/mems any time invalidates occur on the basis that if an app is invalidating once, it's probably going to do it again.
-
shader caching?
Not sure what kind of performance change this would yield, but it seems like not running ntv at all and just grabbing the spirv from a mmapped cached should be some kind of win.
-
transfer_map caching?
This is specifically for things like spec@arb_map_buffer_alignment@arb_map_buffer_alignment-map-invalidate-range
where we do map(buffer, full_size)
-> map(buffer, full_size / 10)
-> map(buffer, full_size / 10)
-> etc and each of the smaller map calls could just reuse a pointer from the full buffer map if we keep it around. then again, this test is also triggering the subdata replacement mechanism I added to create staging resources for in-use resources and then flush the new data back to the in-use resource later, so maybe it wouldn't actually be useful?