Skip to content

Commit

Permalink
Check for egl color space support before trying to use it to avoid cr…
Browse files Browse the repository at this point in the history
…ashing

Reviewed By: corporateshark, arhelmus

Differential Revision: D66387404

fbshipit-source-id: d25d033c402c3c28dd4e9ce41ab2d70c714dcd75
  • Loading branch information
francoiscoulombe authored and facebook-github-bot committed Nov 22, 2024
1 parent 3ae0635 commit b21f5c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ private static class SurfaceFactory implements GLSurfaceView.EGLWindowSurfaceFac
@Override
public EGLSurface createWindowSurface(
EGL10 egl10, EGLDisplay eglDisplay, EGLConfig eglConfig, Object nativeWindow) {
String eglExtensionString = egl10.eglQueryString(eglDisplay, egl10.EGL_EXTENSIONS);
if (!eglExtensionString.contains("EGL_KHR_gl_colorspace")) {
return egl10.eglCreateWindowSurface(eglDisplay, eglConfig, nativeWindow, null);
}
int[] configAttribs = {
EGL_GL_COLORSPACE_KHR,
(mIsSRGBColorSpace ? EGL_GL_COLORSPACE_SRGB_KHR : EGL_GL_COLORSPACE_LINEAR_KHR),
Expand Down
5 changes: 5 additions & 0 deletions shell/android/java/com/facebook/igl/sample/SampleView.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ private static class SurfaceFactory implements GLSurfaceView.EGLWindowSurfaceFac
@Override
public EGLSurface createWindowSurface(
EGL10 egl10, EGLDisplay eglDisplay, EGLConfig eglConfig, Object nativeWindow) {

String eglExtensionString = egl10.eglQueryString(eglDisplay, egl10.EGL_EXTENSIONS);
if (!eglExtensionString.contains("EGL_KHR_gl_colorspace")) {
return egl10.eglCreateWindowSurface(eglDisplay, eglConfig, nativeWindow, null);
}
int[] configAttribs = {
EGL_GL_COLORSPACE_KHR,
(mIsSRGBColorSpace ? EGL_GL_COLORSPACE_SRGB_KHR : EGL_GL_COLORSPACE_LINEAR_KHR),
Expand Down

0 comments on commit b21f5c2

Please sign in to comment.