From fa4db495322bb26e3e85bbde5b42d4a062a67e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Kalliom=C3=A4ki?= Date: Fri, 19 Mar 2021 16:25:27 +0000 Subject: [PATCH] Make GL errors thrown by checkNoGLES2Error inherit GLException. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Xavier Lepaul‎ Cr-Commit-Position: refs/heads/master@{#33540} --- sdk/android/api/org/webrtc/GlUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/android/api/org/webrtc/GlUtil.java b/sdk/android/api/org/webrtc/GlUtil.java index bdafe81fd8..e2dd0c56d6 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 @@ 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); } }