Current swap-chain api is designed mostly of DX12. It's ok, but not the best in convenience and requires extra blit in case of Metal.
DX-like is also very hard to model on top of vulkan, requires forest of fences and semaphores.
New api idea, to make it metal-like:
Attachment img = swapchain.next(); // point of failure for VK_ERROR_OUT_OF_DATE_KHR/VK_SUBOPTIMAL_KHR
// render as usual
device.present(std::move(img)); // destructive from application side
For error handling:
present can deffer failure, in case of VK_ERROR_OUT_OF_DATE_KHR.
next can implement recovery, that is invisible to application
- or "fail-fast" without wasting time on command recording of unusable frame
vulkan:
should be similar to conventional acquire/release flow under the hood.
'discard' is an issue - probably just hold to imageIndex.
metal:
matches metal api
dx12:
adds constraint: only one image at time can be taken from swapchain
note1:
This design, unintentionally, defined frame-discard operation: application can simply abandon image.
note2:
Is reset no longer useful? can be hidden inside next call.
Current swap-chain api is designed mostly of DX12. It's ok, but not the best in convenience and requires extra blit in case of Metal.
DX-like is also very hard to model on top of vulkan, requires forest of fences and semaphores.
New api idea, to make it metal-like:
For error handling:
presentcan deffer failure, in case ofVK_ERROR_OUT_OF_DATE_KHR.nextcan implement recovery, that is invisible to applicationvulkan:
should be similar to conventional acquire/release flow under the hood.
'discard' is an issue - probably just hold to imageIndex.
metal:
matches metal api
dx12:
adds constraint: only one image at time can be taken from swapchain
note1:
This design, unintentionally, defined frame-discard operation: application can simply abandon image.
note2:
Is
resetno longer useful? can be hidden insidenextcall.