Skip to content

Commit 740ee65

Browse files
author
Romain Guy
committed
Add extra EGL error checking
Change-Id: I7cacef41ed08118c5eecf674e3d8461473692968
1 parent f9c6a10 commit 740ee65

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

core/java/android/view/HardwareRenderer.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -733,13 +733,17 @@ boolean hasDirtyRegions() {
733733
*/
734734
void checkEglErrors() {
735735
if (isEnabled()) {
736-
int error = sEgl.eglGetError();
737-
if (error != EGL_SUCCESS) {
738-
// something bad has happened revert to
739-
// normal rendering.
740-
Log.w(LOG_TAG, "EGL error: " + GLUtils.getEGLErrorString(error));
741-
fallback(error != EGL11.EGL_CONTEXT_LOST);
742-
}
736+
checkEglErrorsForced();
737+
}
738+
}
739+
740+
private void checkEglErrorsForced() {
741+
int error = sEgl.eglGetError();
742+
if (error != EGL_SUCCESS) {
743+
// something bad has happened revert to
744+
// normal rendering.
745+
Log.w(LOG_TAG, "EGL error: " + GLUtils.getEGLErrorString(error));
746+
fallback(error != EGL11.EGL_CONTEXT_LOST);
743747
}
744748
}
745749

@@ -812,7 +816,9 @@ void initializeEgl() {
812816
throw new RuntimeException("eglInitialize failed " +
813817
GLUtils.getEGLErrorString(sEgl.eglGetError()));
814818
}
815-
819+
820+
checkEglErrorsForced();
821+
816822
sEglConfig = chooseEglConfig();
817823
if (sEglConfig == null) {
818824
// We tried to use EGL_SWAP_BEHAVIOR_PRESERVED_BIT, try again without

0 commit comments

Comments
 (0)