Vulkan: Fix HDR render pass format mismatch on first frame#18743
Merged
warmenhoven merged 1 commit intolibretro:masterfrom Feb 17, 2026
Merged
Conversation
When HDR is enabled, the first frame after vulkan_init() causes validation errors because the HDR offscreen buffer doesn't exist yet (it's created in the end-of-frame resize handler). This means menu drawing occurs inside the HDR render pass (A2B10G10R10) using pipelines compiled for the SDR render pass (B8G8R8A8). Create the offscreen buffers in vulkan_init() when HDR is already enabled so they're ready for the first frame. The end-of-frame resize handler will safely destroy and recreate them.
Contributor
Author
|
This is hopefully the fix for issue: @warmenhoven I dont know if you can test this for me on MacOS when you get a chance? I'm just going off your comment that happens when you swap over to HDR - feels like a first frame issue. Thanks |
Collaborator
|
Yep, this definitely seems to fix it, I don't see any more validation errors! |
Contributor
Author
|
@warmenhoven Blinking heck you work quick - the PR hasn't even finished the checks lol! Great stuff well done we've cracked the nut, we can all go home and rest. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vkCmdDraw()reports incompatible render pass formats:VK_FORMAT_A2B10G10R10_UNORM_PACK32vsVK_FORMAT_B8G8R8A8_UNORMvulkan_init()setsVK_FLAG_SHOULD_RESIZEbut the HDR offscreen buffer isn't created until the end-of-frame resize handler runs, so the first frame draws menu/overlay with SDR-format pipelines inside the HDR-format render passvulkan_init()whenVK_CTX_FLAG_HDR_ENABLEis already set, so they exist for the first frame. The end-of-frame resize handler safely destroys and recreates them as before