EGL: Add wide-color tests
authorCourtney Goeltzenleuchter <courtneygo@google.com>
Mon, 19 Jun 2017 16:35:01 +0000 (10:35 -0600)
committerMika Isojärvi <misojarvi@google.com>
Tue, 18 Jul 2017 18:13:24 +0000 (11:13 -0700)
Verify necessary extensions and functionality
is present to support wide-color. Specifically, pixel formats
FP16 and 10:10:10:2 and Display-P3 color space.

Test: adb -d shell \
      am start -n com.drawelements.deqp/android.app.NativeActivity \
      -e cmdLine '"deqp --deqp-case=dEQP-EGL.functional.wide_color.* \
      --deqp-log-filename=/sdcard/dEQP-Log.qpa"'

TODO:
- Do we need test for EGL_EXT_gl_colorspace_scrgb_linear?
  That should be no-op for driver.

Change-Id: I537a04b1680e33e46215c4bb583f6987d20f0b4a

29 files changed:
Android.mk
android/cts/master/egl-master.txt
external/fetch_sources.py
framework/egl/egluCallLogWrapper.inl
framework/egl/egluCallLogWrapperApi.inl
framework/egl/egluStrUtil.inl
framework/egl/egluStrUtilPrototypes.inl
framework/egl/wrapper/eglwEnums.inl
framework/egl/wrapper/eglwEnumsC.inl
framework/egl/wrapper/eglwFuncPtrLibraryDecl.inl
framework/egl/wrapper/eglwFuncPtrLibraryImpl.inl
framework/egl/wrapper/eglwFunctionTypes.inl
framework/egl/wrapper/eglwFunctions.inl
framework/egl/wrapper/eglwImpl.inl
framework/egl/wrapper/eglwImplExt.inl
framework/egl/wrapper/eglwInitCore.inl
framework/egl/wrapper/eglwInitExtensions.inl
framework/egl/wrapper/eglwLibrary.inl
framework/egl/wrapper/eglwStaticLibrary14.inl
framework/egl/wrapper/eglwStaticLibrary15.inl
framework/qphelper/qpTestLog.h
modules/egl/CMakeLists.txt
modules/egl/teglGetProcAddressTests.inl
modules/egl/teglTestPackage.cpp
modules/egl/teglWideColorTests.cpp [new file with mode: 0644]
modules/egl/teglWideColorTests.hpp [new file with mode: 0644]
scripts/egl/common.py
scripts/egl/enums.py
scripts/khr_util/registry_cache.py

index ebb46c9..c0dd7ed 100644 (file)
@@ -542,6 +542,7 @@ LOCAL_SRC_FILES := \
        modules/egl/teglTestPackageEntry.cpp \
        modules/egl/teglThreadCleanUpTests.cpp \
        modules/egl/teglVGRenderUtil.cpp \
+       modules/egl/teglWideColorTests.cpp \
        modules/gles2/accuracy/es2aAccuracyTests.cpp \
        modules/gles2/accuracy/es2aTextureFilteringTests.cpp \
        modules/gles2/accuracy/es2aTextureMipmapTests.cpp \
index 55861eb..3d71c30 100644 (file)
@@ -2382,6 +2382,7 @@ dEQP-EGL.functional.get_proc_address.extension.egl_ext_swap_buffers_with_damage
 dEQP-EGL.functional.get_proc_address.extension.egl_hi_clientpixmap
 dEQP-EGL.functional.get_proc_address.extension.egl_khr_cl_event2
 dEQP-EGL.functional.get_proc_address.extension.egl_khr_debug
+dEQP-EGL.functional.get_proc_address.extension.egl_khr_display_reference
 dEQP-EGL.functional.get_proc_address.extension.egl_khr_fence_sync
 dEQP-EGL.functional.get_proc_address.extension.egl_khr_image
 dEQP-EGL.functional.get_proc_address.extension.egl_khr_image_base
@@ -2409,6 +2410,7 @@ dEQP-EGL.functional.get_proc_address.extension.egl_nv_stream_reset
 dEQP-EGL.functional.get_proc_address.extension.egl_nv_stream_sync
 dEQP-EGL.functional.get_proc_address.extension.egl_nv_sync
 dEQP-EGL.functional.get_proc_address.extension.egl_nv_system_time
+dEQP-EGL.functional.get_proc_address.extension.egl_ext_compositor
 dEQP-EGL.functional.get_proc_address.extension.gl_apple_copy_texture_levels
 dEQP-EGL.functional.get_proc_address.extension.gl_apple_framebuffer_multisample
 dEQP-EGL.functional.get_proc_address.extension.gl_apple_sync
@@ -3644,3 +3646,27 @@ dEQP-EGL.functional.robustness.reset_context.fixed_function_pipeline.reset_statu
 dEQP-EGL.functional.robustness.negative_context.invalid_robust_context_creation
 dEQP-EGL.functional.robustness.negative_context.invalid_robust_shared_context_creation
 dEQP-EGL.functional.robustness.negative_context.invalid_notification_strategy_enum
+dEQP-EGL.functional.wide_color.fp16
+dEQP-EGL.functional.wide_color.1010102
+dEQP-EGL.functional.wide_color.window_fp16_default_colorspace
+dEQP-EGL.functional.wide_color.window_fp16_colorspace_srgb
+dEQP-EGL.functional.wide_color.window_fp16_colorspace_p3
+dEQP-EGL.functional.wide_color.window_fp16_colorspace_scrgb
+dEQP-EGL.functional.wide_color.window_fp16_colorspace_scrgb_linear
+dEQP-EGL.functional.wide_color.pbuffer_fp16_default_colorspace
+dEQP-EGL.functional.wide_color.pbuffer_fp16_colorspace_srgb
+dEQP-EGL.functional.wide_color.pbuffer_fp16_colorspace_p3
+dEQP-EGL.functional.wide_color.pbuffer_fp16_colorspace_scrgb
+dEQP-EGL.functional.wide_color.pbuffer_fp16_colorspace_scrgb_linear
+dEQP-EGL.functional.wide_color.window_1010102_colorspace_default
+dEQP-EGL.functional.wide_color.window_1010102_colorspace_srgb
+dEQP-EGL.functional.wide_color.window_1010102_colorspace_p3
+dEQP-EGL.functional.wide_color.pbuffer_1010102_colorspace_default
+dEQP-EGL.functional.wide_color.pbuffer_1010102_colorspace_srgb
+dEQP-EGL.functional.wide_color.pbuffer_1010102_colorspace_p3
+dEQP-EGL.functional.wide_color.window_8888_colorspace_default
+dEQP-EGL.functional.wide_color.window_8888_colorspace_srgb
+dEQP-EGL.functional.wide_color.window_8888_colorspace_p3
+dEQP-EGL.functional.wide_color.pbuffer_8888_colorspace_default
+dEQP-EGL.functional.wide_color.pbuffer_8888_colorspace_srgb
+dEQP-EGL.functional.wide_color.pbuffer_8888_colorspace_p3
index 2aa2b57..6376692 100644 (file)
@@ -105,7 +105,7 @@ class SourcePackage (Source):
                dstPath         = os.path.join(EXTERNAL_DIR, self.baseDir, self.archiveDir, self.filename)
 
                if checksum != self.checksum:
-                       raise Exception("Checksum mismatch for %s, exepected %s, got %s" % (self.filename, self.checksum, checksum))
+                       raise Exception("Checksum mismatch for %s, expected %s, got %s" % (self.filename, self.checksum, checksum))
 
                if not os.path.exists(os.path.dirname(dstPath)):
                        os.mkdir(os.path.dirname(dstPath))
index f977b56..cfab0cc 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 eglw::EGLBoolean CallLogWrapper::eglBindAPI (eglw::EGLenum api)
index a61493a..1d51c25 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 eglw::EGLBoolean                                                               eglBindAPI                                                      (eglw::EGLenum api);
 eglw::EGLBoolean                                                               eglBindTexImage                                         (eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint buffer);
index b081316..02b3d1b 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 const char* getBooleanName (int value)
index 97a43a9..f7975aa 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 const char*                                                    getBooleanName                          (int value);
 const char*                                                    getBoolDontCareName                     (int value);
index 1822da9..b0e51b6 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 #define EGL_PBUFFER_BIT                                                                                0x0001
 #define EGL_PIXMAP_BIT                                                                         0x0002
 #define EGL_ALPHA_FORMAT                                                                       0x3088
 #define EGL_COLORSPACE_sRGB                                                                    0x3089
 #define EGL_GL_COLORSPACE_SRGB                                                         0x3089
+#define EGL_GL_COLORSPACE_SRGB_KHR                                                     0x3089
 #define EGL_VG_COLORSPACE_sRGB                                                         0x3089
 #define EGL_COLORSPACE_LINEAR                                                          0x308A
 #define EGL_GL_COLORSPACE_LINEAR                                                       0x308A
+#define EGL_GL_COLORSPACE_LINEAR_KHR                                           0x308A
 #define EGL_VG_COLORSPACE_LINEAR                                                       0x308A
 #define EGL_ALPHA_FORMAT_NONPRE                                                                0x308B
 #define EGL_ALPHA_FORMAT_NONPRE                                                                0x308B
 #define EGL_MULTISAMPLE_RESOLVE_BOX                                                    0x309B
 #define EGL_CL_EVENT_HANDLE                                                                    0x309C
 #define EGL_GL_COLORSPACE                                                                      0x309D
+#define EGL_GL_COLORSPACE_KHR                                                          0x309D
 #define EGL_OPENGL_ES_API                                                                      0x30A0
 #define EGL_OPENVG_API                                                                         0x30A1
 #define EGL_OPENGL_API                                                                         0x30A2
 #define EGL_COLOR_COMPONENT_TYPE_EXT                                           0x3339
 #define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT                                     0x333A
 #define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT                                     0x333B
+#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT                                    0x333F
+#define EGL_GL_COLORSPACE_BT2020_PQ_EXT                                                0x3340
+#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT                                     0x3350
+#define EGL_GL_COLORSPACE_SCRGB_EXT                                                    0x3351
+#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT                                0x3362
+#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT                                       0x3363
index c3ab2ef..5a1cf17 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 #define EGL_PBUFFER_BIT                                                                                0x0001
 #define EGL_PIXMAP_BIT                                                                         0x0002
 #define EGL_ALPHA_FORMAT                                                                       0x3088
 #define EGL_COLORSPACE_sRGB                                                                    0x3089
 #define EGL_GL_COLORSPACE_SRGB                                                         0x3089
+#define EGL_GL_COLORSPACE_SRGB_KHR                                                     0x3089
 #define EGL_VG_COLORSPACE_sRGB                                                         0x3089
 #define EGL_COLORSPACE_LINEAR                                                          0x308A
 #define EGL_GL_COLORSPACE_LINEAR                                                       0x308A
+#define EGL_GL_COLORSPACE_LINEAR_KHR                                           0x308A
 #define EGL_VG_COLORSPACE_LINEAR                                                       0x308A
 #define EGL_ALPHA_FORMAT_NONPRE                                                                0x308B
 #define EGL_ALPHA_FORMAT_NONPRE                                                                0x308B
 #define EGL_MULTISAMPLE_RESOLVE_BOX                                                    0x309B
 #define EGL_CL_EVENT_HANDLE                                                                    0x309C
 #define EGL_GL_COLORSPACE                                                                      0x309D
+#define EGL_GL_COLORSPACE_KHR                                                          0x309D
 #define EGL_OPENGL_ES_API                                                                      0x30A0
 #define EGL_OPENVG_API                                                                         0x30A1
 #define EGL_OPENGL_API                                                                         0x30A2
 #define EGL_COLOR_COMPONENT_TYPE_EXT                                           0x3339
 #define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT                                     0x333A
 #define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT                                     0x333B
+#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT                                    0x333F
+#define EGL_GL_COLORSPACE_BT2020_PQ_EXT                                                0x3340
+#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT                                     0x3350
+#define EGL_GL_COLORSPACE_SCRGB_EXT                                                    0x3351
+#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT                                0x3362
+#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT                                       0x3363
index e45b2f6..0b15ad0 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 EGLBoolean                                                                     bindAPI                                                 (EGLenum api) const;
 EGLBoolean                                                                     bindTexImage                                    (EGLDisplay dpy, EGLSurface surface, EGLint buffer) const;
index 66ea5f8..913d464 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 EGLBoolean FuncPtrLibrary::bindAPI (EGLenum api) const
index 2be3ea9..7beb1e9 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 typedef EGLW_APICALL EGLBoolean                                                                        (EGLW_APIENTRY* eglBindAPIFunc)                                                 (EGLenum api);
 typedef EGLW_APICALL EGLBoolean                                                                        (EGLW_APIENTRY* eglBindTexImageFunc)                                    (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
index d5068e9..aa8530a 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 eglBindAPIFunc                                                 bindAPI;
 eglBindTexImageFunc                                            bindTexImage;
index 9fd4f35..7f07b77 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 EGLBoolean eglwBindAPI (EGLenum api)
index 43fcad1..95015c6 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 EGLint eglwClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
index a5919ed..5e360f6 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 dst->bindAPI                                           = (eglBindAPIFunc)                                                      loader->get("eglBindAPI");
 dst->bindTexImage                                      = (eglBindTexImageFunc)                                         loader->get("eglBindTexImage");
index 28b92bd..ed56617 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 dst->clientWaitSyncKHR                         = (eglClientWaitSyncKHRFunc)                            loader->get("eglClientWaitSyncKHR");
 dst->createImageKHR                                    = (eglCreateImageKHRFunc)                                       loader->get("eglCreateImageKHR");
index bfba13e..e942a47 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 virtual EGLBoolean                                                                     bindAPI                                                 (EGLenum api) const                                                                                                                                                                                             = 0;
 virtual EGLBoolean                                                                     bindTexImage                                    (EGLDisplay dpy, EGLSurface surface, EGLint buffer) const                                                                                                               = 0;
index f9ae983..6d20919 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
        { "eglBindAPI",                                                 (deFunctionPtr)eglBindAPI },
        { "eglBindTexImage",                                    (deFunctionPtr)eglBindTexImage },
index 6a69ede..5ba62f0 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
        { "eglBindAPI",                                                 (deFunctionPtr)eglBindAPI },
        { "eglBindTexImage",                                    (deFunctionPtr)eglBindTexImage },
index 807716e..1a9385b 100644 (file)
@@ -30,7 +30,7 @@
  * Each function takes qpTestLog pointer. Operations are done on that log
  * instance.
  *
- * When function takes a 'name' parameter, that name is exepected to
+ * When function takes a 'name' parameter, that name is expected to
  * be a unique identifier within the scope of one test case. Test case
  * begins with a call to qpTestLog_startCase and ends with a call to
  * qpTestLog_endCase or qpTestLog_terminateCase. The human readable
index 6772b48..ee3eca8 100644 (file)
@@ -101,6 +101,8 @@ set(DEQP_EGL_SRCS
        teglThreadCleanUpTests.cpp
        teglRobustnessTests.hpp
        teglRobustnessTests.cpp
+       teglWideColorTests.hpp
+       teglWideColorTests.cpp
        )
 
 set(DEQP_EGL_LIBS
index b140f81..53029fa 100644 (file)
@@ -1,7 +1,7 @@
 /* WARNING: This is auto-generated file. Do not modify, since changes will
  * be lost! Modify the generating script instead.
  *
- * Generated from Khronos EGL API description (egl.xml) revision 7fdf7d3a1ad50afa03968db889b68af211da6e27.
+ * Generated from Khronos EGL API description (egl.xml) revision 13a26984991216cbf9a44fbf390f95dc05b5493a.
  */
 
 static const char* s_EGL14[] =
@@ -541,6 +541,11 @@ static const char* s_EGL_KHR_debug[] =
        "eglQueryDebugKHR",
 };
 
+static const char* s_EGL_KHR_display_reference[] =
+{
+       "eglQueryDisplayAttribKHR",
+};
+
 static const char* s_EGL_KHR_fence_sync[] =
 {
        "eglClientWaitSyncKHR",
@@ -711,6 +716,17 @@ static const char* s_EGL_NV_system_time[] =
        "eglGetSystemTimeNV",
 };
 
+static const char* s_EGL_EXT_compositor[] =
+{
+       "eglCompositorSetContextListEXT",
+       "eglCompositorSetContextAttributesEXT",
+       "eglCompositorSetWindowListEXT",
+       "eglCompositorSetWindowAttributesEXT",
+       "eglCompositorBindTexWindowEXT",
+       "eglCompositorSetSizeEXT",
+       "eglCompositorSwapPolicyEXT",
+};
+
 static const char* s_GL_APPLE_copy_texture_levels[] =
 {
        "glCopyTextureLevelsAPPLE",
@@ -1799,6 +1815,7 @@ static const struct
        { "EGL_HI_clientpixmap",                                                                DE_LENGTH_OF_ARRAY(s_EGL_HI_clientpixmap),                                                              s_EGL_HI_clientpixmap                                                           },
        { "EGL_KHR_cl_event2",                                                                  DE_LENGTH_OF_ARRAY(s_EGL_KHR_cl_event2),                                                                s_EGL_KHR_cl_event2                                                                     },
        { "EGL_KHR_debug",                                                                              DE_LENGTH_OF_ARRAY(s_EGL_KHR_debug),                                                                    s_EGL_KHR_debug                                                                         },
+       { "EGL_KHR_display_reference",                                                  DE_LENGTH_OF_ARRAY(s_EGL_KHR_display_reference),                                                s_EGL_KHR_display_reference                                                     },
        { "EGL_KHR_fence_sync",                                                                 DE_LENGTH_OF_ARRAY(s_EGL_KHR_fence_sync),                                                               s_EGL_KHR_fence_sync                                                            },
        { "EGL_KHR_image",                                                                              DE_LENGTH_OF_ARRAY(s_EGL_KHR_image),                                                                    s_EGL_KHR_image                                                                         },
        { "EGL_KHR_image_base",                                                                 DE_LENGTH_OF_ARRAY(s_EGL_KHR_image_base),                                                               s_EGL_KHR_image_base                                                            },
@@ -1826,6 +1843,7 @@ static const struct
        { "EGL_NV_stream_sync",                                                                 DE_LENGTH_OF_ARRAY(s_EGL_NV_stream_sync),                                                               s_EGL_NV_stream_sync                                                            },
        { "EGL_NV_sync",                                                                                DE_LENGTH_OF_ARRAY(s_EGL_NV_sync),                                                                              s_EGL_NV_sync                                                                           },
        { "EGL_NV_system_time",                                                                 DE_LENGTH_OF_ARRAY(s_EGL_NV_system_time),                                                               s_EGL_NV_system_time                                                            },
+       { "EGL_EXT_compositor",                                                                 DE_LENGTH_OF_ARRAY(s_EGL_EXT_compositor),                                                               s_EGL_EXT_compositor                                                            },
        { "GL_APPLE_copy_texture_levels",                                               DE_LENGTH_OF_ARRAY(s_GL_APPLE_copy_texture_levels),                                             s_GL_APPLE_copy_texture_levels                                          },
        { "GL_APPLE_framebuffer_multisample",                                   DE_LENGTH_OF_ARRAY(s_GL_APPLE_framebuffer_multisample),                                 s_GL_APPLE_framebuffer_multisample                                      },
        { "GL_APPLE_sync",                                                                              DE_LENGTH_OF_ARRAY(s_GL_APPLE_sync),                                                                    s_GL_APPLE_sync                                                                         },
index 91a374b..91e1a4c 100644 (file)
@@ -65,6 +65,7 @@
 #include "teglMutableRenderBufferTests.hpp"
 #include "teglGetFrameTimestampsTests.hpp"
 #include "teglRobustnessTests.hpp"
+#include "teglWideColorTests.hpp"
 
 namespace deqp
 {
@@ -142,6 +143,7 @@ public:
                addChild(new MutableRenderBufferTests   (m_eglTestCtx));
                addChild(createGetFrameTimestampsTests  (m_eglTestCtx));
                addChild(createRobustnessTests                  (m_eglTestCtx));
+               addChild(createWideColorTests                   (m_eglTestCtx));
        }
 };
 
diff --git a/modules/egl/teglWideColorTests.cpp b/modules/egl/teglWideColorTests.cpp
new file mode 100644 (file)
index 0000000..0bc2063
--- /dev/null
@@ -0,0 +1,1262 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2017 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.
+ *
+ *//*!
+ * \file
+ * \brief Test KHR_wide_color
+ *//*--------------------------------------------------------------------*/
+
+#include "teglWideColorTests.hpp"
+
+#include "tcuImageCompare.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuSurface.hpp"
+#include "tcuTextureUtil.hpp"
+
+#include "egluNativeWindow.hpp"
+#include "egluStrUtil.hpp"
+#include "egluUtil.hpp"
+#include "egluConfigFilter.hpp"
+
+#include "eglwLibrary.hpp"
+#include "eglwEnums.hpp"
+
+#include "gluDefs.hpp"
+#include "gluRenderContext.hpp"
+#include "gluShaderProgram.hpp"
+
+#include "glwDefs.hpp"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+
+#include "deMath.h"
+#include "deRandom.hpp"
+#include "deString.h"
+#include "deStringUtil.hpp"
+
+#include <string>
+#include <vector>
+#include <sstream>
+
+using std::string;
+using std::vector;
+using glw::GLubyte;
+using glw::GLfloat;
+using tcu::IVec2;
+
+using namespace eglw;
+
+namespace deqp
+{
+namespace egl
+{
+namespace
+{
+
+typedef tcu::Vec4 Color;
+
+class GLES2Renderer;
+
+class ReferenceRenderer;
+
+class WideColorTests : public TestCaseGroup
+{
+public:
+                                               WideColorTests          (EglTestContext& eglTestCtx);
+       void                            init                            (void);
+
+private:
+                                               WideColorTests          (const WideColorTests&);
+       WideColorTests&         operator=                       (const WideColorTests&);
+};
+
+class WideColorTest : public TestCase
+{
+public:
+       enum DrawType
+       {
+               DRAWTYPE_GLES2_CLEAR,
+               DRAWTYPE_GLES2_RENDER
+       };
+
+                                               WideColorTest           (EglTestContext& eglTestCtx, const char* name, const char* description);
+                                               ~WideColorTest          (void);
+
+       void                            init                            (void);
+       void                            deinit                          (void);
+
+protected:
+       void                            initEGLSurface          (EGLConfig config);
+       void                            initEGLContext          (EGLConfig config);
+
+       EGLDisplay                      m_eglDisplay;
+       glw::Functions          m_gl;
+};
+
+struct ColoredRect
+{
+public:
+                       ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
+       IVec2   bottomLeft;
+       IVec2   topRight;
+       Color   color;
+};
+
+ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
+       : bottomLeft    (bottomLeft_)
+       , topRight              (topRight_)
+       , color                 (color_)
+{
+}
+
+void clearColorScreen (const glw::Functions& gl, const Color& clearColor)
+{
+       gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
+       gl.clear(GL_COLOR_BUFFER_BIT);
+}
+
+float windowToDeviceCoordinates (int x, int length)
+{
+       return (2.0f * float(x) / float(length)) - 1.0f;
+}
+
+class GLES2Renderer
+{
+public:
+                                                       GLES2Renderer           (const glw::Functions& gl, int width, int height);
+                                                       ~GLES2Renderer          (void);
+       void                                    render                          (const ColoredRect& coloredRect) const;
+
+private:
+                                                       GLES2Renderer           (const GLES2Renderer&);
+       GLES2Renderer&                  operator=                       (const GLES2Renderer&);
+
+       const glw::Functions&   m_gl;
+       glu::ShaderProgram              m_glProgram;
+       glw::GLuint                             m_coordLoc;
+       glw::GLuint                             m_colorLoc;
+       glw::GLuint                             m_bufWidth;
+       glw::GLuint                             m_bufHeight;
+};
+
+// generate sources for vertex and fragment buffer
+glu::ProgramSources getSources (void)
+{
+       const char* const vertexShaderSource =
+               "attribute mediump vec2 a_pos;\n"
+               "attribute mediump vec4 a_color;\n"
+               "varying mediump vec4 v_color;\n"
+               "void main(void)\n"
+               "{\n"
+               "\tv_color = a_color;\n"
+               "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
+               "}";
+
+       const char* const fragmentShaderSource =
+               "varying mediump vec4 v_color;\n"
+               "void main(void)\n"
+               "{\n"
+               "\tgl_FragColor = v_color;\n"
+               "}";
+
+       return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
+}
+
+GLES2Renderer::GLES2Renderer (const glw::Functions& gl, int width, int height)
+       : m_gl                          (gl)
+       , m_glProgram           (gl, getSources())
+       , m_coordLoc            ((glw::GLuint)-1)
+       , m_colorLoc            ((glw::GLuint)-1)
+       , m_bufWidth            (width)
+       , m_bufHeight           (height)
+{
+       m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
+       m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
+}
+
+GLES2Renderer::~GLES2Renderer (void)
+{
+}
+
+void GLES2Renderer::render (const struct ColoredRect &coloredRect) const
+{
+       const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), m_bufWidth);
+       const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), m_bufHeight);
+       const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), m_bufWidth);
+       const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), m_bufHeight);
+
+       const glw::GLfloat coords[] =
+       {
+               x1, y1, 0.0f, 1.0f,
+               x1, y2, 0.0f, 1.0f,
+               x2, y2, 0.0f, 1.0f,
+
+               x2, y2, 0.0f, 1.0f,
+               x2, y1, 0.0f, 1.0f,
+               x1, y1, 0.0f, 1.0f
+       };
+
+       const glw::GLfloat colors[] =
+       {
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+               coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
+       };
+
+       m_gl.useProgram(m_glProgram.getProgram());
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+
+       m_gl.enableVertexAttribArray(m_coordLoc);
+       m_gl.enableVertexAttribArray(m_colorLoc);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
+
+       m_gl.vertexAttribPointer(m_coordLoc, 4, GL_FLOAT, GL_FALSE, 0, coords);
+       m_gl.vertexAttribPointer(m_colorLoc, 4, GL_FLOAT, GL_TRUE, 0, colors);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
+
+       m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/4);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
+
+       m_gl.disableVertexAttribArray(m_coordLoc);
+       m_gl.disableVertexAttribArray(m_colorLoc);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
+
+       m_gl.useProgram(0);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
+}
+
+class ReferenceRenderer
+{
+public:
+                                               ReferenceRenderer               (void);
+private:
+                                               ReferenceRenderer               (const ReferenceRenderer&);
+       ReferenceRenderer&      operator=                               (const ReferenceRenderer&);
+};
+
+ReferenceRenderer::ReferenceRenderer (void)
+{
+}
+
+WideColorTest::WideColorTest (EglTestContext& eglTestCtx, const char* name, const char* description)
+       : TestCase                               (eglTestCtx, name, description)
+       , m_eglDisplay                   (EGL_NO_DISPLAY)
+{
+}
+
+WideColorTest::~WideColorTest (void)
+{
+       deinit();
+}
+
+void WideColorTest::init (void)
+{
+       const Library&  egl     = m_eglTestCtx.getLibrary();
+
+       m_eglDisplay            = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
+
+       m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
+
+       // Wide-color support requires these extensions: EGL_EXT_pixel_format_float,
+       // EGL_EXT_gl_colorspace_display_p3, EGL_EXT_gl_colorspace_display_p3_linear
+       if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_pixel_format_float"))
+               TCU_THROW(NotSupportedError, "EGL_EXT_pixel_format_float is not supported");
+
+       if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3"))
+               TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3 is not supported");
+
+       if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3_linear"))
+               TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3_linear is not supported");
+
+}
+
+void WideColorTest::deinit (void)
+{
+       const Library&  egl     = m_eglTestCtx.getLibrary();
+
+       if (m_eglDisplay != EGL_NO_DISPLAY)
+       {
+               egl.terminate(m_eglDisplay);
+               m_eglDisplay = EGL_NO_DISPLAY;
+       }
+}
+
+class WideColorFP16Test : public WideColorTest
+{
+public:
+                                               WideColorFP16Test               (EglTestContext& eglTestCtx, const char* name, const char* description);
+
+       void                            init                                    (void);
+       void                            executeTest                             (void);
+       IterateResult           iterate                                 (void);
+};
+
+WideColorFP16Test::WideColorFP16Test (EglTestContext&  eglTestCtx,
+                                                                         const char*           name,
+                                                                         const char*           description)
+       : WideColorTest(eglTestCtx, name, description)
+{
+}
+
+void WideColorFP16Test::executeTest (void)
+{
+       const Library&  egl                     = m_eglTestCtx.getLibrary();
+       tcu::TestLog&   log                     = m_testCtx.getLog();
+       EGLint                  numConfigs      = 0;
+       EGLConfig               config;
+
+       const EGLint attribList[] =
+       {
+               EGL_SURFACE_TYPE,                         EGL_WINDOW_BIT,
+               EGL_RENDERABLE_TYPE,              EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                             16,
+               EGL_GREEN_SIZE,                           16,
+               EGL_BLUE_SIZE,                            16,
+               EGL_ALPHA_SIZE,                           16,
+               EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
+               EGL_NONE,                                         EGL_NONE
+       };
+
+       // Query from EGL implementation
+       EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
+
+       if (numConfigs <= 0)
+       {
+               log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
+               TCU_FAIL("No configs returned");
+       }
+
+       log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
+
+       EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
+       if (success != EGL_TRUE)
+       {
+               log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
+               TCU_FAIL("eglChooseConfig failed");
+       }
+       if (numConfigs > 1)
+       {
+               log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
+               TCU_FAIL("Too many configs returned");
+       }
+
+       EGLint components[4];
+
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+
+       TCU_CHECK_MSG(components[0] == 16, "Missing 16bit deep red channel");
+       TCU_CHECK_MSG(components[1] == 16, "Missing 16bit deep green channel");
+       TCU_CHECK_MSG(components[2] == 16, "Missing 16bit deep blue channel");
+       TCU_CHECK_MSG(components[3] == 16, "Missing 16bit deep alpha channel");
+}
+
+TestCase::IterateResult WideColorFP16Test::iterate (void)
+{
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       executeTest();
+       return STOP;
+}
+
+void WideColorFP16Test::init (void)
+{
+       WideColorTest::init();
+}
+
+class WideColor1010102Test : public WideColorTest
+{
+public:
+                                               WideColor1010102Test    (EglTestContext&        eglTestCtx,
+                                                                                                const char*            name,
+                                                                                                const char*            description);
+
+       void                            init                                    (void);
+       void                            executeTest                             (void);
+       IterateResult           iterate                                 (void);
+};
+
+WideColor1010102Test::WideColor1010102Test (EglTestContext& eglTestCtx, const char* name, const char* description)
+       : WideColorTest(eglTestCtx, name, description)
+{
+}
+
+void WideColor1010102Test::init (void)
+{
+       WideColorTest::init();
+}
+
+void WideColor1010102Test::executeTest (void)
+{
+       const Library&  egl     = m_eglTestCtx.getLibrary();
+       tcu::TestLog&   log     = m_testCtx.getLog();
+
+       EGLint attribList[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   10,
+               EGL_GREEN_SIZE,                                 10,
+               EGL_BLUE_SIZE,                                  10,
+               EGL_ALPHA_SIZE,                                 2,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+       EGLint numConfigs = 0;
+       EGLConfig config;
+
+       // Query from EGL implementation
+       EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
+
+       if (numConfigs <= 0)
+       {
+               log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
+               TCU_FAIL("No configs returned");
+       }
+
+       log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
+
+       EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
+       if (success != EGL_TRUE)
+       {
+               log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
+               TCU_FAIL("eglChooseConfig failed");
+       }
+       if (numConfigs > 1)
+       {
+               log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
+               TCU_FAIL("Too many configs returned");
+       }
+
+       EGLint components[4];
+
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+       success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
+       TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
+       EGLU_CHECK(egl);
+
+       TCU_CHECK_MSG(components[0] == 10, "Missing 10bit deep red channel");
+       TCU_CHECK_MSG(components[1] == 10, "Missing 10bit deep green channel");
+       TCU_CHECK_MSG(components[2] == 10, "Missing 10bit deep blue channel");
+       TCU_CHECK_MSG(components[3] == 2, "Missing 2bit deep alpha channel");
+
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+}
+
+TestCase::IterateResult WideColor1010102Test::iterate (void)
+{
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       executeTest();
+       return STOP;
+}
+
+struct Iteration
+{
+       float   start;
+       float   increment;
+       int             iterationCount;
+       Iteration(float s, float i, int c)
+               : start(s), increment(i), iterationCount(c) {}
+};
+
+class WideColorSurfaceTest : public WideColorTest
+{
+public:
+                                               WideColorSurfaceTest    (EglTestContext&                                eglTestCtx,
+                                                                                                const char*                                    name,
+                                                                                                const char*                                    description,
+                                                                                                const EGLint*                                  attribList,
+                                                                                                EGLint                                                 colorSpace,
+                                                                                                const std::vector<Iteration>&  iterations);
+
+       void                            init                                    (void);
+       void                            deinit                                  (void);
+       void                            executeTest                             (void);
+       IterateResult           iterate                                 (void);
+
+protected:
+       void                            readPixels                              (const glw::Functions& gl, float* dataPtr);
+       void                            readPixels                              (const glw::Functions& gl, deUint32* dataPtr);
+       void                            readPixels                              (const glw::Functions& gl, deUint8* dataPtr);
+       deUint32                        expectedUint10                  (float reference);
+       deUint32                        expectedUint2                   (float reference);
+       deUint8                         expectedUint8                   (float reference);
+       deUint8                         expectedAlpha8                  (float reference);
+       void                            doClearTest                             (EGLSurface surface);
+       void                            testPixels                              (float reference, float increment);
+       void                            writeEglConfig                  (EGLConfig config);
+
+private:
+       std::vector<EGLint>                                     m_attribList;
+       EGLConfig                                                       m_eglConfig;
+       EGLint                                                          m_surfaceType;
+       EGLint                                                          m_componentType;
+       EGLint                                                          m_redSize;
+       EGLint                                                          m_colorSpace;
+       const std::vector<struct Iteration> m_iterations;
+};
+
+WideColorSurfaceTest::WideColorSurfaceTest (EglTestContext& eglTestCtx, const char* name, const char* description, const EGLint* attribList, EGLint colorSpace, const std::vector<struct Iteration>& iterations)
+       : WideColorTest         (eglTestCtx, name, description)
+       , m_colorSpace          (colorSpace)
+       , m_iterations          (iterations)
+{
+       deUint32 idx = 0;
+       while (attribList[idx] != EGL_NONE)
+       {
+               if (attribList[idx] == EGL_COLOR_COMPONENT_TYPE_EXT)
+               {
+                       m_componentType = attribList[idx + 1];
+               }
+               else if (attribList[idx] == EGL_SURFACE_TYPE)
+               {
+                       m_surfaceType = attribList[idx+1];
+               }
+               else if (attribList[idx] == EGL_RED_SIZE)
+               {
+                       m_redSize = attribList[idx + 1];
+               }
+               m_attribList.push_back(attribList[idx++]);
+               m_attribList.push_back(attribList[idx++]);
+       }
+       m_attribList.push_back(EGL_NONE);
+}
+
+void WideColorSurfaceTest::init (void)
+{
+       const Library&  egl     = m_eglTestCtx.getLibrary();
+       tcu::TestLog&   log     = m_testCtx.getLog();
+
+       WideColorTest::init();
+
+       EGLint numConfigs = 0;
+
+       // Query from EGL implementation
+       EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &m_attribList[0], DE_NULL, 0, &numConfigs));
+
+       if (numConfigs <= 0)
+       {
+               log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
+               TCU_FAIL("No configs returned");
+       }
+
+       log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
+
+       EGLBoolean success = egl.chooseConfig(m_eglDisplay, &m_attribList[0], &m_eglConfig, 1, &numConfigs);
+       if (success != EGL_TRUE)
+       {
+               log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
+               TCU_FAIL("eglChooseConfig failed");
+       }
+       if (numConfigs > 1)
+       {
+               log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
+               TCU_FAIL("Too many configs returned");
+       }
+
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+
+       writeEglConfig(m_eglConfig);
+
+}
+
+void WideColorSurfaceTest::deinit (void)
+{
+       WideColorTest::deinit();
+}
+
+void WideColorSurfaceTest::readPixels (const glw::Functions& gl, float* dataPtr)
+{
+       gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, dataPtr);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with floats");
+}
+
+void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint32 *dataPtr)
+{
+       gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, dataPtr);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_1010102 (32bits)");
+}
+
+void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint8 *dataPtr)
+{
+       gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, dataPtr);
+       GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_8888 (8 bit components)");
+}
+
+void WideColorSurfaceTest::writeEglConfig (EGLConfig config)
+{
+       const Library&  egl     = m_eglTestCtx.getLibrary();
+       tcu::TestLog&   log             = m_testCtx.getLog();
+       qpEglConfigInfo info;
+       EGLint                  val             = 0;
+
+       info.bufferSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BUFFER_SIZE);
+
+       info.redSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RED_SIZE);
+
+       info.greenSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_GREEN_SIZE);
+
+       info.blueSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BLUE_SIZE);
+
+       info.luminanceSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LUMINANCE_SIZE);
+
+       info.alphaSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_SIZE);
+
+       info.alphaMaskSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_MASK_SIZE);
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGB);
+       info.bindToTextureRGB = val == EGL_TRUE ? true : false;
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGBA);
+       info.bindToTextureRGBA = val == EGL_TRUE ? true : false;
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_COLOR_BUFFER_TYPE);
+       std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
+       info.colorBufferType = colorBufferType.c_str();
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_CAVEAT);
+       std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
+       info.configCaveat = caveat.c_str();
+
+       info.configID = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_ID);
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFORMANT);
+       std::string conformant = de::toString(eglu::getAPIBitsStr(val));
+       info.conformant = conformant.c_str();
+
+       info.depthSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_DEPTH_SIZE);
+
+       info.level = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LEVEL);
+
+       info.maxPBufferWidth = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_WIDTH);
+
+       info.maxPBufferHeight = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_HEIGHT);
+
+       info.maxPBufferPixels = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_PIXELS);
+
+       info.maxSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_SWAP_INTERVAL);
+
+       info.minSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MIN_SWAP_INTERVAL);
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_NATIVE_RENDERABLE);
+       info.nativeRenderable = val == EGL_TRUE ? true : false;
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RENDERABLE_TYPE);
+       std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
+       info.renderableType = renderableTypes.c_str();
+
+       info.sampleBuffers = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLE_BUFFERS);
+
+       info.samples = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLES);
+
+       info.stencilSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_STENCIL_SIZE);
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SURFACE_TYPE);
+       std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
+       info.surfaceTypes = surfaceTypes.c_str();
+
+       val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_TYPE);
+       std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
+       info.transparentType = transparentType.c_str();
+
+       info.transparentRedValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_RED_VALUE);
+
+       info.transparentGreenValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_GREEN_VALUE);
+
+       info.transparentBlueValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_BLUE_VALUE);
+
+       log.writeEglConfig(&info);
+}
+
+deUint32 WideColorSurfaceTest::expectedUint10 (float reference)
+{
+       deUint32 expected;
+
+       if (reference < 0.0)
+       {
+               expected = 0;
+       }
+       else if (reference > 1.0)
+       {
+               expected = 1023;
+       }
+       else
+       {
+               expected = static_cast<deUint32>(deRound(reference * 1023.0));
+       }
+
+       return expected;
+}
+
+deUint32 WideColorSurfaceTest::expectedUint2 (float reference)
+{
+       deUint32 expected;
+
+       if (reference < 0.0)
+       {
+               expected = 0;
+       }
+       else if (reference > 1.0)
+       {
+               expected = 3;
+       }
+       else
+       {
+               expected = static_cast<deUint32>(deRound(reference * 3.0));
+       }
+
+       return expected;
+}
+
+deUint8 WideColorSurfaceTest::expectedUint8 (float reference)
+{
+       deUint8 expected;
+       if (reference < 0.0)
+       {
+               expected = 0;
+       }
+       else if (reference >= 1.0)
+       {
+               expected = 255;
+       }
+       else
+       {
+               // Apply sRGB transfer function when colorspace is sRGB and pixel component
+               // size is 8 bits (which is why we are here in expectedUint8).
+               if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR)
+               {
+                       float srgbReference;
+
+                       if (reference <= 0.0031308)
+                       {
+                               srgbReference = 12.92f * reference;
+                       }
+                       else
+                       {
+                               float powRef = deFloatPow(reference, (1.0f/2.4f));
+                               srgbReference = (1.055f * powRef) - 0.055f;
+                       }
+                       expected = static_cast<deUint8>(deRound(srgbReference * 255.0));
+               }
+               else
+               {
+                       expected = static_cast<deUint8>(deRound(reference * 255.0));
+               }
+       }
+       return expected;
+}
+
+deUint8 WideColorSurfaceTest::expectedAlpha8 (float reference)
+{
+       deUint8 expected;
+       if (reference < 0.0)
+       {
+               expected = 0;
+       }
+       else if (reference >= 1.0)
+       {
+               expected = 255;
+       }
+       else
+       {
+               // The sRGB transfer function is not applied to alpha
+               expected = static_cast<deUint8>(deRound(reference * 255.0));
+       }
+       return expected;
+}
+
+void WideColorSurfaceTest::testPixels (float reference, float increment)
+{
+       tcu::TestLog&   log                             = m_testCtx.getLog();
+
+       if (m_componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT)
+       {
+               float pixels[16];
+               readPixels(m_gl, pixels);
+
+               // TODO: Do we need threshold values here? Test range
+               // and increment is chosen to exactly match FP16
+               // capability.
+               if (pixels[0] != reference)
+               {
+                       log << tcu::TestLog::Message
+                               << "Image red comparison failed: "
+                               << "expected = " << reference
+                               << ", result = " << pixels[0]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[1] != (reference + increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image green comparison failed: "
+                               << "expected = " << reference + increment
+                               << ", result = " << pixels[1]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[2] != (reference - increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image blue comparison failed: "
+                               << "expected = " << reference - increment
+                               << ", result = " << pixels[2]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[3] != (reference + 2 * increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image alpha comparison failed: "
+                               << "expected = " << reference + 2 * increment
+                               << ", result = " << pixels[3]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else
+               {
+                       // Pixel matches expected value
+               }
+       }
+       else if (m_redSize > 8)
+       {
+               deUint32 buffer[16];
+               readPixels(m_gl, buffer);
+               deUint32 pixels[4];
+
+               pixels[0] = buffer[0] & 0x3ff;
+               pixels[1] = (buffer[0] >> 10) & 0x3ff;
+               pixels[2] = (buffer[0] >> 20) & 0x3ff;
+               pixels[3] = (buffer[0] >> 30) & 0x3;
+
+               if (pixels[0] != expectedUint10(reference))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image red comparison failed: "
+                               << "reference = " << reference
+                               << ", expected = " << expectedUint10(reference)
+                               << ", result = " << pixels[0]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[1] != expectedUint10(reference + increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image green comparison failed: "
+                               << "reference = " << reference + increment
+                               << ", expected = " << expectedUint10(reference + increment)
+                               << ", result = " << pixels[1]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[2] != expectedUint10(reference - increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image blue comparison failed: "
+                               << "reference = " << reference - increment
+                               << ", expected = " << expectedUint10(reference - increment)
+                               << ", result = " << pixels[2]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[3] != expectedUint2(reference + 2 * increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image alpha comparison failed: "
+                               << "reference = " << reference + 2 * increment
+                               << ", expected = " << expectedUint10(reference + 2 * increment)
+                               << ", result = " << pixels[3]
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else
+               {
+                       // Pixel matches expected value
+               }
+       }
+       else
+       {
+               deUint8 pixels[16];
+               readPixels(m_gl, pixels);
+
+               if (pixels[0] != expectedUint8(reference))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image red comparison failed: "
+                               << "reference = " << reference
+                               << ", expected = " << static_cast<deUint32>(expectedUint8(reference))
+                               << ", result = " << static_cast<deUint32>(pixels[0])
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[1] != expectedUint8(reference + increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image green comparison failed: "
+                               << "reference = " << reference + increment
+                               << ", expected = " << static_cast<deUint32>(expectedUint8(reference + increment))
+                               << ", result = " << static_cast<deUint32>(pixels[1])
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[2] != expectedUint8(reference - increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image blue comparison failed: "
+                               << "reference = " << reference - increment
+                               << ", expected = " << static_cast<deUint32>(expectedUint8(reference - increment))
+                               << ", result = " << static_cast<deUint32>(pixels[2])
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else if (pixels[3] != expectedAlpha8(reference + 2 * increment))
+               {
+                       log << tcu::TestLog::Message
+                               << "Image alpha comparison failed: "
+                               << "reference = " << reference + 2 * increment
+                               << ", expected = " << static_cast<deUint32>(expectedAlpha8(reference + 2 * increment))
+                               << ", result = " << static_cast<deUint32>(pixels[3])
+                               << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
+               }
+               else
+               {
+                       // Pixel matches expected value
+               }
+       }
+}
+
+void WideColorSurfaceTest::doClearTest (EGLSurface surface)
+{
+       tcu::TestLog&   log                             = m_testCtx.getLog();
+       const Library&  egl                             = m_eglTestCtx.getLibrary();
+       const EGLint    attribList[]    =
+       {
+               EGL_CONTEXT_CLIENT_VERSION, 2,
+               EGL_NONE
+       };
+       EGLContext              eglContext              = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attribList);
+       EGLU_CHECK_MSG(egl, "eglCreateContext");
+
+       egl.makeCurrent(m_eglDisplay, surface, surface, eglContext);
+       EGLU_CHECK_MSG(egl, "eglMakeCurrent");
+
+       {
+               // put gles2Renderer inside it's own scope so that it's cleaned
+               // up before we hit the destroyContext
+               const GLES2Renderer gles2Renderer(m_gl, 128, 128);
+
+               std::vector<Iteration>::const_iterator it;      // declare an Iterator to a vector of strings
+               log << tcu::TestLog::Message << "m_iterations.count = " << m_iterations.size() << tcu::TestLog::EndMessage;
+               for(it = m_iterations.begin() ; it < m_iterations.end(); it++)
+               {
+                       float reference = it->start;
+                       log << tcu::TestLog::Message << "start = " << it->start
+                                               << tcu::TestLog::EndMessage;
+                       log << tcu::TestLog::Message
+                                               << "increment = " << it->increment
+                                               << tcu::TestLog::EndMessage;
+                       log << tcu::TestLog::Message
+                                               << "count = " << it->iterationCount
+                                               << tcu::TestLog::EndMessage;
+                       for (int iterationCount = 0; iterationCount < it->iterationCount; iterationCount++)
+                       {
+                               const Color     clearColor(reference, reference + it->increment, reference - it->increment, reference + 2 * it->increment);
+
+                               clearColorScreen(m_gl, clearColor);
+                               GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to test value");
+
+                               testPixels(reference, it->increment);
+
+                               // reset buffer contents so that we know render below did something
+                               const Color     clearColor2(1.0f - reference, 1.0f, 1.0f, 1.0f);
+                               clearColorScreen(m_gl, clearColor2);
+                               GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to 1.0f - reference value");
+
+                               const ColoredRect       coloredRect     (IVec2(0.0f, 0.0f), IVec2(1.0f, 1.0f), clearColor);
+                               gles2Renderer.render(coloredRect);
+                               testPixels(reference, it->increment);
+
+                               reference += it->increment;
+                       }
+
+                       EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, surface));
+               }
+       }
+
+       // disconnect surface & context so they can be destroyed when
+       // this function exits.
+       EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
+
+       egl.destroyContext(m_eglDisplay, eglContext);
+}
+
+void WideColorSurfaceTest::executeTest (void)
+{
+       tcu::TestLog&                                           log                             = m_testCtx.getLog();
+       const Library&                                          egl                             = m_eglTestCtx.getLibrary();
+       const eglu::NativeDisplayFactory&       displayFactory  = m_eglTestCtx.getNativeDisplayFactory();
+       eglu::NativeDisplay&                            nativeDisplay   = m_eglTestCtx.getNativeDisplay();
+       egl.bindAPI(EGL_OPENGL_ES_API);
+
+       if (m_surfaceType & EGL_PBUFFER_BIT)
+       {
+               log << tcu::TestLog::Message << "Test Pbuffer" << tcu::TestLog::EndMessage;
+
+               std::vector<EGLint>                     attribs;
+               attribs.push_back(EGL_WIDTH);
+               attribs.push_back(128);
+               attribs.push_back(EGL_HEIGHT);
+               attribs.push_back(128);
+               if (m_colorSpace)
+               {
+                       attribs.push_back(EGL_GL_COLORSPACE_KHR);
+                       attribs.push_back(m_colorSpace);
+               }
+               attribs.push_back(EGL_NONE);
+               attribs.push_back(EGL_NONE);
+               const EGLSurface surface = egl.createPbufferSurface(m_eglDisplay, m_eglConfig, attribs.data());
+               TCU_CHECK(surface != EGL_NO_SURFACE);
+               EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()");
+
+               doClearTest(surface);
+
+               egl.destroySurface(m_eglDisplay, surface);
+               EGLU_CHECK_MSG(egl, "eglDestroySurface()");
+       }
+       else if (m_surfaceType & EGL_WINDOW_BIT)
+       {
+               log << tcu::TestLog::Message << "Test Window" << tcu::TestLog::EndMessage;
+
+               const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
+
+               de::UniquePtr<eglu::NativeWindow>       window                  (windowFactory.createWindow(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(128, 128, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+               std::vector<EGLAttrib>          attribs;
+               if (m_colorSpace)
+               {
+                       attribs.push_back(EGL_GL_COLORSPACE_KHR);
+                       attribs.push_back(m_colorSpace);
+               }
+               attribs.push_back(EGL_NONE);
+               attribs.push_back(EGL_NONE);
+
+               const EGLSurface                                        surface                 = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
+               TCU_CHECK(surface != EGL_NO_SURFACE);
+               EGLU_CHECK_MSG(egl, "eglCreateWindowSurface()");
+
+               doClearTest(surface);
+
+               egl.destroySurface(m_eglDisplay, surface);
+               EGLU_CHECK_MSG(egl, "eglDestroySurface()");
+       }
+       else if (m_surfaceType & EGL_PIXMAP_BIT)
+       {
+               log << tcu::TestLog::Message << "Test Pixmap" << tcu::TestLog::EndMessage;
+
+               const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
+
+               de::UniquePtr<eglu::NativePixmap>       pixmap                  (pixmapFactory.createPixmap(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, 128, 128));
+               const EGLSurface                                        surface                 = eglu::createPixmapSurface(nativeDisplay, *pixmap, m_eglDisplay, m_eglConfig, DE_NULL);
+               TCU_CHECK(surface != EGL_NO_SURFACE);
+               EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface()");
+
+               doClearTest(surface);
+
+               egl.destroySurface(m_eglDisplay, surface);
+               EGLU_CHECK_MSG(egl, "eglDestroySurface()");
+       }
+       else
+               TCU_FAIL("No valid surface types supported in config");
+}
+
+TestCase::IterateResult WideColorSurfaceTest::iterate (void)
+{
+       m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+       executeTest();
+       return STOP;
+}
+
+} // anonymous
+
+WideColorTests::WideColorTests (EglTestContext& eglTestCtx)
+       : TestCaseGroup(eglTestCtx, "wide_color", "Wide Color tests")
+{
+}
+
+void WideColorTests::init (void)
+{
+       addChild(new WideColorFP16Test(m_eglTestCtx, "fp16", "Verify that FP16 pixel format is present"));
+       addChild(new WideColor1010102Test(m_eglTestCtx, "1010102", "Verify that 1010102 pixel format is present"));
+
+       // This is an increment FP16 can do between -1.0 to 1.0
+       const float fp16Increment1 = deFloatPow(2.0, -11.0);
+       // This is an increment FP16 can do between 1.0 to 2.0
+       const float fp16Increment2 = deFloatPow(2.0, -10.0);
+
+       const EGLint windowAttribListFP16[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   16,
+               EGL_GREEN_SIZE,                                 16,
+               EGL_BLUE_SIZE,                                  16,
+               EGL_ALPHA_SIZE,                                 16,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+
+       std::vector<Iteration> fp16Iterations;
+       // -0.333251953125f ~ -1/3 as seen in FP16
+       fp16Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
+       // test crossing 0
+       fp16Iterations.push_back( Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
+       // test crossing 1.0
+       fp16Iterations.push_back( Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, DE_NULL, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb_linear", "FP16 window surface, explicit scRGB linear colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, fp16Iterations));
+
+       const EGLint pbufferAttribListFP16[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_PBUFFER_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   16,
+               EGL_GREEN_SIZE,                                 16,
+               EGL_BLUE_SIZE,                                  16,
+               EGL_ALPHA_SIZE,                                 16,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, DE_NULL, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb_linear", "FP16 pbuffer surface, explicit scRGB linear colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT, fp16Iterations));
+
+       const EGLint windowAttribList1010102[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   10,
+               EGL_GREEN_SIZE,                                 10,
+               EGL_BLUE_SIZE,                                  10,
+               EGL_ALPHA_SIZE,                                 2,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+
+       std::vector<Iteration> int1010102Iterations;
+       // -0.333251953125f ~ -1/3 as seen in fp16
+       // Negative values will be 0 on read with fixed point pixel formats
+       int1010102Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
+       // test crossing 0
+       int1010102Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
+       // test crossing 1.0
+       // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
+       int1010102Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, DE_NULL, int1010102Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
+
+       const EGLint pbufferAttribList1010102[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_PBUFFER_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   10,
+               EGL_GREEN_SIZE,                                 10,
+               EGL_BLUE_SIZE,                                  10,
+               EGL_ALPHA_SIZE,                                 2,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, DE_NULL, int1010102Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
+
+       const EGLint windowAttribList8888[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_WINDOW_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   8,
+               EGL_GREEN_SIZE,                                 8,
+               EGL_BLUE_SIZE,                                  8,
+               EGL_ALPHA_SIZE,                                 8,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+
+       std::vector<Iteration> int8888Iterations;
+       // -0.333251953125f ~ -1/3 as seen in fp16
+       // Negative values will be 0 on read with fixed point pixel formats
+       int8888Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
+       // test crossing 0
+       int8888Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
+       // test crossing 1.0
+       // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
+       int8888Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, DE_NULL, int8888Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
+
+       const EGLint pbufferAttribList8888[] =
+       {
+               EGL_SURFACE_TYPE,                               EGL_PBUFFER_BIT,
+               EGL_RENDERABLE_TYPE,                    EGL_OPENGL_ES2_BIT,
+               EGL_RED_SIZE,                                   8,
+               EGL_GREEN_SIZE,                                 8,
+               EGL_BLUE_SIZE,                                  8,
+               EGL_ALPHA_SIZE,                                 8,
+               EGL_COLOR_COMPONENT_TYPE_EXT,   EGL_COLOR_COMPONENT_TYPE_FIXED_EXT,
+               EGL_NONE,                                               EGL_NONE
+       };
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, DE_NULL, int8888Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
+       addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
+}
+
+TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx)
+{
+       return new WideColorTests(eglTestCtx);
+}
+
+} // egl
+} // deqp
diff --git a/modules/egl/teglWideColorTests.hpp b/modules/egl/teglWideColorTests.hpp
new file mode 100644 (file)
index 0000000..5f58f58
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _TEGLWIDECOLORTESTS_HPP
+#define _TEGLWIDECOLORTESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program EGL Module
+ * ---------------------------------------
+ *
+ * Copyright 2017 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.
+ *
+ *//*!
+ * \file
+ * \brief Test KHR_wide_color
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "teglTestCase.hpp"
+
+namespace deqp
+{
+namespace egl
+{
+
+TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx);
+
+} // egl
+} // deqp
+
+#endif // _TEGLWIDECOLORTESTS_HPP
index 552d5cb..919fece 100644 (file)
@@ -40,8 +40,8 @@ EGL_WRAPPER_DIR               = os.path.normpath(os.path.join(EGL_DIR, "wrapper"))
 EGL_SOURCE                     = khr_util.registry_cache.RegistrySource(
                                                "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry",
                                                "api/egl.xml",
-                                               "7fdf7d3a1ad50afa03968db889b68af211da6e27",
-                                               "19f3b517f0dede56a6a94b820d08149ef5e1726f58202f47d69fa27f6f483bd2")
+                                               "13a26984991216cbf9a44fbf390f95dc05b5493a",
+                                               "1c59e6b6b89d2b9047a8f5c680a6bb240b8048700ce91cefa0e870798da4f3db")
 
 VERSION                                = '1.5'
 
@@ -67,7 +67,14 @@ EXTENSIONS                   = [
        "EGL_KHR_partial_update",
        "EGL_KHR_swap_buffers_with_damage",
        "EGL_KHR_mutable_render_buffer",
-       "EGL_EXT_pixel_format_float"
+       "EGL_EXT_pixel_format_float",
+       "EGL_KHR_gl_colorspace",
+       "EGL_EXT_gl_colorspace_bt2020_linear",
+       "EGL_EXT_gl_colorspace_bt2020_pq",
+       "EGL_EXT_gl_colorspace_display_p3",
+       "EGL_EXT_gl_colorspace_display_p3_linear",
+       "EGL_EXT_gl_colorspace_scrgb",
+       "EGL_EXT_gl_colorspace_scrgb_linear"
 ]
 PROTECTS                       = [
        "KHRONOS_SUPPORT_INT64"
index 353062e..9ba4d4d 100644 (file)
@@ -41,7 +41,11 @@ TYPED_VALUES = [
 
 def enumValue (enum, typePrefix = ""):
        if enum.name in TYPED_VALUES:
-               return enum.value.replace("(EGL", "(%sEGL" % typePrefix)
+          # incoming is EGL_CAST(<type>, <value>)
+          n,v = enum.value.split(",", 1)
+          # output is ((<typePrefix>::<type>)<value>)
+          return "((%s%s)%s" % (typePrefix, n.replace("EGL_CAST(", ""), v)
+
        else:
                return normalizeConstant(enum.value)
 
index 9c553b9..e8124a4 100644 (file)
@@ -78,7 +78,7 @@ def fetchFile (dstPath, url, checksum):
        gotChecksum     = computeChecksum(data)
 
        if checksum != gotChecksum:
-               raise Exception("Checksum mismatch, exepected %s, got %s" % (checksum, gotChecksum))
+               raise Exception("Checksum mismatch, expected %s, got %s" % (checksum, gotChecksum))
 
        writeFile(dstPath, data)