Skip to content

dzn: Cache and pack transition barriers

Boris Brezillon requested to merge bbrezillon/mesa:dzn-transition-barrier into main

Some Vulkan -> D3D12 API mismatches force us to do behind-the-scene transitions to get resources in the right state when executing non-native operations. In this case, caching the transition until the resource is actually used might save us unneeded transitions.

The packing aspect is mostly useful to limit the ExecuteBarriers() call overhead. Right now we do per-resource packing, and any hole in the subresource range will trigger several ExecuteBarriers() calls. This can be improved by collecting barriers in a separate array, and flushing the collected transition barriers just before executing the operation using the subresources pointed by those barriers. While not impossible, it'd be more verbose than what we have right now, so I'm not entirely convinced it's worth it.

Caching could be improved to avoid any unnecessary flush when we do blit or copy operations and transition the resources back to their original state, since the user might decide to transition the image to a new layout just after that. But doing that would require keeping track of all resources used by dispatch/draw operations, which in turn implies keeping info about which of the descriptor set resources are used by the graphics/compute pipelines. Not sure the it's worth the extra complexity given D3D12 enhanced barriers are just around the corner, and those map pretty nicely to the vulkan barrier+image-layout model.

Merge request reports