summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-10-20 21:28:34 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-20 21:28:34 -0700
commit63ac8f5377833303a7f8c4d60f0d74daf903e6ea (patch)
treedc0678dcd066003c246bfee8a01d90647df52711 /opengl
parent4ceee5a6b0089ffbec75690b7284f80d481ab212 (diff)
parent2b2da52608303b149d22418865e67c8030c70e73 (diff)
downloadframeworks_base-63ac8f5377833303a7f8c4d60f0d74daf903e6ea.zip
frameworks_base-63ac8f5377833303a7f8c4d60f0d74daf903e6ea.tar.gz
frameworks_base-63ac8f5377833303a7f8c4d60f0d74daf903e6ea.tar.bz2
am 2b2da526: Merge "Add a test application to dump all the EGLConfig available" into gingerbread
Merge commit '2b2da52608303b149d22418865e67c8030c70e73' into gingerbread-plus-aosp * commit '2b2da52608303b149d22418865e67c8030c70e73': Add a test application to dump all the EGLConfig available
Diffstat (limited to 'opengl')
-rw-r--r--opengl/tests/configdump/Android.mk16
-rw-r--r--opengl/tests/configdump/configdump.cpp89
2 files changed, 105 insertions, 0 deletions
diff --git a/opengl/tests/configdump/Android.mk b/opengl/tests/configdump/Android.mk
new file mode 100644
index 0000000..3f7c915
--- /dev/null
+++ b/opengl/tests/configdump/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ configdump.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libEGL \
+ libGLESv1_CM
+
+LOCAL_MODULE:= test-opengl-configdump
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/configdump/configdump.cpp b/opengl/tests/configdump/configdump.cpp
new file mode 100644
index 0000000..69b9eb6
--- /dev/null
+++ b/opengl/tests/configdump/configdump.cpp
@@ -0,0 +1,89 @@
+/*
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <EGL/egl.h>
+
+#define ATTRIBUTE(_attr) { _attr, #_attr }
+
+struct Attribute {
+ EGLint attribute;
+ char const* name;
+};
+
+Attribute attributes[] = {
+ ATTRIBUTE( EGL_BUFFER_SIZE ),
+ ATTRIBUTE( EGL_ALPHA_SIZE ),
+ ATTRIBUTE( EGL_BLUE_SIZE ),
+ ATTRIBUTE( EGL_GREEN_SIZE ),
+ ATTRIBUTE( EGL_RED_SIZE ),
+ ATTRIBUTE( EGL_DEPTH_SIZE ),
+ ATTRIBUTE( EGL_STENCIL_SIZE ),
+ ATTRIBUTE( EGL_CONFIG_CAVEAT ),
+ ATTRIBUTE( EGL_CONFIG_ID ),
+ ATTRIBUTE( EGL_LEVEL ),
+ ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
+ ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
+ ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
+ ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
+ ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
+ ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
+ ATTRIBUTE( EGL_SAMPLES ),
+ ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
+ ATTRIBUTE( EGL_SURFACE_TYPE ),
+ ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
+ ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
+ ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
+ ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
+ ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
+ ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
+ ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
+ ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
+ ATTRIBUTE( EGL_LUMINANCE_SIZE ),
+ ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
+ ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
+ ATTRIBUTE( EGL_RENDERABLE_TYPE ),
+ ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
+ ATTRIBUTE( EGL_CONFORMANT ),
+};
+
+
+int main(int argc, char** argv)
+{
+ EGLConfig* configs;
+ EGLint n;
+
+ EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ eglInitialize(dpy, 0, 0);
+ eglGetConfigs(dpy, NULL, 0, &n);
+ configs = new EGLConfig[n];
+ eglGetConfigs(dpy, configs, n, &n);
+
+ for (EGLint i=0 ; i<n ; i++) {
+ printf("EGLConfig[%d]\n", i);
+ for (int attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
+ EGLint value;
+ eglGetConfigAttrib(dpy, configs[i], attributes[attr].attribute, &value);
+ printf("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
+ }
+ }
+
+ delete [] configs;
+ eglTerminate(dpy);
+ return 0;
+}