summaryrefslogtreecommitdiff
path: root/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl')
-rw-r--r--opengl/Android.bp24
-rw-r--r--opengl/include/EGL/eglext.h5
-rw-r--r--opengl/libs/Android.bp2
-rw-r--r--opengl/libs/EGL/Loader.cpp8
-rw-r--r--opengl/libs/EGL/eglApi.cpp2
-rw-r--r--opengl/libs/libEGL.map.txt2
-rw-r--r--opengl/tests/Android.bp15
-rw-r--r--opengl/tests/Android.mk15
-rw-r--r--opengl/tests/EGLTest/Android.bp31
-rw-r--r--opengl/tests/EGLTest/Android.mk44
-rw-r--r--opengl/tests/EGLTest/EGL_test.cpp7
-rw-r--r--opengl/tests/angeles/Android.bp22
-rw-r--r--opengl/tests/angeles/Android.mk11
-rw-r--r--opengl/tests/angeles/demo.c4
-rw-r--r--opengl/tests/configdump/Android.bp13
-rw-r--r--opengl/tests/configdump/Android.mk16
-rw-r--r--opengl/tests/configdump/configdump.cpp2
-rw-r--r--opengl/tests/fillrate/Android.bp18
-rw-r--r--opengl/tests/fillrate/Android.mk23
-rw-r--r--opengl/tests/fillrate/fillrate.cpp4
-rw-r--r--opengl/tests/filter/Android.bp20
-rw-r--r--opengl/tests/filter/Android.mk25
-rw-r--r--opengl/tests/finish/Android.bp20
-rw-r--r--opengl/tests/finish/Android.mk25
-rw-r--r--opengl/tests/finish/finish.cpp2
-rw-r--r--opengl/tests/gl2_basic/Android.bp20
-rw-r--r--opengl/tests/gl2_basic/Android.mk25
-rw-r--r--opengl/tests/gl2_basic/gl2_basic.cpp2
-rw-r--r--opengl/tests/gl2_copyTexImage/Android.bp20
-rw-r--r--opengl/tests/gl2_copyTexImage/Android.mk25
-rw-r--r--opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp2
-rw-r--r--opengl/tests/gl2_jni/jni/gl_code.cpp4
-rw-r--r--opengl/tests/gl2_yuvtex/Android.bp24
-rw-r--r--opengl/tests/gl2_yuvtex/Android.mk26
-rw-r--r--opengl/tests/gl_basic/Android.bp18
-rw-r--r--opengl/tests/gl_basic/Android.mk23
-rw-r--r--opengl/tests/gl_basic/gl_basic.cpp2
-rw-r--r--opengl/tests/gl_jni/jni/gl_code.cpp6
-rw-r--r--opengl/tests/gl_perf/Android.bp24
-rw-r--r--opengl/tests/gl_perf/Android.mk27
-rw-r--r--opengl/tests/gl_perf/gl2_perf.cpp2
-rw-r--r--opengl/tests/gl_perfapp/jni/gl_code.cpp4
-rw-r--r--opengl/tests/gl_yuvtex/Android.bp23
-rw-r--r--opengl/tests/gl_yuvtex/Android.mk25
-rw-r--r--opengl/tests/gl_yuvtex/gl_yuvtex.cpp4
-rw-r--r--opengl/tests/gldual/jni/gl_code.cpp4
-rw-r--r--opengl/tests/gralloc/Android.bp13
-rw-r--r--opengl/tests/gralloc/Android.mk16
-rw-r--r--opengl/tests/gralloc/gralloc.cpp2
-rw-r--r--opengl/tests/hwc/Android.bp2
-rw-r--r--opengl/tests/hwc/hwcRects.cpp4
-rw-r--r--opengl/tests/lib/include/EGLUtils.h178
-rw-r--r--opengl/tests/linetex/linetex.cpp2
-rw-r--r--opengl/tests/swapinterval/swapinterval.cpp2
-rw-r--r--opengl/tests/textures/textures.cpp2
55 files changed, 519 insertions, 372 deletions
diff --git a/opengl/Android.bp b/opengl/Android.bp
index aec5a95628..9ca8b0b0fd 100644
--- a/opengl/Android.bp
+++ b/opengl/Android.bp
@@ -52,6 +52,30 @@ ndk_headers {
license: "include/KHR/NOTICE",
}
+llndk_library {
+ name: "libEGL",
+ symbol_file: "libs/libEGL.map.txt",
+ export_include_dirs: ["include"],
+}
+
+llndk_library {
+ name: "libGLESv1_CM",
+ symbol_file: "libs/libGLESv1_CM.map.txt",
+ export_include_dirs: ["include"],
+}
+
+llndk_library {
+ name: "libGLESv2",
+ symbol_file: "libs/libGLESv2.map.txt",
+ export_include_dirs: ["include"],
+}
+
+llndk_library {
+ name: "libGLESv3",
+ symbol_file: "libs/libGLESv3.map.txt",
+ export_include_dirs: ["include"],
+}
+
cc_library_headers {
name: "gl_headers",
vendor_available: true,
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index c4073a9505..466768ae2c 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -534,11 +534,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSur
#endif
#endif /* EGL_ANDROID_presentation_time */
-#ifndef EGL_KHR_no_config_context
-#define EGL_KHR_no_config_context 1
-#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0)
-#endif /* EGL_KHR_no_config_context */
-
#ifndef EGL_ANDROID_get_frame_timestamps
#define EGL_ANDROID_get_frame_timestamps 1
#define EGL_TIMESTAMPS_ANDROID 0x3430
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp
index b4cc2113e9..802b3b46e0 100644
--- a/opengl/libs/Android.bp
+++ b/opengl/libs/Android.bp
@@ -85,7 +85,6 @@ cc_defaults {
cc_defaults {
name: "egl_libs_defaults",
defaults: ["gl_libs_defaults"],
- vendor_available: true,
cflags: [
"-DLOG_TAG=\"libEGL\"",
],
@@ -152,7 +151,6 @@ cc_test {
cc_defaults {
name: "gles_libs_defaults",
defaults: ["gl_libs_defaults"],
- vendor_available: true,
arch: {
arm: {
instruction_set: "arm",
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 32f8caa989..371239ddc0 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -327,17 +327,17 @@ static void* load_system_driver(const char* kind) {
switch (emulationStatus) {
case 0:
#if defined(__LP64__)
- result = "/system/lib64/egl/libGLES_android.so";
+ result = "/vendor/lib64/egl/libGLES_android.so";
#else
- result = "/system/lib/egl/libGLES_android.so";
+ result = "/vendor/lib/egl/libGLES_android.so";
#endif
return result;
case 1:
// Use host-side OpenGL through the "emulation" library
#if defined(__LP64__)
- result = std::string("/system/lib64/egl/lib") + kind + "_emulation.so";
+ result = std::string("/vendor/lib64/egl/lib") + kind + "_emulation.so";
#else
- result = std::string("/system/lib/egl/lib") + kind + "_emulation.so";
+ result = std::string("/vendor/lib/egl/lib") + kind + "_emulation.so";
#endif
return result;
default:
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 0214b0eb56..94dfe6a9de 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1447,7 +1447,7 @@ const char* eglQueryString(EGLDisplay dpy, EGLint name)
return setError(EGL_BAD_PARAMETER, (const char *)0);
}
-EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name)
+extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name)
{
clearError();
diff --git a/opengl/libs/libEGL.map.txt b/opengl/libs/libEGL.map.txt
index 89269a0231..fa26e33f39 100644
--- a/opengl/libs/libEGL.map.txt
+++ b/opengl/libs/libEGL.map.txt
@@ -21,6 +21,7 @@ LIBEGL {
eglDestroyStreamKHR; # introduced=23
eglDestroySurface;
eglDestroySyncKHR; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
+ eglDupNativeFenceFDANDROID; # vndk
eglGetConfigAttrib;
eglGetConfigs;
eglGetCurrentContext;
@@ -44,6 +45,7 @@ LIBEGL {
eglQueryStreamTimeKHR; # introduced=23
eglQueryStreamu64KHR; # introduced=23
eglQueryString;
+ eglQueryStringImplementationANDROID; # vndk
eglQuerySurface;
eglReleaseTexImage;
eglReleaseThread;
diff --git a/opengl/tests/Android.bp b/opengl/tests/Android.bp
index bf7aeb117f..639f351c69 100644
--- a/opengl/tests/Android.bp
+++ b/opengl/tests/Android.bp
@@ -1,4 +1,19 @@
+
subdirs = [
+ "angeles",
+ "configdump",
+ "EGLTest",
+ "fillrate",
+ "filter",
+ "finish",
+ "gl2_basic",
+ "gl2_copyTexImage",
+ "gl2_yuvtex",
+ "gl_basic",
+ "gl_perf",
+ "gl_yuvtex", // just renders magenta frame, broken?
+ "gralloc",
"hwc",
"lib",
]
+
diff --git a/opengl/tests/Android.mk b/opengl/tests/Android.mk
index 92d223cc7e..134854a8b7 100644
--- a/opengl/tests/Android.mk
+++ b/opengl/tests/Android.mk
@@ -1,19 +1,4 @@
dirs := \
- angeles \
- configdump \
- EGLTest \
- fillrate \
- filter \
- finish \
- gl2_basic \
- gl2_copyTexImage \
- gl2_yuvtex \
- gl_basic \
- gl_perf \
- gl_yuvtex \
- gralloc \
- include \
- lib \
linetex \
swapinterval \
textures \
diff --git a/opengl/tests/EGLTest/Android.bp b/opengl/tests/EGLTest/Android.bp
new file mode 100644
index 0000000000..d85af81b6b
--- /dev/null
+++ b/opengl/tests/EGLTest/Android.bp
@@ -0,0 +1,31 @@
+
+cc_test {
+
+ name: "EGL_test",
+
+ srcs: [
+ "egl_cache_test.cpp",
+ "EGL_test.cpp",
+ ],
+
+ shared_libs: [
+ "android.hardware.configstore@1.0",
+ "android.hardware.configstore-utils",
+ "libEGL",
+ "libbase",
+ "libcutils",
+ "libbinder",
+ "libgui",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ ],
+
+ include_dirs: [
+ "bionic/libc/private",
+ "frameworks/native/opengl/libs",
+ "frameworks/native/opengl/libs/EGL",
+ ],
+
+}
diff --git a/opengl/tests/EGLTest/Android.mk b/opengl/tests/EGLTest/Android.mk
deleted file mode 100644
index 5620496e17..0000000000
--- a/opengl/tests/EGLTest/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Build the unit tests.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := EGL_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- egl_cache_test.cpp \
- EGL_test.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- android.hardware.configstore@1.0 \
- android.hardware.configstore-utils \
- libEGL \
- libcutils \
- libbinder \
- libhidlbase \
- libhidltransport \
- libutils \
- libgui \
- libbase \
- liblog \
-
-LOCAL_C_INCLUDES := \
- bionic/libc/private \
- frameworks/native/opengl/libs \
- frameworks/native/opengl/libs/EGL \
-
-# gold in binutils 2.22 will warn about the usage of mktemp
-LOCAL_LDFLAGS += -Wl,--no-fatal-warnings
-
-include $(BUILD_NATIVE_TEST)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/opengl/tests/EGLTest/EGL_test.cpp b/opengl/tests/EGLTest/EGL_test.cpp
index 62e6bd3055..b67a053021 100644
--- a/opengl/tests/EGLTest/EGL_test.cpp
+++ b/opengl/tests/EGLTest/EGL_test.cpp
@@ -200,6 +200,7 @@ TEST_F(EGLTest, EGLDisplayP3) {
if (!hasWideColorDisplay) {
// skip this test if device does not have wide-color display
+ std::cerr << "[ ] Device does not support wide-color, test skipped" << std::endl;
return;
}
@@ -285,6 +286,7 @@ TEST_F(EGLTest, EGLDisplayP31010102) {
if (!hasWideColorDisplay) {
// skip this test if device does not have wide-color display
+ std::cerr << "[ ] Device does not support wide-color, test skipped" << std::endl;
return;
}
@@ -370,6 +372,7 @@ TEST_F(EGLTest, EGLConfigFP16) {
if (!hasWideColorDisplay) {
// skip this test if device does not have wide-color display
+ std::cerr << "[ ] Device does not support wide-color, test skipped" << std::endl;
return;
}
@@ -431,9 +434,10 @@ TEST_F(EGLTest, EGLConfigFP16) {
EXPECT_TRUE(eglDestroySurface(mEglDisplay, eglSurface));
}
-TEST_F(EGLTest, EGL_KHR_no_config_context) {
+TEST_F(EGLTest, EGLNoConfigContext) {
if (!hasWideColorDisplay) {
// skip this test if device does not have wide-color display
+ std::cerr << "[ ] Device does not support wide-color, test skipped" << std::endl;
return;
}
@@ -471,6 +475,7 @@ TEST_F(EGLTest, EGLConfig1010102) {
if (!hasWideColorDisplay) {
// skip this test if device does not have wide-color display
+ std::cerr << "[ ] Device does not support wide-color, test skipped" << std::endl;
return;
}
diff --git a/opengl/tests/angeles/Android.bp b/opengl/tests/angeles/Android.bp
new file mode 100644
index 0000000000..bbbc447c07
--- /dev/null
+++ b/opengl/tests/angeles/Android.bp
@@ -0,0 +1,22 @@
+// Copyright 2006 The Android Open Source Project
+
+cc_test {
+ name: "angeles",
+
+ srcs: [
+ "app-linux.cpp",
+ "demo.c",
+ ],
+
+ gtest: false,
+
+ shared_libs: [
+ "libEGL",
+ "libGLESv1_CM",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+}
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk
deleted file mode 100644
index c78224ee18..0000000000
--- a/opengl/tests/angeles/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui libgui libutils
-LOCAL_STATIC_LIBRARIES += libglTest
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-LOCAL_MODULE:= angeles
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/angeles/demo.c b/opengl/tests/angeles/demo.c
index 39d871e968..30c3202bd4 100644
--- a/opengl/tests/angeles/demo.c
+++ b/opengl/tests/angeles/demo.c
@@ -462,7 +462,7 @@ static void drawFadeQuad()
// Called from the app framework.
void appInit()
{
- int a;
+ unsigned int a;
glEnable(GL_NORMALIZE);
glEnable(GL_DEPTH_TEST);
@@ -492,7 +492,7 @@ void appInit()
// Called from the app framework.
void appDeinit()
{
- int a;
+ unsigned int a;
for (a = 0; a < SUPERSHAPE_COUNT; ++a)
freeGLObject(sSuperShapeObjects[a]);
freeGLObject(sGroundPlane);
diff --git a/opengl/tests/configdump/Android.bp b/opengl/tests/configdump/Android.bp
new file mode 100644
index 0000000000..c46477cc53
--- /dev/null
+++ b/opengl/tests/configdump/Android.bp
@@ -0,0 +1,13 @@
+cc_test {
+ name: "test-opengl-configdump",
+
+ gtest: false,
+
+ srcs: ["configdump.cpp"],
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv1_CM",
+ ],
+}
diff --git a/opengl/tests/configdump/Android.mk b/opengl/tests/configdump/Android.mk
deleted file mode 100644
index 3f7c915b41..0000000000
--- a/opengl/tests/configdump/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-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
index c423105a11..a4bb8791ea 100644
--- a/opengl/tests/configdump/configdump.cpp
+++ b/opengl/tests/configdump/configdump.cpp
@@ -78,7 +78,7 @@ int main(int /*argc*/, char** /*argv*/) {
for (EGLint i=0 ; i<n ; i++) {
printf("EGLConfig[%d]\n", i);
- for (int attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
+ for (unsigned 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);
diff --git a/opengl/tests/fillrate/Android.bp b/opengl/tests/fillrate/Android.bp
new file mode 100644
index 0000000000..543f1e3de2
--- /dev/null
+++ b/opengl/tests/fillrate/Android.bp
@@ -0,0 +1,18 @@
+cc_test {
+ name: "test-opengl-fillrate",
+
+ srcs: ["fillrate.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libutils",
+ "libEGL",
+ "libGLESv1_CM",
+ "libui",
+ "libgui",
+ ],
+
+ static_libs: ["libglTest"],
+}
diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk
deleted file mode 100644
index 21ff52a9a6..0000000000
--- a/opengl/tests/fillrate/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- fillrate.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libEGL \
- libGLESv1_CM \
- libui \
- libgui
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-fillrate
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
index 2db63d7835..a42f3f2811 100644
--- a/opengl/tests/fillrate/fillrate.cpp
+++ b/opengl/tests/fillrate/fillrate.cpp
@@ -30,7 +30,7 @@
using namespace android;
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
EGLint configAttribs[] = {
EGL_DEPTH_SIZE, 0,
@@ -153,7 +153,7 @@ int main(int argc, char** argv)
for (int c=1, j=0 ; c<32 ; c++, j++) {
nsecs_t t = times[j];
- printf("%lld\t%d\t%f\n", t, c, (double(t)/c)/1000000.0);
+ printf("%ld\t%d\t%f\n", t, c, (double(t)/c)/1000000.0);
}
diff --git a/opengl/tests/filter/Android.bp b/opengl/tests/filter/Android.bp
new file mode 100644
index 0000000000..5f925c856b
--- /dev/null
+++ b/opengl/tests/filter/Android.bp
@@ -0,0 +1,20 @@
+cc_test {
+ name: "test-opengl-filter",
+
+ srcs: ["filter.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv1_CM",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+
+ cflags: ["-DGL_GLEXT_PROTOTYPES"],
+}
diff --git a/opengl/tests/filter/Android.mk b/opengl/tests/filter/Android.mk
deleted file mode 100644
index 4cf9c962de..0000000000
--- a/opengl/tests/filter/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- filter.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-filter
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/finish/Android.bp b/opengl/tests/finish/Android.bp
new file mode 100644
index 0000000000..fb5671de4b
--- /dev/null
+++ b/opengl/tests/finish/Android.bp
@@ -0,0 +1,20 @@
+cc_test {
+ name: "test-opengl-finish",
+
+ srcs: ["finish.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libutils",
+ "libEGL",
+ "libGLESv1_CM",
+ "libui",
+ "libgui",
+ ],
+
+ static_libs: ["libglTest"],
+
+ cflags: ["-DGL_GLEXT_PROTOTYPES"],
+}
diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk
deleted file mode 100644
index 0b9b7ea255..0000000000
--- a/opengl/tests/finish/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- finish.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libEGL \
- libGLESv1_CM \
- libui \
- libgui
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-finish
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/finish/finish.cpp b/opengl/tests/finish/finish.cpp
index ea3a60f514..ab955fe162 100644
--- a/opengl/tests/finish/finish.cpp
+++ b/opengl/tests/finish/finish.cpp
@@ -31,7 +31,7 @@
using namespace android;
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
EGLint configAttribs[] = {
EGL_DEPTH_SIZE, 0,
diff --git a/opengl/tests/gl2_basic/Android.bp b/opengl/tests/gl2_basic/Android.bp
new file mode 100644
index 0000000000..74032716b6
--- /dev/null
+++ b/opengl/tests/gl2_basic/Android.bp
@@ -0,0 +1,20 @@
+cc_test {
+ name: "test-opengl-gl2_basic",
+
+ srcs: ["gl2_basic.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv2",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+
+ cflags: ["-DGL_GLEXT_PROTOTYPES"],
+}
diff --git a/opengl/tests/gl2_basic/Android.mk b/opengl/tests/gl2_basic/Android.mk
deleted file mode 100644
index 520395c041..0000000000
--- a/opengl/tests/gl2_basic/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_basic.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_basic
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp
index ee88667328..67c0969e21 100644
--- a/opengl/tests/gl2_basic/gl2_basic.cpp
+++ b/opengl/tests/gl2_basic/gl2_basic.cpp
@@ -30,7 +30,7 @@
#include <EGLUtils.h>
using namespace android;
-EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
+extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
static void printGLString(const char *name, GLenum s) {
// fprintf(stderr, "printGLString %s, %d\n", name, s);
diff --git a/opengl/tests/gl2_copyTexImage/Android.bp b/opengl/tests/gl2_copyTexImage/Android.bp
new file mode 100644
index 0000000000..51e269cf5d
--- /dev/null
+++ b/opengl/tests/gl2_copyTexImage/Android.bp
@@ -0,0 +1,20 @@
+cc_test {
+ name: "test-opengl-gl2_copyTexImage",
+
+ srcs: ["gl2_copyTexImage.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv2",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+
+ cflags: ["-DGL_GLEXT_PROTOTYPES"],
+}
diff --git a/opengl/tests/gl2_copyTexImage/Android.mk b/opengl/tests/gl2_copyTexImage/Android.mk
deleted file mode 100644
index ff43558d31..0000000000
--- a/opengl/tests/gl2_copyTexImage/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_copyTexImage.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_copyTexImage
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
index 405a3f029c..e0aafa219b 100644
--- a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
+++ b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
@@ -362,7 +362,7 @@ int printEGLConfigurations(EGLDisplay dpy) {
return true;
}
-int main(int argc, char** argv) {
+int main(int /*argc*/, char** /*argv*/) {
EGLBoolean returnValue;
EGLConfig myConfig = {0};
diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp
index c4180d4d9a..5af4f6b7cf 100644
--- a/opengl/tests/gl2_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl2_jni/jni/gl_code.cpp
@@ -153,12 +153,12 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj);
};
-JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
+JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * /*env*/, jobject /*obj*/, jint width, jint height)
{
setupGraphics(width, height);
}
-JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * /*env*/, jobject /*obj*/)
{
renderFrame();
}
diff --git a/opengl/tests/gl2_yuvtex/Android.bp b/opengl/tests/gl2_yuvtex/Android.bp
new file mode 100644
index 0000000000..613d678ef7
--- /dev/null
+++ b/opengl/tests/gl2_yuvtex/Android.bp
@@ -0,0 +1,24 @@
+cc_test {
+ name: "test-opengl-gl2_yuvtex",
+
+ srcs: ["gl2_yuvtex.cpp"],
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv2",
+ "libutils",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ gtest: false,
+
+ static_libs: ["libglTest"],
+
+ cflags: [
+ "-DGL_GLEXT_PROTOTYPES",
+ "-DEGL_EGLEXT_PROTOTYPES",
+ ],
+}
diff --git a/opengl/tests/gl2_yuvtex/Android.mk b/opengl/tests/gl2_yuvtex/Android.mk
deleted file mode 100644
index 42cf771f19..0000000000
--- a/opengl/tests/gl2_yuvtex/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_yuvtex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv2 \
- libutils \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_yuvtex
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_basic/Android.bp b/opengl/tests/gl_basic/Android.bp
new file mode 100644
index 0000000000..881d8cea4a
--- /dev/null
+++ b/opengl/tests/gl_basic/Android.bp
@@ -0,0 +1,18 @@
+cc_test {
+ name: "test-opengl-gl_basic",
+
+ srcs: ["gl_basic.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv1_CM",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+}
diff --git a/opengl/tests/gl_basic/Android.mk b/opengl/tests/gl_basic/Android.mk
deleted file mode 100644
index 7f2259e8e0..0000000000
--- a/opengl/tests/gl_basic/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl_basic.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl_basic
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp
index e50d88fab1..0b663f796f 100644
--- a/opengl/tests/gl_basic/gl_basic.cpp
+++ b/opengl/tests/gl_basic/gl_basic.cpp
@@ -189,7 +189,7 @@ int printEGLConfigurations(EGLDisplay dpy) {
return true;
}
-int main(int argc, char **argv)
+int main(int /*argc*/, char **/*argv*/)
{
int q;
int start, end;
diff --git a/opengl/tests/gl_jni/jni/gl_code.cpp b/opengl/tests/gl_jni/jni/gl_code.cpp
index 48944e0a45..3aa8adbc35 100644
--- a/opengl/tests/gl_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl_jni/jni/gl_code.cpp
@@ -140,13 +140,13 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj);
};
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * /*env*/, jobject /*obj*/, jint width, jint height)
{
init_scene(width, height);
create_texture();
}
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * /*env*/, jobject /*obj*/)
{
const GLfloat vertices[] = {
-1, -1, 0,
@@ -177,7 +177,7 @@ JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobjec
glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, quadIndices);
}
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * /*env*/, jobject /*obj*/)
{
background = 1.0f - background;
}
diff --git a/opengl/tests/gl_perf/Android.bp b/opengl/tests/gl_perf/Android.bp
new file mode 100644
index 0000000000..0ffb12158e
--- /dev/null
+++ b/opengl/tests/gl_perf/Android.bp
@@ -0,0 +1,24 @@
+cc_test {
+ name: "test-opengl-gl2_perf",
+
+ srcs: [
+ "gl2_perf.cpp",
+ "filltest.cpp",
+ ],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ "libEGL",
+ "libGLESv2",
+ "libui",
+ "libgui",
+ "libutils",
+ ],
+
+ static_libs: ["libglTest"],
+
+ cflags: ["-DGL_GLEXT_PROTOTYPES"],
+}
diff --git a/opengl/tests/gl_perf/Android.mk b/opengl/tests/gl_perf/Android.mk
deleted file mode 100644
index 9a93fab9db..0000000000
--- a/opengl/tests/gl_perf/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl2_perf.cpp \
- filltest.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- liblog \
- libEGL \
- libGLESv2 \
- libui \
- libgui \
- libutils
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl2_perf
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_perf/gl2_perf.cpp b/opengl/tests/gl_perf/gl2_perf.cpp
index 35df84fc0a..29988648e4 100644
--- a/opengl/tests/gl_perf/gl2_perf.cpp
+++ b/opengl/tests/gl_perf/gl2_perf.cpp
@@ -56,7 +56,7 @@ bool doTest(uint32_t w, uint32_t h);
static EGLDisplay dpy;
static EGLSurface surface;
-int main(int argc, char** argv) {
+int main(int /*argc*/, char** /*argv*/) {
EGLBoolean returnValue;
EGLConfig myConfig = {0};
diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp
index 946ee07c3a..0cb594a0b0 100644
--- a/opengl/tests/gl_perfapp/jni/gl_code.cpp
+++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp
@@ -61,7 +61,7 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_step(JNIEnv * env, jobject obj);
};
-JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * env, jobject obj, jint width, jint height)
+JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * /*env*/, jobject /*obj*/, jint width, jint height)
{
gWidth = width;
gHeight = height;
@@ -87,7 +87,7 @@ JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * env, jobj
}
}
-JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_step(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_step(JNIEnv * /*env*/, jobject /*obj*/)
{
if (! done) {
if (stateClock > 0 && ((stateClock & 1) == 0)) {
diff --git a/opengl/tests/gl_yuvtex/Android.bp b/opengl/tests/gl_yuvtex/Android.bp
new file mode 100644
index 0000000000..b6be327a25
--- /dev/null
+++ b/opengl/tests/gl_yuvtex/Android.bp
@@ -0,0 +1,23 @@
+cc_test {
+ name: "test-opengl-gl_yuvtex",
+
+ srcs: ["gl_yuvtex.cpp"],
+
+ shared_libs: [
+ "libcutils",
+ "libEGL",
+ "libGLESv1_CM",
+ "libutils",
+ "libui",
+ "libgui",
+ ],
+
+ gtest: false,
+
+ static_libs: ["libglTest"],
+
+ cflags: [
+ "-DGL_GLEXT_PROTOTYPES",
+ "-DEGL_EGLEXT_PROTOTYPES",
+ ],
+}
diff --git a/opengl/tests/gl_yuvtex/Android.mk b/opengl/tests/gl_yuvtex/Android.mk
deleted file mode 100644
index 7f2020ab62..0000000000
--- a/opengl/tests/gl_yuvtex/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gl_yuvtex.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libEGL \
- libGLESv1_CM \
- libutils \
- libui \
- libgui
-
-LOCAL_STATIC_LIBRARIES += libglTest
-
-LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes)
-
-LOCAL_MODULE:= test-opengl-gl_yuvtex
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
index fad26a69c7..7ef3f4e34c 100644
--- a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
+++ b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
@@ -90,7 +90,7 @@ const bool yuvTexSameUV = false;
static sp<GraphicBuffer> yuvTexBuffer;
static GLuint yuvTex;
-bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) {
+static bool setupYuvTexSurface(EGLDisplay dpy) {
int blockWidth = yuvTexWidth > 16 ? yuvTexWidth / 16 : 1;
int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
@@ -298,7 +298,7 @@ int main(int /*argc*/, char** /*argv*/) {
printGLString("Renderer", GL_RENDERER);
printGLString("Extensions", GL_EXTENSIONS);
- if(!setupYuvTexSurface(dpy, context)) {
+ if(!setupYuvTexSurface(dpy)) {
fprintf(stderr, "Could not set up texture surface.\n");
return 1;
}
diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp
index 3b114002f1..90d150ba09 100644
--- a/opengl/tests/gldual/jni/gl_code.cpp
+++ b/opengl/tests/gldual/jni/gl_code.cpp
@@ -153,12 +153,12 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj);
};
-JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * env, jobject obj, jint width, jint height)
+JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * /*env*/, jobject /*obj*/, jint width, jint height)
{
setupGraphics(width, height);
}
-JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * /*env*/, jobject /*obj*/)
{
renderFrame();
}
diff --git a/opengl/tests/gralloc/Android.bp b/opengl/tests/gralloc/Android.bp
new file mode 100644
index 0000000000..414c80457f
--- /dev/null
+++ b/opengl/tests/gralloc/Android.bp
@@ -0,0 +1,13 @@
+cc_test {
+ name: "test-opengl-gralloc",
+
+ srcs: ["gralloc.cpp"],
+
+ gtest: false,
+
+ shared_libs: [
+ "libcutils",
+ "libutils",
+ "libui",
+ ],
+}
diff --git a/opengl/tests/gralloc/Android.mk b/opengl/tests/gralloc/Android.mk
deleted file mode 100644
index d43c39a462..0000000000
--- a/opengl/tests/gralloc/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- gralloc.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui
-
-LOCAL_MODULE:= test-opengl-gralloc
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gralloc/gralloc.cpp b/opengl/tests/gralloc/gralloc.cpp
index 8987040c80..29e0882cd0 100644
--- a/opengl/tests/gralloc/gralloc.cpp
+++ b/opengl/tests/gralloc/gralloc.cpp
@@ -37,7 +37,7 @@ void* lamecpy(void* d, void const* s, size_t size) {
return d;
}
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
size_t size = 128*256*4;
void* temp = malloc(size);
diff --git a/opengl/tests/hwc/Android.bp b/opengl/tests/hwc/Android.bp
index 425f3740e4..55f058f922 100644
--- a/opengl/tests/hwc/Android.bp
+++ b/opengl/tests/hwc/Android.bp
@@ -55,6 +55,8 @@ cc_defaults {
"libnativewindow"
],
+ gtest: false,
+
static_libs: [
"libglTest",
"libhwcTest",
diff --git a/opengl/tests/hwc/hwcRects.cpp b/opengl/tests/hwc/hwcRects.cpp
index 69e56ff59b..5956366809 100644
--- a/opengl/tests/hwc/hwcRects.cpp
+++ b/opengl/tests/hwc/hwcRects.cpp
@@ -170,7 +170,7 @@ static EGLSurface surface;
static EGLint width, height;
// Function prototypes
-static Rectangle parseRect(string rectStr);
+static Rectangle parseRect(const string& rectStr);
void init(void);
void printSyntax(const char *cmd);
@@ -358,7 +358,7 @@ main(int argc, char *argv[])
// Parse string description of rectangle and add it to list of rectangles
// to be rendered.
-static Rectangle parseRect(string rectStr)
+static Rectangle parseRect(const string& rectStr)
{
int rv;
string str;
diff --git a/opengl/tests/lib/include/EGLUtils.h b/opengl/tests/lib/include/EGLUtils.h
index 014c2611ae..9dc6bcf56a 100644
--- a/opengl/tests/lib/include/EGLUtils.h
+++ b/opengl/tests/lib/include/EGLUtils.h
@@ -20,11 +20,16 @@
#include <stdint.h>
#include <stdlib.h>
+#include <vector>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
#include <system/window.h>
#include <utils/Errors.h>
-#include <EGL/egl.h>
+#include <utils/String8.h>
+extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
// ----------------------------------------------------------------------------
namespace android {
@@ -47,6 +52,17 @@ public:
EGLint const* attrs,
EGLNativeWindowType window,
EGLConfig* outConfig);
+
+ static inline String8 printGLString(const char* name, GLenum s);
+ static inline String8 printEGLString(EGLDisplay dpy, const char* name, GLenum s);
+ static inline String8 checkEglError(const char* op, EGLBoolean returnVal);
+ static inline String8 checkGlError(const char* op);
+ static inline String8 printEGLConfiguration(EGLDisplay dpy, EGLConfig config);
+ static inline bool printEGLConfigurations(EGLDisplay dpy, String8& msg);
+ static inline bool printEGLConfigurations(FILE* output, EGLDisplay dpy);
+ static inline String8 decodeColorSpace(EGLint colorSpace);
+ static inline bool hasEglExtension(EGLDisplay dpy, const char* name);
+ static inline bool hasExtension(const char* exts, const char* name);
};
// ----------------------------------------------------------------------------
@@ -91,9 +107,8 @@ status_t EGLUtils::selectConfigForPixelFormat(
if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
return BAD_VALUE;
- EGLConfig* const configs = (EGLConfig*)malloc(sizeof(EGLConfig)*numConfigs);
- if (eglChooseConfig(dpy, attrs, configs, numConfigs, &n) == EGL_FALSE) {
- free(configs);
+ std::vector<EGLConfig> configs(numConfigs);
+ if (eglChooseConfig(dpy, attrs, configs.data(), numConfigs, &n) == EGL_FALSE) {
return BAD_VALUE;
}
@@ -108,8 +123,6 @@ status_t EGLUtils::selectConfigForPixelFormat(
}
}
- free(configs);
-
if (i<n) {
*outConfig = config;
return NO_ERROR;
@@ -137,6 +150,159 @@ status_t EGLUtils::selectConfigForNativeWindow(
return selectConfigForPixelFormat(dpy, attrs, format, outConfig);
}
+String8 EGLUtils::printGLString(const char* name, GLenum s) {
+ String8 msg;
+ const char* v = reinterpret_cast<const char*>(glGetString(s));
+ msg.appendFormat("GL %s = %s\n", name, v);
+ return msg;
+}
+
+String8 EGLUtils::printEGLString(EGLDisplay dpy, const char* name, GLenum s) {
+ String8 msg;
+ const char* v = static_cast<const char*>(eglQueryString(dpy, s));
+ msg.appendFormat("GL %s = %s\n", name, v);
+ const char* va = (const char*)eglQueryStringImplementationANDROID(dpy, s);
+ msg.appendFormat("ImplementationANDROID: %s = %s\n", name, va);
+ return msg;
+}
+
+String8 EGLUtils::checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
+ String8 msg;
+ if (returnVal != EGL_TRUE) {
+ msg.appendFormat("%s() returned %d\n", op, returnVal);
+ }
+
+ for (EGLint error = eglGetError(); error != EGL_SUCCESS; error = eglGetError()) {
+ msg.appendFormat("after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error), error);
+ }
+ return msg;
+}
+
+String8 EGLUtils::checkGlError(const char* op) {
+ String8 msg;
+ for (GLint error = glGetError(); error != GL_NO_ERROR; error = glGetError()) {
+ msg.appendFormat("after %s() glError (0x%x)\n", op, error);
+ }
+ return msg;
+}
+
+String8 EGLUtils::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_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
+
+ String8 msg;
+ 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) {
+ msg.appendFormat(" %s: %d (0x%x)", names[j].name, value, value);
+ }
+ }
+ msg.append("\n");
+ return msg;
+}
+
+bool EGLUtils::printEGLConfigurations(EGLDisplay dpy, String8& msg) {
+ EGLint numConfig = 0;
+ EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
+ msg.append(checkEglError("eglGetConfigs", returnVal));
+ if (!returnVal) {
+ return false;
+ }
+
+ msg.appendFormat("Number of EGL configuration: %d\n", numConfig);
+
+ std::vector<EGLConfig> configs(numConfig);
+
+ returnVal = eglGetConfigs(dpy, configs.data(), numConfig, &numConfig);
+ msg.append(checkEglError("eglGetConfigs", returnVal));
+ if (!returnVal) {
+ return false;
+ }
+
+ for (int i = 0; i < numConfig; i++) {
+ msg.appendFormat("Configuration %d\n", i);
+ msg.append(printEGLConfiguration(dpy, configs[i]));
+ }
+
+ return true;
+}
+
+bool EGLUtils::printEGLConfigurations(FILE* output, EGLDisplay dpy) {
+ String8 msg;
+ bool status = printEGLConfigurations(dpy, msg);
+ fprintf(output, "%s", msg.c_str());
+ return status;
+}
+
+String8 EGLUtils::decodeColorSpace(EGLint colorSpace) {
+ switch (colorSpace) {
+ case EGL_GL_COLORSPACE_SRGB_KHR:
+ return String8("EGL_GL_COLORSPACE_SRGB_KHR");
+ case EGL_GL_COLORSPACE_DISPLAY_P3_EXT:
+ return String8("EGL_GL_COLORSPACE_DISPLAY_P3_EXT");
+ case EGL_GL_COLORSPACE_LINEAR_KHR:
+ return String8("EGL_GL_COLORSPACE_LINEAR_KHR");
+ default:
+ return String8::format("UNKNOWN ColorSpace %d", colorSpace);
+ }
+}
+
+bool EGLUtils::hasExtension(const char* exts, const char* name) {
+ size_t nameLen = strlen(name);
+ if (exts) {
+ for (const char* match = strstr(exts, name); match; match = strstr(match + nameLen, name)) {
+ if (match[nameLen] == '\0' || match[nameLen] == ' ') {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool EGLUtils::hasEglExtension(EGLDisplay dpy, const char* name) {
+ return hasExtension(eglQueryString(dpy, EGL_EXTENSIONS), name);
+}
+
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
diff --git a/opengl/tests/linetex/linetex.cpp b/opengl/tests/linetex/linetex.cpp
index 5ad695bc84..cdc051bc5a 100644
--- a/opengl/tests/linetex/linetex.cpp
+++ b/opengl/tests/linetex/linetex.cpp
@@ -29,7 +29,7 @@
using namespace android;
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
EGLint configAttribs[] = {
EGL_DEPTH_SIZE, 0,
diff --git a/opengl/tests/swapinterval/swapinterval.cpp b/opengl/tests/swapinterval/swapinterval.cpp
index 3a8a8a184d..c4261e68f6 100644
--- a/opengl/tests/swapinterval/swapinterval.cpp
+++ b/opengl/tests/swapinterval/swapinterval.cpp
@@ -28,7 +28,7 @@
using namespace android;
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
EGLint configAttribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
diff --git a/opengl/tests/textures/textures.cpp b/opengl/tests/textures/textures.cpp
index 1e55db0e07..7be942a764 100644
--- a/opengl/tests/textures/textures.cpp
+++ b/opengl/tests/textures/textures.cpp
@@ -27,7 +27,7 @@
using namespace android;
-int main(int argc, char** argv)
+int main(int /*argc*/, char** /*argv*/)
{
EGLint configAttribs[] = {
EGL_DEPTH_SIZE, 0,