Description
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Vulkan and OpenGL on Windows tend to exhibit lower smoothness and greater input lag compared to Direct3D applications (any version). This sometimes leads to the impression that OpenGL and Vulkan perform worse on Windows compared to Linux, when it's actually not the case – the issue is in the frame presentation itself.
A Direct3D 12 renderer is being worked on, but for users wishing to use Vulkan on Windows instead, they won't get the best possible experience.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Most AAA games using Vulkan use DirectX Graphics Infrastructure (DXGI) to create a window and present frames rendered via Vulkan. This has several benefits over using Vulkan directly like Godot currently does:
- Variable refresh rate will work more reliably, including in windowed mode.
- Flip model presentation can be used, leading to lower input lag and overall smoother presentation (regardless of whether VRR is used).
- Possibly other benefits in the future. In general, Microsoft tends to implement new OS-level functionality for Direct3D 12 games, then for Direct3D 11 and DXGI games, then (rarely) other APIs.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Quoting this comment and this comment from @HybridEidolon for posterity:
Although, for the DXGI path, does that just require Vulkan to render to surfaces obtained from a DXGI swapchain instead of a VK_KHR_swapchain, and present from DXGI side? That doesn't sound like it'd be too hard to write at least, even without the d3d12 backend.
For reference, this is a Hello World sample which uses DXGI 1.6 swapchain to present while rendering with Vulkan to the same images, which is likely the same approach used by Doom Eternal as mentioned.
A cursory glance at the code indicates the use of d3d12.h and dxgi1_6.h from the Windows 10 SDK. However, equivalent headers are available under MinGW, so they can be linked against the system d3d12/dxgi.dll. I'd think this would be possible to support without any additional SDK downloads for either compiler since it wouldn't rely on the DirectX shader compiler at all, unlike the full d3d12 driver.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, as presenting frames is handled by the renderer.
Is there a reason why this should be core and not an add-on in the asset library?
This is core rendering functionality.