mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Check for EGL_NO_SURFACE and similar in GlUtil
`== null` does not check for equality with EGL_NO_SURFACE, EGL_NO_CONTEXT, or EGL_NO_DISPLAY. PiperOrigin-RevId: 657651835
This commit is contained in:
parent
04bfeec751
commit
3f49f5c157
1 changed files with 7 additions and 4 deletions
|
|
@ -293,7 +293,7 @@ public final class GlUtil {
|
|||
sharedContext,
|
||||
contextAttributes,
|
||||
/* offset= */ 0);
|
||||
if (eglContext == null) {
|
||||
if (eglContext == null || eglContext.equals(EGL14.EGL_NO_CONTEXT)) {
|
||||
EGL14.eglTerminate(eglDisplay);
|
||||
throw new GlException(
|
||||
"eglCreateContext() failed to create a valid context. The device may not support EGL"
|
||||
|
|
@ -778,13 +778,13 @@ public final class GlUtil {
|
|||
*/
|
||||
public static void destroyEglContext(
|
||||
@Nullable EGLDisplay eglDisplay, @Nullable EGLContext eglContext) throws GlException {
|
||||
if (eglDisplay == null) {
|
||||
if (eglDisplay == null || eglDisplay.equals(EGL14.EGL_NO_DISPLAY)) {
|
||||
return;
|
||||
}
|
||||
EGL14.eglMakeCurrent(
|
||||
eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
|
||||
checkEglException("Error releasing context");
|
||||
if (eglContext != null) {
|
||||
if (eglContext != null && !eglContext.equals(EGL14.EGL_NO_CONTEXT)) {
|
||||
EGL14.eglDestroyContext(eglDisplay, eglContext);
|
||||
checkEglException("Error destroying context");
|
||||
}
|
||||
|
|
@ -800,7 +800,10 @@ public final class GlUtil {
|
|||
*/
|
||||
public static void destroyEglSurface(
|
||||
@Nullable EGLDisplay eglDisplay, @Nullable EGLSurface eglSurface) throws GlException {
|
||||
if (eglDisplay == null || eglSurface == null) {
|
||||
if (eglDisplay == null || eglDisplay.equals(EGL14.EGL_NO_DISPLAY)) {
|
||||
return;
|
||||
}
|
||||
if (eglSurface == null || eglSurface.equals(EGL14.EGL_NO_SURFACE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue