Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework swapchain management #4609

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Rework swapchain management #4609

wants to merge 22 commits into from

Conversation

doitsujin
Copy link
Owner

@doitsujin doitsujin commented Jan 13, 2025

Big refactor that moves a lot of responsibility to the backend, where it should have been in the first place.

Key changes:

  • Vulkan surface and swapchain creation now happens entirely in the backend. Instead of this clusterfuck where the front-end needs to manually synchronize everything through four different threads and then pray that it actually works, we now just set swapchain properties via a bunch of functions that can then get applied during the next acquireNextImage call.
  • Enabled automatic conversion between HDR10 and scRGB color spaces if the system only supports one of those and the game uses the other. This is definitely not well tested with actual HDR content though.
  • Fixed broken blending with the HUD and software cursor in non-linear color spaces (sRGB if the image format is non-sRGB; HDR10)

Needs lots of testing, especially in D3D9 apps since there are so many weird edge cases wrt swapchain usage.

@doitsujin doitsujin force-pushed the swapchain-rework branch 5 times, most recently from cb57e40 to 22ccf41 Compare January 13, 2025 14:15
@doitsujin doitsujin marked this pull request as ready for review January 13, 2025 16:08
The swap chain blitter can deal with the conversion.
Needed for D3D8 due to implicit swapchain shenanigans.
This will be necessary for non-linear color spaces to get proper blending.
Also adds a separate set of shaders for the software cursor, provided it
can be drawn directly with alpha blending.
For sRGB, using a native sRGB format allows the swapchain blitter
to use a more efficient code path for drawing the HUD.

Also allow RGB9E5 for sRGB and HDR10.
May fix some issues in case the WSI implementation can return SUBOPTIMAL
from present but not acquire. Also ensure to keep state consistent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant