-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix non-srgb RenderTarget::Image
#22090
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
base: main
Are you sure you want to change the base?
Conversation
RenderTarget::Image, reverts #22031RenderTarget::Image, reverts #22031
9bad6fa to
d622e30
Compare
|
@bonsairobo, can you take a look please? |
3e81d63 to
fa0e7b0
Compare
|
Sorry! I didn't realize that webgpu still isn't the default for wasm32 targets, so I must've only tested a WebGL2 build. I would prefer if the revert happened in its own PR, but idk if there is any precedent for that in Bevy. I'll review the 2nd commit. |
|
Yup, it's nicer for the git history to do revert as stand alone PRs as we squash PRs on merge |
bonsairobo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Ok, I've opened a PR for reverting. |
RenderTarget::Image, reverts #22031RenderTarget::Image
fa0e7b0 to
dc8c0d5
Compare
Objective
Fixes #22031 (comment). Fixes #15201.
#22031 makes
ViewTarget::out_texture_formatto return the underlying texture’s format, which causes some issues:ExtractedWindow::swap_chain_texture_viewalways uses srgb view. But the underlying swap chain texture in WebGPU can be Bgra8unorm, leading to format mismatch between the render pipeline and the render pass.Solution
Reverts #22031.
Renames some
formattoview_formatexplicitly.Adds
view_formattoGpuImageandImage::new_target_textureso we can make render pipeline match render pass texture view.Testing
Tested
render_to_textureandscreenshotexamples on linux and webgpu.The rendered Rgba8Unorm texture with or without srgb view in MeshMaterial3d looks the same, but the underlaying data is different:
With srgb view:

Without srgb view:
