From c2f99fb0e99c2fc1b4fd099b66552e7d0b01006b Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 15 Jun 2020 18:06:48 +0200 Subject: [PATCH] app/internal/egl: [Android] fix sRGB on Samsung S9 At least one Samsung S9 device ignores the sRGB setting if the context wasn't created with alpha in its attributes. Signed-off-by: Elias Naur --- app/internal/egl/egl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/internal/egl/egl.go b/app/internal/egl/egl.go index 5e8558e4..f1d25957 100644 --- a/app/internal/egl/egl.go +++ b/app/internal/egl/egl.go @@ -212,9 +212,11 @@ func createContext(disp _EGLDisplay) (*eglContext, error) { _EGL_CONFIG_CAVEAT, _EGL_NONE, } if srgb { - if runtime.GOOS == "linux" { + if runtime.GOOS == "linux" || runtime.GOOS == "android" { // Some Mesa drivers crash if an sRGB framebuffer is requested without alpha. // https://bugs.freedesktop.org/show_bug.cgi?id=107782. + // + // Also, some Android devices (Samsung S9) needs alpha for sRGB to work. attribs = append(attribs, _EGL_ALPHA_SIZE, 1) } // Only request a depth buffer if we're going to render directly to the framebuffer.