From 429c521b15112fdcc70dca602b432fae45ca3a22 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 4 Aug 2009 13:43:35 -0700 Subject: [PATCH] opengl tests --- opengl/tests/angeles/app-linux.c | 39 +++++++- opengl/tests/fillrate/Android.mk | 17 ++++ opengl/tests/fillrate/fillrate.cpp | 149 +++++++++++++++++++++++++++++ opengl/tests/textures/textures.c | 33 ++++++- 4 files changed, 231 insertions(+), 7 deletions(-) create mode 100644 opengl/tests/fillrate/Android.mk create mode 100644 opengl/tests/fillrate/fillrate.cpp diff --git a/opengl/tests/angeles/app-linux.c b/opengl/tests/angeles/app-linux.c index 7d0d320a32416..6be4876cc8df3 100644 --- a/opengl/tests/angeles/app-linux.c +++ b/opengl/tests/angeles/app-linux.c @@ -132,6 +132,7 @@ static int initGraphics() }; EGLint numConfigs = -1; + EGLint n = 0; EGLint majorVersion; EGLint minorVersion; EGLConfig config; @@ -148,15 +149,43 @@ static int initGraphics() egl_error("eglInitialize"); eglGetConfigs(dpy, NULL, 0, &numConfigs); - egl_error("eglGetConfigs"); - fprintf(stderr,"num configs %d\n", numConfigs); + + // Get all the "potential match" configs... + EGLConfig* const configs = malloc(sizeof(EGLConfig)*numConfigs); + eglChooseConfig(dpy, s_configAttribs, configs, numConfigs, &n); + config = configs[0]; + if (n > 1) { + // if there is more than one candidate, go through the list + // and pick one that matches our framebuffer format + int fbSzA = 0; // should not hardcode + int fbSzR = 5; // should not hardcode + int fbSzG = 6; // should not hardcode + int fbSzB = 5; // should not hardcode + int i; + for (i=0 ; i +#include + +#include +#include +#include + +#include +#include + +using namespace android; + +int main(int argc, char** argv) +{ + EGLint configAttribs[] = { + EGL_DEPTH_SIZE, 0, + EGL_NONE + }; + + EGLint numConfigs = -1, n=0; + EGLint majorVersion; + EGLint minorVersion; + EGLConfig config; + EGLContext context; + EGLSurface surface; + EGLint w, h; + + EGLDisplay dpy; + + dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + eglInitialize(dpy, &majorVersion, &minorVersion); + + // Get all the "potential match" configs... + eglGetConfigs(dpy, NULL, 0, &numConfigs); + EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs); + eglChooseConfig(dpy, configAttribs, configs, numConfigs, &n); + config = configs[0]; + if (n > 1) { + // if there is more than one candidate, go through the list + // and pick one that matches our framebuffer format + int fbSzA = 0; // should not hardcode + int fbSzR = 5; // should not hardcode + int fbSzG = 6; // should not hardcode + int fbSzB = 5; // should not hardcode + int i; + for (i=0 ; i 1) { + // if there is more than one candidate, go through the list + // and pick one that matches our framebuffer format + int fbSzA = 0; // should not hardcode + int fbSzR = 5; // should not hardcode + int fbSzG = 6; // should not hardcode + int fbSzB = 5; // should not hardcode + int i; + for (i=0 ; i