gfx-rs/wgpu

sRGB seemingly applied to non-sRGB render targets with 0.20 GL backend

vorporeal opened this issue · 4 comments

Description

Upgraded to the 0.20 release and noticed that, when using the GL backend with a non-sRGB texture format (specifically, Rgba8Unorm), colors render as though an sRGB texture format was selected.

Specifically, the rendering is different from Vulkan with the same texture format, but the same as Vulkan when using Bgra8UnormSrgb (can't do a direct comparison due to adapter support).

Repro steps

Will try to repro with a wgpu example; wanted to report this as soon as I found it so y'all were aware.

Expected vs observed behavior

I expect the same color representation between the Vulkan and GL backends when using non-sRGB texture formats.

Screenshots

Vulkan w/ Bgra8Unorm (expected):

image

OpenGL w/ Rgba8Unorm (unexpected):

image

Vulkan w/ Bgra8UnormSrgb:

image

Platform

Linux $HOSTNAME 6.8.7-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 19 Apr 2024 09:51:31 +0000 x86_64 GNU/Linux

Adapters:

IntegratedGpu: Intel(R) Graphics (RPL-P)
Backend: Vulkan
Driver: Intel open-source Mesa driver (Mesa 24.0.6-arch1.2)

IntegratedGpu: Mesa Intel(R) Graphics (RPL-P)
Backend: Gl
Driver: OpenGL (4.6 (Compatibility Profile) Mesa 24.0.6-arch1.2)

rustc 1.76.0
wgpu 0.20.0
winit 0.30.0

I'm suspicious of the changes in #5482, where issues with sRGB were discussed during the review process.

Wumpf commented

@valaphee any chance you could have a look at this? :)

Sure. (maybe I just should have copied the sRGB handling from wgl ^^')

For reproduction, you can simply set https://github.com/gfx-rs/wgpu/blob/trunk/examples/src/framework.rs#L13 SRGB to false, and it should use the non-sRGB view format.

Wumpf commented