diff options
author | Louis Huemiller <lhuemill@google.com> | 2011-01-05 18:53:47 -0800 |
---|---|---|
committer | Louis Huemiller <lhuemill@google.com> | 2011-01-06 21:25:50 -0800 |
commit | 734d8d898c6b0b315e431b231cc6759514da361b (patch) | |
tree | 0f7af97a84e10ef07b301bdd955111f9602737cf /opengl/tests/lib | |
parent | 62319b5c78f33079fecb04b843b8cd179c9d98e6 (diff) | |
download | frameworks_native-734d8d898c6b0b315e431b231cc6759514da361b.zip frameworks_native-734d8d898c6b0b315e431b231cc6759514da361b.tar.gz frameworks_native-734d8d898c6b0b315e431b231cc6759514da361b.tar.bz2 |
Hardware Composer new and refactored test cases
Change-Id: Iabf46fc5d75891f917e06a257470a0e3f2bd3c95
Diffstat (limited to 'opengl/tests/lib')
-rw-r--r-- | opengl/tests/lib/Android.mk | 32 | ||||
-rw-r--r-- | opengl/tests/lib/glTestLib.cpp | 119 |
2 files changed, 151 insertions, 0 deletions
diff --git a/opengl/tests/lib/Android.mk b/opengl/tests/lib/Android.mk new file mode 100644 index 0000000..7542ac4 --- /dev/null +++ b/opengl/tests/lib/Android.mk @@ -0,0 +1,32 @@ +# Copyright (C) 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. + +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_MODULE:= libglTest +LOCAL_SRC_FILES:= glTestLib.cpp +LOCAL_C_INCLUDES += system/extras/tests/include \ + bionic \ + bionic/libstdc++/include \ + external/stlport/stlport \ + frameworks/base/opengl/tests/include \ + +LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES + +LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport +LOCAL_PRELINK_MODULE := false + +include $(BUILD_STATIC_LIBRARY) diff --git a/opengl/tests/lib/glTestLib.cpp b/opengl/tests/lib/glTestLib.cpp new file mode 100644 index 0000000..052cbd7 --- /dev/null +++ b/opengl/tests/lib/glTestLib.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2011 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. + * + */ + +/* + * Graphics Test Library + */ + +#include <glTestLib.h> + +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> + +#include <ui/EGLUtils.h> + +#include <utils/Log.h> +#include <testUtil.h> + +using namespace std; +using namespace android; + +void glTestPrintGLString(const char *name, GLenum s) +{ + const char *v = (const char *) glGetString(s); + + if (v == NULL) { + testPrintI("GL %s unknown", name); + } else { + testPrintI("GL %s = %s", name, v); + } +} + +void glTestCheckEglError(const char* op, EGLBoolean returnVal) +{ + if (returnVal != EGL_TRUE) { + testPrintE("%s() returned %d", op, returnVal); + } + + for (EGLint error = eglGetError(); error != EGL_SUCCESS; error + = eglGetError()) { + testPrintE("after %s() eglError %s (0x%x)", + op, EGLUtils::strerror(error), error); + } +} + +void glTestCheckGlError(const char* op) +{ + for (GLint error = glGetError(); error; error + = glGetError()) { + testPrintE("after %s() glError (0x%x)", op, error); + } +} + +void glTestPrintEGLConfiguration(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_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) { + testPrintI(" %s: %d (%#x)", names[j].name, value, value); + } + } + testPrintI(""); +} |