Fix DX11 screenshot color format#3551
Merged
bkaradzic merged 1 commit intobkaradzic:masterfrom Jan 14, 2026
Merged
Conversation
Owner
|
This is probably broken in all other backends... I'll rework screenshot to actually give underlying format instead converting to specific format. |
Owner
|
Fixing this by passing format to screenshot callback: #3603 |
Contributor
Author
|
This is great. Thanks! |
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.
The doc states that
Screenshot format is always 4-byte BGRA.but the DX11 backend process the captured image not taking in account the actual framebuffer color format. This leads to incorrect results if the framebuffer is not RGBA8.For example, this happens when running example 7-callback with a non default framebuffer color format: add
init.resolution.formatColor = bgfx::TextureFormat::RGB10A2;at line 338 beforebgfx::init(...)and observe that the captured frame is invalid.The proposed change is a port of what is done in the Vulkan backend where the image is always converted to the BGRA format.