From a62bc48d67e9e17ab56c4d07ace0fa993cab8539 Mon Sep 17 00:00:00 2001 From: lqdev Date: Tue, 30 May 2023 22:12:34 +0200 Subject: [PATCH 1/3] EGL: respect the user requesting a non-sRGB surface format What used to happen was that sRGB was used whether you requested it or not. This commit fixes that and now passing in a non-sRGB texture format in SurfaceConfiguration will result in a non-sRGB surface being created. --- wgpu-hal/src/gles/egl.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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); From 616341103c9d490c01f875e3428414acabe030cf Mon Sep 17 00:00:00 2001 From: lqdev Date: Tue, 30 May 2023 22:29:38 +0200 Subject: [PATCH 2/3] add changelog entry about the EGL non-sRGB support change --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abccdca4a9..92e118305f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ Bottom level categories: - Fix order of arguments to glPolygonOffset by @komadori in [#3783](https://github.com/gfx-rs/wgpu/pull/3783). - Fix missing 4X MSAA support on some OpenGL backends. By @emilk in [#3780](https://github.com/gfx-rs/wgpu/pull/3780) +- Fix OpenGL/EGL backend not respecting non-sRGB texture formats in `SurfaceConfiguration`. by @liquidev in [#3817](https://github.com/gfx-rs/wgpu/pull/3817) #### General From e54e6721c6c21f20efafa662beddc4241f97c25b Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 6 Jun 2023 19:43:23 +0200 Subject: [PATCH 3/3] Fix changelog merge oopsie (conflict with 16.1 notes) --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b98e6799b2..2f9892550d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,14 +65,12 @@ Bottom level categories: ### Bug Fixes - Fix order of arguments to glPolygonOffset by @komadori in [#3783](https://github.com/gfx-rs/wgpu/pull/3783). -- Fix missing 4X MSAA support on some OpenGL backends. By @emilk in [#3780](https://github.com/gfx-rs/wgpu/pull/3780) - 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 - Fix renderpasses being used inside of renderpasses. By @cwfitzgerald in [#3828](https://github.com/gfx-rs/wgpu/pull/3828) - #### General - Fix Multiview to disable validation of TextureViewDimension and ArrayLayerCount. By @MalekiRe in [#3779](https://github.com/gfx-rs/wgpu/pull/3779#issue-1713269437).