From f4750872963839f8c6798113331b0fd64e331520 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 19 Aug 2021 10:13:07 +0200 Subject: [PATCH] gpu/internal/opengl: handle switch from non-sRGB output to sRGB output The opengl example has a screenshot functionality that renders to a non-sRGB texture, whereas window rendering is to a sRGB capable EGL surface. The opengl driver detects the switch from an sRGB capable output to a non-sRGB capable output, but not the switch back. This change releases the emulation framebuffer on the switch back. Signed-off-by: Elias Naur --- gpu/internal/opengl/opengl.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gpu/internal/opengl/opengl.go b/gpu/internal/opengl/opengl.go index 78668d5a..792e9760 100644 --- a/gpu/internal/opengl/opengl.go +++ b/gpu/internal/opengl/opengl.go @@ -244,6 +244,9 @@ func (b *Backend) BeginFrame(target driver.RenderTarget, clear bool, viewport im panic(err) } renderFBO = b.sRGBFBO.Framebuffer() + } else if b.sRGBFBO != nil { + b.sRGBFBO.Release() + b.sRGBFBO = nil } } else { b.glstate.set(b.funcs, gl.FRAMEBUFFER_SRGB, true)