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;
import android.opengl.GLES20;
import android.opengl.GLException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@ -22,9 +22,9 @@ import java.nio.FloatBuffer;
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 @@ public class GlUtil {
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);
}
}