diff options
author | Jack Palevich <jackpal@google.com> | 2009-09-28 18:38:48 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-09-28 18:38:48 -0700 |
commit | 019116ce202021e1b274516c9813aeff83b1b5ab (patch) | |
tree | 7ee0ef8e730aa9aceb928ed82a315a4d503b8e5f | |
parent | 0da1a301dcb4c3a3ad01aadc89f25ccbfd8835bd (diff) | |
parent | 97702aacfc7f84b473357ce102cc70da2a316032 (diff) | |
download | frameworks_base-019116ce202021e1b274516c9813aeff83b1b5ab.zip frameworks_base-019116ce202021e1b274516c9813aeff83b1b5ab.tar.gz frameworks_base-019116ce202021e1b274516c9813aeff83b1b5ab.tar.bz2 |
am 97702aac: Merge changes I82c78b83,I54f72d9d into eclair
Merge commit '97702aacfc7f84b473357ce102cc70da2a316032' into eclair-plus-aosp
* commit '97702aacfc7f84b473357ce102cc70da2a316032':
Don't ask for pbuffer support, because we don't use any pbuffers.
Print out EGL configuration info for the config we've chosen.
-rw-r--r-- | opengl/tests/gl2_basic/gl2_basic.cpp | 110 | ||||
-rw-r--r-- | opengl/tests/tritex/tritex.cpp | 2 |
2 files changed, 58 insertions, 54 deletions
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp index d1090e6..2361db5 100644 --- a/opengl/tests/gl2_basic/gl2_basic.cpp +++ b/opengl/tests/gl2_basic/gl2_basic.cpp @@ -175,24 +175,58 @@ void renderFrame() { checkGlError("glDrawArrays"); } -#if 0 - -void PrintEGLConfig(EGLDisplay dpy, EGLConfig config) { - int attrib[] = {EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE, EGL_ALPHA_SIZE, - EGL_DEPTH_SIZE, EGL_SURFACE_TYPE, EGL_RENDERABLE_TYPE - }; - for(size_t i = 0; i < sizeof(attrib)/sizeof(attrib[0]); i++) { - int value = 0; - int a = attrib[i]; - if (eglGetConfigAttrib(dpy, config, a, &value)) { - printf(" 0x%04x: %d", a, value); +void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) { + +#define X(VAL) {VAL, #VAL} + struct {EGLint attribute; const char* name;} names[] = { + X(EGL_BUFFER_SIZE), + X(EGL_ALPHA_SIZE), + X(EGL_BLUE_SIZE), + X(EGL_GREEN_SIZE), + X(EGL_RED_SIZE), + X(EGL_DEPTH_SIZE), + X(EGL_STENCIL_SIZE), + X(EGL_CONFIG_CAVEAT), + X(EGL_CONFIG_ID), + X(EGL_LEVEL), + X(EGL_MAX_PBUFFER_HEIGHT), + X(EGL_MAX_PBUFFER_PIXELS), + X(EGL_MAX_PBUFFER_WIDTH), + X(EGL_NATIVE_RENDERABLE), + X(EGL_NATIVE_VISUAL_ID), + X(EGL_NATIVE_VISUAL_TYPE), + X(EGL_PRESERVED_RESOURCES), + X(EGL_SAMPLES), + X(EGL_SAMPLE_BUFFERS), + X(EGL_SURFACE_TYPE), + X(EGL_TRANSPARENT_TYPE), + X(EGL_TRANSPARENT_RED_VALUE), + X(EGL_TRANSPARENT_GREEN_VALUE), + X(EGL_TRANSPARENT_BLUE_VALUE), + X(EGL_BIND_TO_TEXTURE_RGB), + X(EGL_BIND_TO_TEXTURE_RGBA), + X(EGL_MIN_SWAP_INTERVAL), + X(EGL_MAX_SWAP_INTERVAL), + X(EGL_LUMINANCE_SIZE), + X(EGL_ALPHA_MASK_SIZE), + X(EGL_COLOR_BUFFER_TYPE), + X(EGL_RENDERABLE_TYPE), + X(EGL_CONFORMANT), + }; +#undef X + + for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) { + EGLint value = -1; + EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value); + EGLint error = eglGetError(); + if (returnVal && error == EGL_SUCCESS) { + printf(" %s: ", names[j].name); + printf("%d (0x%x)", value, value); } } printf("\n"); } -#endif - int printEGLConfigurations(EGLDisplay dpy) { EGLint numConfig = 0; EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig); @@ -209,53 +243,16 @@ int printEGLConfigurations(EGLDisplay dpy) { return false; } - returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig); + returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig); checkEglError("eglGetConfigs", returnVal); if (!returnVal) { free(configs); return false; } -#define X(VAL) {VAL, #VAL} - struct {EGLint attribute; const char* name;} names[] = { - X(EGL_BUFFER_SIZE), - X(EGL_RED_SIZE), - X(EGL_GREEN_SIZE), - X(EGL_BLUE_SIZE), - X(EGL_ALPHA_SIZE), - X(EGL_CONFIG_CAVEAT), - X(EGL_CONFIG_ID), - X(EGL_DEPTH_SIZE), - X(EGL_LEVEL), - X(EGL_MAX_PBUFFER_WIDTH), - X(EGL_MAX_PBUFFER_HEIGHT), - X(EGL_MAX_PBUFFER_PIXELS), - X(EGL_NATIVE_RENDERABLE), - X(EGL_NATIVE_VISUAL_ID), - X(EGL_NATIVE_VISUAL_TYPE), - X(EGL_PRESERVED_RESOURCES), - X(EGL_SAMPLE_BUFFERS), - X(EGL_SAMPLES), - // X(EGL_STENCIL_BITS), - X(EGL_SURFACE_TYPE), - X(EGL_TRANSPARENT_TYPE), - // X(EGL_TRANSPARENT_RED), - // X(EGL_TRANSPARENT_GREEN), - // X(EGL_TRANSPARENT_BLUE) - }; -#undef X - for(int i = 0; i < numConfig; i++) { printf("Configuration %d\n", i); - EGLConfig config = configs[i]; - for (int j = 0; j < sizeof(names) / sizeof(names[0]); j++) { - EGLint value = -1; - returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value); - if (returnVal) { - printf(" %s: %d (0x%x)", names[j].name, value, value); - } - } - printf("\n"); + printEGLConfiguration(dpy, configs[i]); } free(configs); @@ -268,7 +265,7 @@ int main(int argc, char** argv) { EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; EGLint s_configAttribs[] = { - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT|EGL_WINDOW_BIT, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLint majorVersion; @@ -300,6 +297,8 @@ int main(int argc, char** argv) { return 0; } + checkEglError("printEGLConfigurations"); + EGLNativeWindowType window = android_createDisplaySurface();
returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig); if (returnValue) { @@ -307,6 +306,11 @@ int main(int argc, char** argv) { return 0; } + checkEglError("EGLUtils::selectConfigForNativeWindow"); + + printf("Chose this configuration:\n"); + printEGLConfiguration(dpy, myConfig); + surface = eglCreateWindowSurface(dpy, myConfig, window, NULL); checkEglError("eglCreateWindowSurface"); if (surface == EGL_NO_SURFACE) { diff --git a/opengl/tests/tritex/tritex.cpp b/opengl/tests/tritex/tritex.cpp index 629b53c..3365ab4 100644 --- a/opengl/tests/tritex/tritex.cpp +++ b/opengl/tests/tritex/tritex.cpp @@ -123,7 +123,7 @@ int init_gl_surface(void) EGLConfig myConfig = {0};
EGLint attrib[] =
{
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT|EGL_WINDOW_BIT, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_DEPTH_SIZE, 16,
EGL_NONE
};
|