From d3fffef86188d51cebc2a6c977d7c01c9c78798c Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 20 Aug 2020 14:23:05 +0200 Subject: [PATCH] app/internal/egl: adjust alpha bit depth to enable sRGB on some GPUs On my setup: Extended renderer info (GLX_MESA_query_renderer): Vendor: Intel (0x8086) Device: Mesa Intel(R) HD Graphics 530 (SKL GT2) (0x1912) Version: 20.1.5 Accelerated: yes Video memory: 3072MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 4.6 Max compat profile version: 4.6 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.2 eglCreateWindowSurface with the sRGB flag fails with EGL_BAD_MATCH. Bumping the ALPHA_SIZE from 1 to 8 seems to make the driver happy again. Signed-off-by: Elias Naur --- app/internal/egl/egl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/internal/egl/egl.go b/app/internal/egl/egl.go index a70fe513..1af49e1d 100644 --- a/app/internal/egl/egl.go +++ b/app/internal/egl/egl.go @@ -219,7 +219,7 @@ func createContext(disp _EGLDisplay) (*eglContext, error) { // 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) + attribs = append(attribs, _EGL_ALPHA_SIZE, 8) } // Only request a depth buffer if we're going to render directly to the framebuffer. attribs = append(attribs, _EGL_DEPTH_SIZE, 16)