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}
diff --git a/sdk/android/api/org/webrtc/GlUtil.java b/sdk/android/api/org/webrtc/GlUtil.java
index bdafe81..e2dd0c5 100644
--- a/sdk/android/api/org/webrtc/GlUtil.java
+++ b/sdk/android/api/org/webrtc/GlUtil.java
@@ -11,7 +11,7 @@
package org.webrtc;
import android.opengl.GLES20;
-
+import android.opengl.GLException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@@ -22,9 +22,9 @@
public class GlUtil {
private GlUtil() {}
- public static class GlOutOfMemoryException extends RuntimeException {
- public GlOutOfMemoryException(String msg) {
- super(msg);
+ public static class GlOutOfMemoryException extends GLException {
+ public GlOutOfMemoryException(int error, String msg) {
+ super(error, msg);
}
}
@@ -33,8 +33,8 @@
int error = GLES20.glGetError();
if (error != GLES20.GL_NO_ERROR) {
throw error == GLES20.GL_OUT_OF_MEMORY
- ? new GlOutOfMemoryException(msg)
- : new RuntimeException(msg + ": GLES20 error: " + error);
+ ? new GlOutOfMemoryException(error, msg)
+ : new GLException(error, msg + ": GLES20 error: " + error);
}
}