Skip to content

Use non-srgb main texture to support storage. Fix ClearColor in srgb compositing#23803

Open
beicause wants to merge 1 commit intobevyengine:mainfrom
beicause:non-srgb-main-texture
Open

Use non-srgb main texture to support storage. Fix ClearColor in srgb compositing#23803
beicause wants to merge 1 commit intobevyengine:mainfrom
beicause:non-srgb-main-texture

Conversation

@beicause
Copy link
Copy Markdown
Contributor

Objective

Our main texture is srgb format, which doesn't support storage usage (in CameraMainTextureUsages) on some devices and WebGPU.

Also the ClearColor is incorrectly converted to linear color when using CompositingSpace::Srgb

Solution

Always use non-srgb main texture (srgb view is not needed).

As intermediate texture, whether it is srgb or not doesn’t matter and makes no difference during rendering and sampling, unless you copy it to a buffer or retrieve the data. But I believe nowhere does that. The screenshot plugin copies render target instead of main texture.

Testing

Run the code from #9213 (comment)

Details

Before, it's wrong with CompositingSpace::Srgb:
屏幕截图_20260414_120259

After:
屏幕截图_20260414_115624

@github-actions
Copy link
Copy Markdown
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-23803

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@mnmaita mnmaita added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen O-WebGPU Specific to the WebGPU render API D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Color Color spaces and color math M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered labels Apr 14, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering Apr 14, 2026
#[default]
Srgb,
/// Linear light blending. Physically correct. Requires [`Hdr`].
/// Linear light blending. Physically correct.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this also irked me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Color Color spaces and color math A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered O-WebGPU Specific to the WebGPU render API S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants