Android: Add error callback for GL_OUT_OF_MEMORY in EglRenderer
Encountering GL_OUT_OF_MEMORY is relatively common and we should give clients a chance to deal with it in a non-fatal way. Bug: webrtc:8154 Change-Id: Ifa9ca74392f21083692b02a5144dc5632a88d34d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144561 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28495}
This commit is contained in:

committed by
Commit Bot

parent
48b1b18065
commit
ecae9cd1a7
@ -22,11 +22,19 @@ import java.nio.FloatBuffer;
|
||||
public class GlUtil {
|
||||
private GlUtil() {}
|
||||
|
||||
public static class GlOutOfMemoryException extends RuntimeException {
|
||||
public GlOutOfMemoryException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Assert that no OpenGL ES 2.0 error has been raised.
|
||||
public static void checkNoGLES2Error(String msg) {
|
||||
int error = GLES20.glGetError();
|
||||
if (error != GLES20.GL_NO_ERROR) {
|
||||
throw new RuntimeException(msg + ": GLES20 error: " + error);
|
||||
throw error == GLES20.GL_OUT_OF_MEMORY
|
||||
? new GlOutOfMemoryException(msg)
|
||||
: new RuntimeException(msg + ": GLES20 error: " + error);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user