Bug 737031 - Add EGL error code to error messages in GLController. r=bgirard

This commit is contained in:
Ali Juma
2012-03-19 13:35:13 -04:00
parent d41d9dd005
commit 3050bdce30

View File

@@ -100,12 +100,14 @@ public class GLController {
if (!mEGL.eglMakeCurrent(mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT)) {
throw new GLControllerException("EGL context could not be released!");
throw new GLControllerException("EGL context could not be released! " +
getEGLError());
}
if (mEGLSurface != null) {
if (!mEGL.eglDestroySurface(mEGLDisplay, mEGLSurface)) {
throw new GLControllerException("EGL surface could not be destroyed!");
throw new GLControllerException("EGL surface could not be destroyed! " +
getEGLError());
}
mEGLSurface = null;
@@ -113,7 +115,8 @@ public class GLController {
if (mEGLContext != null) {
if (!mEGL.eglDestroyContext(mEGLDisplay, mEGLContext)) {
throw new GLControllerException("EGL context could not be destroyed!");
throw new GLControllerException("EGL context could not be destroyed! " +
getEGLError());
}
mGL = null;
@@ -192,7 +195,8 @@ public class GLController {
int[] version = new int[2];
if (!mEGL.eglInitialize(mEGLDisplay, version)) {
throw new GLControllerException("eglInitialize() failed");
throw new GLControllerException("eglInitialize() failed " +
getEGLError());
}
mEGLConfig = chooseConfig();
@@ -205,7 +209,8 @@ public class GLController {
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT,
attribList);
if (mEGLContext == null || mEGLContext == EGL10.EGL_NO_CONTEXT) {
throw new GLControllerException("createContext() failed");
throw new GLControllerException("createContext() failed " +
getEGLError());
}
}
@@ -213,12 +218,14 @@ public class GLController {
int[] numConfigs = new int[1];
if (!mEGL.eglChooseConfig(mEGLDisplay, CONFIG_SPEC, null, 0, numConfigs) ||
numConfigs[0] <= 0) {
throw new GLControllerException("No available EGL configurations");
throw new GLControllerException("No available EGL configurations " +
getEGLError());
}
EGLConfig[] configs = new EGLConfig[numConfigs[0]];
if (!mEGL.eglChooseConfig(mEGLDisplay, CONFIG_SPEC, configs, numConfigs[0], numConfigs)) {
throw new GLControllerException("No EGL configuration for that specification");
throw new GLControllerException("No EGL configuration for that specification " +
getEGLError());
}
// Select the first 565 RGB configuration.
@@ -239,12 +246,13 @@ public class GLController {
SurfaceHolder surfaceHolder = mView.getHolder();
mEGLSurface = mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surfaceHolder, null);
if (mEGLSurface == null || mEGLSurface == EGL10.EGL_NO_SURFACE) {
throw new GLControllerException("EGL window surface could not be created!");
throw new GLControllerException("EGL window surface could not be created! " +
getEGLError());
}
if (!mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
throw new GLControllerException("EGL surface could not be made into the current " +
"surface!");
"surface! " + getEGLError());
}
mGL = mEGLContext.getGL();
@@ -268,12 +276,17 @@ public class GLController {
SurfaceHolder surfaceHolder = mView.getHolder();
EGLSurface surface = mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surfaceHolder, null);
if (surface == null || surface == EGL10.EGL_NO_SURFACE) {
throw new GLControllerException("EGL window surface could not be created!");
throw new GLControllerException("EGL window surface could not be created! " +
getEGLError());
}
return surface;
}
private String getEGLError() {
return "Error " + mEGL.eglGetError();
}
public static class GLControllerException extends RuntimeException {
public static final long serialVersionUID = 1L;