diff --git a/CHANGELOG.md b/CHANGELOG.md index 5985745817..2f9892550d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Bottom level categories: ### Bug Fixes - Fix order of arguments to glPolygonOffset by @komadori in [#3783](https://github.com/gfx-rs/wgpu/pull/3783). +- Fix OpenGL/EGL backend not respecting non-sRGB texture formats in `SurfaceConfiguration`. by @liquidev in [#3817](https://github.com/gfx-rs/wgpu/pull/3817) #### Metal diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index 13e217f9d9..e5e2572cf1 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -1152,15 +1152,17 @@ impl crate::Surface for Surface { khronos_egl::SINGLE_BUFFER }, ]; - match self.srgb_kind { - SrgbFrameBufferKind::None => {} - SrgbFrameBufferKind::Core => { - attributes.push(khronos_egl::GL_COLORSPACE); - attributes.push(khronos_egl::GL_COLORSPACE_SRGB); - } - SrgbFrameBufferKind::Khr => { - attributes.push(EGL_GL_COLORSPACE_KHR as i32); - attributes.push(EGL_GL_COLORSPACE_SRGB_KHR as i32); + if config.format.is_srgb() { + match self.srgb_kind { + SrgbFrameBufferKind::None => {} + SrgbFrameBufferKind::Core => { + attributes.push(khronos_egl::GL_COLORSPACE); + attributes.push(khronos_egl::GL_COLORSPACE_SRGB); + } + SrgbFrameBufferKind::Khr => { + attributes.push(EGL_GL_COLORSPACE_KHR as i32); + attributes.push(EGL_GL_COLORSPACE_SRGB_KHR as i32); + } } } attributes.push(khronos_egl::ATTRIB_NONE as i32);