Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression on OpenGL (EGL) where non-sRGB still used sRGB #5642

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ By @stefnotch in [#5410](https://github.com/gfx-rs/wgpu/pull/5410)

### Bug Fixes

#### GLES / OpenGL

- Fix regression on OpenGL (EGL) where non-sRGB still used sRGB [#5642](https://github.com/gfx-rs/wgpu/pull/5642)

## v0.20.0 (2024-04-28)

### Major Changes
Expand Down
12 changes: 12 additions & 0 deletions wgpu-hal/src/gles/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,13 @@ impl Surface {

unsafe { gl.bind_framebuffer(glow::DRAW_FRAMEBUFFER, None) };
unsafe { gl.bind_framebuffer(glow::READ_FRAMEBUFFER, Some(sc.framebuffer)) };

if !matches!(self.srgb_kind, SrgbFrameBufferKind::None) {
// Disable sRGB conversions for `glBlitFramebuffer` as behavior does diverge between
// drivers and formats otherwise and we want to ensure no sRGB conversions happen.
unsafe { gl.disable(glow::FRAMEBUFFER_SRGB) };
}

// Note the Y-flipping here. GL's presentation is not flipped,
// but main rendering is. Therefore, we Y-flip the output positions
// in the shader, and also this blit.
Expand All @@ -1147,6 +1154,11 @@ impl Surface {
glow::NEAREST,
)
};

if !matches!(self.srgb_kind, SrgbFrameBufferKind::None) {
unsafe { gl.enable(glow::FRAMEBUFFER_SRGB) };
}

unsafe { gl.bind_framebuffer(glow::READ_FRAMEBUFFER, None) };

self.egl
Expand Down
Loading