Make GL errors thrown by checkNoGLES2Error inherit GLException.

The motivation is making it easier to catch exceptions for these
kind of failures only.

Bug: b/182561645
Change-Id: I09527d8665fda0fa24144cb05e9fd24c041549a9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212608
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33540}
This commit is contained in:
Sami Kalliomäki 2021-03-19 16:25:27 +00:00 committed by Commit Bot
parent 7cbe88767b
commit fa4db49532

View File

@ -11,7 +11,7 @@
package org.webrtc; package org.webrtc;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.opengl.GLException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
@ -22,9 +22,9 @@ import java.nio.FloatBuffer;
public class GlUtil { public class GlUtil {
private GlUtil() {} private GlUtil() {}
public static class GlOutOfMemoryException extends RuntimeException { public static class GlOutOfMemoryException extends GLException {
public GlOutOfMemoryException(String msg) { public GlOutOfMemoryException(int error, String msg) {
super(msg); super(error, msg);
} }
} }
@ -33,8 +33,8 @@ public class GlUtil {
int error = GLES20.glGetError(); int error = GLES20.glGetError();
if (error != GLES20.GL_NO_ERROR) { if (error != GLES20.GL_NO_ERROR) {
throw error == GLES20.GL_OUT_OF_MEMORY throw error == GLES20.GL_OUT_OF_MEMORY
? new GlOutOfMemoryException(msg) ? new GlOutOfMemoryException(error, msg)
: new RuntimeException(msg + ": GLES20 error: " + error); : new GLException(error, msg + ": GLES20 error: " + error);
} }
} }