diff options
author | Jack Palevich <jackpal@google.com> | 2009-09-25 19:16:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-09-25 19:16:13 -0700 |
commit | a46c138ab37e141f195d449f453dda8bd1df0947 (patch) | |
tree | f75f710e3a0b6b1d388ec1925877d13092bb4f16 /opengl | |
parent | dd9649931fa2ce3a9fa469438cd81fc748355be0 (diff) | |
parent | 07e0dce441ea056710efd76d7df18b8833de772a (diff) | |
download | frameworks_base-a46c138ab37e141f195d449f453dda8bd1df0947.zip frameworks_base-a46c138ab37e141f195d449f453dda8bd1df0947.tar.gz frameworks_base-a46c138ab37e141f195d449f453dda8bd1df0947.tar.bz2 |
am 07e0dce4: Merge change 27202 into eclair
Merge commit '07e0dce441ea056710efd76d7df18b8833de772a' into eclair-plus-aosp
* commit '07e0dce441ea056710efd76d7df18b8833de772a':
Check for failure to create EGL surfaces and contexts.
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/java/android/opengl/GLSurfaceView.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java index 3662a4f..695d061 100644 --- a/opengl/java/android/opengl/GLSurfaceView.java +++ b/opengl/java/android/opengl/GLSurfaceView.java @@ -829,6 +829,9 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback * OpenGL context is a somewhat heavy object. */ mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); + if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) { + throw new RuntimeException("createContext failed"); + } mEglSurface = null; } @@ -842,7 +845,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback * The window size has changed, so we need to create a new * surface. */ - if (mEglSurface != null) { + if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { /* * Unbind and destroy the old EGL surface, if @@ -859,12 +862,17 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, holder); + if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { + throw new RuntimeException("createWindowSurface failed"); + } + /* * Before we can issue GL commands, we need to make sure * the context is current and bound to a surface. */ - mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext); + if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { + throw new RuntimeException("eglMakeCurrent failed."); + } GL gl = mEglContext.getGL(); if (mGLWrapper != null) { @@ -902,7 +910,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback } public void destroySurface() { - if (mEglSurface != null) { + if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); |