sodium-fabric
sodium-fabric copied to clipboard
DXGI should be used for frame presentation
Problem
Every OpenGL driver on Windows currently has strange issues frame presentation in some way or another, making the game's frame time pacing feel miserable, especially when V-Sync is enabled. There are also problems with systems with hybrid graphics, where the monitor output is composited on a different GPU from the one which the game renders on, causing a significant performance penalty.
Modern graphics drivers on Windows have tried to implement this for other games via what could only be described as "questionable" methods, but the implementation is not always functional (see here), and it doesn't give any additional control to the application.
Solution
Since these problems are not going to be fixed any time soon (if ever), the only solution is to resort to using DXGI for frame presentation. This will allow us to support things like variable-refresh rates (VRR), flip-model presentation, and more efficient framebuffer copies from GPU->GPU.
We should aim to enable this functionality by default on all Windows computers, where possible.
Concerns
- Interacting with Windows APIs (especially anything involving COM) from Java is going to be very painful. We will likely need to pull in additional dependencies and do a lot of plumbing to make everything work.
- NVIDIA's own implementation for DXGI Presentation in OpenGL applications seems like it is broken, and there's no guarantee we can workaround whatever bug exists in the driver.