summaryrefslogtreecommitdiffstats
path: root/opengl/tests/fillrate
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-06 16:25:37 -0700
committerMathias Agopian <mathias@google.com>2009-08-06 16:26:15 -0700
commita1f6eff297a3e4870e22fdae926648bda3466805 (patch)
tree95371971e42f63e18a6d108e7feede0c7797a6f4 /opengl/tests/fillrate
parent265d9c076a588cf4cd811fbafd999c7ffe36641b (diff)
downloadframeworks_base-a1f6eff297a3e4870e22fdae926648bda3466805.zip
frameworks_base-a1f6eff297a3e4870e22fdae926648bda3466805.tar.gz
frameworks_base-a1f6eff297a3e4870e22fdae926648bda3466805.tar.bz2
update most gl tests to use EGLUtils
Diffstat (limited to 'opengl/tests/fillrate')
-rw-r--r--opengl/tests/fillrate/fillrate.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
index 108a87c..4ffbc8b 100644
--- a/opengl/tests/fillrate/fillrate.cpp
+++ b/opengl/tests/fillrate/fillrate.cpp
@@ -26,6 +26,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
using namespace android;
@@ -36,48 +37,27 @@ int main(int argc, char** argv)
EGL_NONE
};
- EGLint numConfigs = -1, n=0;
EGLint majorVersion;
EGLint minorVersion;
- EGLConfig config;
EGLContext context;
+ EGLConfig config;
EGLSurface surface;
EGLint w, h;
-
EGLDisplay dpy;
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
+
+ EGLNativeWindowType window = android_createDisplaySurface();
- // 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<n ; i++) {
- EGLint r,g,b,a;
- eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &r);
- eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &g);
- eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &b);
- eglGetConfigAttrib(dpy, configs[i], EGL_ALPHA_SIZE, &a);
- if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) {
- config = configs[i];
- break;
- }
- }
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
}
- free(configs);
-
- surface = eglCreateWindowSurface(dpy, config,
- android_createDisplaySurface(), NULL);
+
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
context = eglCreateContext(dpy, config, NULL, NULL);
eglMakeCurrent(dpy, surface, surface, context);
eglQuerySurface(dpy, surface, EGL_WIDTH, &w);