Skip to content

Conversation

@bonsairobo
Copy link
Contributor

@bonsairobo bonsairobo commented Dec 5, 2025

Objective

Solution

  • It seems there was some confusion where OutputColorAttachment::format could be different from the actual underlying texture format (of OutputColorAttachment::view). This would eventually lead to a texture format mismatch on the BlitPipeline. I removed the OutputColorAttachment::format field to resolve this conflict.
  • Sim. for ManualTextureView.

Testing

Future Work

Although the WGPU validation error is fixed, when using a non-sRGB texture format for the GPU image in the headless_renderer example, the output image seems to have incorrect gamma. I think this is because the example does a byte-for-byte copy from the GPU image to the CPU image without any gamma correction; and the image crate saves the image assuming a nonlinear color space.

I don't think we need to fix this as part of this PR, but it might be nice for bevy_image::Image::try_into_dynamic to eventually handle the gamma correction when saving linear color images.

Here you can see a comparison With sRGB with_srgb

No sRGB
no_srgb

I believe it was a bug that ManualTextureView::format could be different
from the format of the actual wgpu::Texture.
I believe it was a bug that OutputColorAttachment::format could have been
different from the actual format of the wgpu::Texture.

This also fixes bevyengine#15201
@bonsairobo
Copy link
Contributor Author

CI failure doesn't immediately seem relevant to my changes

https://github.com/bevyengine/bevy/actions/runs/19949128748/job/57205300759?pr=22031

We know that main_texture_format cannot be anything but Rgba16Float
or Rgba8UnormSrgb.
@bonsairobo bonsairobo marked this pull request as ready for review December 5, 2025 07:09
@greeble-dev greeble-dev added the A-Rendering Drawing game state to the screen label Dec 5, 2025
@greeble-dev greeble-dev added C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

RenderTarget::Image doesn't support Rgba8Unorm and Bgra8Unorm texture formats (non-srgb formats)

2 participants