~eliasnaur/gio

ui/app/egl.go: on failure, try again without sRGB v1 PROPOSED

Drew DeVault: 1
 ui/app/egl.go: on failure, try again without sRGB

 1 files changed, 6 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio/patches/8249/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] ui/app/egl.go: on failure, try again without sRGB Export this patch

Signed-off-by: Drew DeVault <sir@cmpwn.com>
---
I spent some time looking for ways to detect if EGL_COLORSPACE_SRGB_KHR
is missing even when EGL_KHR_gl_colorspace is present, but couldn't find
anything. Also tried to determine if EGL_KHR_gl_colorspace being present
requried EGL_COLORSPACE_SRGB_KHR support, implying a bug in the EGL
implementation, but I had no conclusive answers there, either.

 ui/app/egl.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ui/app/egl.go b/ui/app/egl.go
index ee07993..ab0b7f4 100644
--- a/ui/app/egl.go
+++ b/ui/app/egl.go
@@ -256,6 +256,12 @@ func createSurfaceAndMakeCurrent(eglCtx *eglContext, win _EGLNativeWindowType) (
	}
	surfAttribs = append(surfAttribs, _EGL_NONE)
	eglSurf := eglCreateWindowSurface(eglCtx.disp, eglCtx.config, win, surfAttribs)
	if eglSurf == nilEGLSurface && eglCtx.srgb {
		// Try again without sRGB
		eglCtx.sRGB = false
		surfAttribs = []_EGLint{_EGL_NONE}
		eglSurf = eglCreateWindowSurface(eglCtx.disp, eglCtx.config, win, surfAttribs)
	}
	if eglSurf == nilEGLSurface {
		return nilEGLSurface, fmt.Errorf("newContext: eglCreateWindowSurface failed 0x%x (sRGB=%v)", eglGetError(), eglCtx.srgb)
	}
-- 
2.23.0