Skip to content

Commit c002936

Browse files
Romain GuyJean-Baptiste Queru
authored andcommitted
Trigger the log when EGL_NO_CONTEXT is returned by eglCreateContext
Bug #7216919 Change-Id: If2059227d55e8ddb2d2673ee36029c3c92dd9a3d
1 parent bf2e088 commit c002936

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

core/java/android/view/HardwareRenderer.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -864,12 +864,6 @@ void initializeEgl() {
864864

865865
if (mEglContext == null) {
866866
mEglContext = createContext(sEgl, sEglDisplay, sEglConfig);
867-
if (mEglContext == null) {
868-
//noinspection ConstantConditions
869-
throw new IllegalStateException("Could not create an EGL context. " +
870-
"eglCreateContext failed with error: " +
871-
GLUtils.getEGLErrorString(sEgl.eglGetError()));
872-
}
873867
sEglContextStorage.set(createManagedContext(mEglContext));
874868
}
875869
}
@@ -998,8 +992,15 @@ private void enableDirtyRegions() {
998992
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
999993
int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
1000994

1001-
return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT,
1002-
mGlVersion != 0 ? attribs : null);
995+
EGLContext context = egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT,
996+
mGlVersion != 0 ? attribs : null);
997+
if (context == null) {
998+
//noinspection ConstantConditions
999+
throw new IllegalStateException(
1000+
"Could not create an EGL context. eglCreateContext failed with error: " +
1001+
GLUtils.getEGLErrorString(sEgl.eglGetError()));
1002+
}
1003+
return context;
10031004
}
10041005

10051006
@Override

0 commit comments

Comments
 (0)