1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2017 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Test KHR_wide_color
22 *//*--------------------------------------------------------------------*/
24 #include "teglWideColorTests.hpp"
26 #include "tcuImageCompare.hpp"
27 #include "tcuTestLog.hpp"
28 #include "tcuSurface.hpp"
29 #include "tcuTextureUtil.hpp"
31 #include "egluNativeWindow.hpp"
32 #include "egluStrUtil.hpp"
33 #include "egluUtil.hpp"
34 #include "egluConfigFilter.hpp"
36 #include "eglwLibrary.hpp"
37 #include "eglwEnums.hpp"
39 #include "gluDefs.hpp"
40 #include "gluRenderContext.hpp"
41 #include "gluShaderProgram.hpp"
43 #include "glwDefs.hpp"
44 #include "glwEnums.hpp"
45 #include "glwFunctions.hpp"
48 #include "deRandom.hpp"
50 #include "deStringUtil.hpp"
71 typedef tcu::Vec4 Color;
75 class ReferenceRenderer;
77 class WideColorTests : public TestCaseGroup
80 WideColorTests (EglTestContext& eglTestCtx);
84 WideColorTests (const WideColorTests&);
85 WideColorTests& operator= (const WideColorTests&);
88 class WideColorTest : public TestCase
97 WideColorTest (EglTestContext& eglTestCtx, const char* name, const char* description);
98 ~WideColorTest (void);
102 void checkPixelFloatSupport (void);
103 void checkDisplayP3Support (void);
104 void check1010102Support (void);
105 void checkFP16Support (void);
106 void checkSCRGBSupport (void);
107 void checkSCRGBLinearSupport (void);
110 void initEGLSurface (EGLConfig config);
111 void initEGLContext (EGLConfig config);
113 EGLDisplay m_eglDisplay;
120 ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
126 ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
127 : bottomLeft (bottomLeft_)
128 , topRight (topRight_)
133 void clearColorScreen (const glw::Functions& gl, const Color& clearColor)
135 gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
136 gl.clear(GL_COLOR_BUFFER_BIT);
139 float windowToDeviceCoordinates (int x, int length)
141 return (2.0f * float(x) / float(length)) - 1.0f;
147 GLES2Renderer (const glw::Functions& gl, int width, int height);
148 ~GLES2Renderer (void);
149 void render (const ColoredRect& coloredRect) const;
152 GLES2Renderer (const GLES2Renderer&);
153 GLES2Renderer& operator= (const GLES2Renderer&);
155 const glw::Functions& m_gl;
156 glu::ShaderProgram m_glProgram;
157 glw::GLuint m_coordLoc;
158 glw::GLuint m_colorLoc;
159 glw::GLuint m_bufWidth;
160 glw::GLuint m_bufHeight;
163 // generate sources for vertex and fragment buffer
164 glu::ProgramSources getSources (void)
166 const char* const vertexShaderSource =
167 "attribute mediump vec2 a_pos;\n"
168 "attribute mediump vec4 a_color;\n"
169 "varying mediump vec4 v_color;\n"
172 "\tv_color = a_color;\n"
173 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
176 const char* const fragmentShaderSource =
177 "varying mediump vec4 v_color;\n"
180 "\tgl_FragColor = v_color;\n"
183 return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
186 GLES2Renderer::GLES2Renderer (const glw::Functions& gl, int width, int height)
188 , m_glProgram (gl, getSources())
189 , m_coordLoc ((glw::GLuint)-1)
190 , m_colorLoc ((glw::GLuint)-1)
192 , m_bufHeight (height)
194 m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
195 m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
196 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
199 GLES2Renderer::~GLES2Renderer (void)
203 void GLES2Renderer::render (const struct ColoredRect &coloredRect) const
205 const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), m_bufWidth);
206 const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), m_bufHeight);
207 const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), m_bufWidth);
208 const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), m_bufHeight);
210 const glw::GLfloat coords[] =
221 const glw::GLfloat colors[] =
223 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
224 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
225 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
227 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
228 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
229 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
232 m_gl.useProgram(m_glProgram.getProgram());
233 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
235 m_gl.enableVertexAttribArray(m_coordLoc);
236 m_gl.enableVertexAttribArray(m_colorLoc);
237 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
239 m_gl.vertexAttribPointer(m_coordLoc, 4, GL_FLOAT, GL_FALSE, 0, coords);
240 m_gl.vertexAttribPointer(m_colorLoc, 4, GL_FLOAT, GL_TRUE, 0, colors);
241 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
243 m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/4);
244 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
246 m_gl.disableVertexAttribArray(m_coordLoc);
247 m_gl.disableVertexAttribArray(m_colorLoc);
248 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
251 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
254 class ReferenceRenderer
257 ReferenceRenderer (void);
259 ReferenceRenderer (const ReferenceRenderer&);
260 ReferenceRenderer& operator= (const ReferenceRenderer&);
263 WideColorTest::WideColorTest (EglTestContext& eglTestCtx, const char* name, const char* description)
264 : TestCase (eglTestCtx, name, description)
265 , m_eglDisplay (EGL_NO_DISPLAY)
269 WideColorTest::~WideColorTest (void)
274 void WideColorTest::init (void)
276 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
278 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
281 void WideColorTest::checkPixelFloatSupport (void)
283 const Library& egl = m_eglTestCtx.getLibrary();
285 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_pixel_format_float"))
286 TCU_THROW(NotSupportedError, "EGL_EXT_pixel_format_float is not supported");
289 void WideColorTest::checkDisplayP3Support (void)
291 const Library& egl = m_eglTestCtx.getLibrary();
293 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3"))
294 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3 is not supported");
297 void WideColorTest::checkSCRGBSupport (void)
299 const Library& egl = m_eglTestCtx.getLibrary();
301 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb"))
302 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb is not supported");
305 void WideColorTest::checkSCRGBLinearSupport (void)
307 const Library& egl = m_eglTestCtx.getLibrary();
309 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb_linear"))
310 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb_linear is not supported");
313 void WideColorTest::check1010102Support (void)
315 const Library& egl = m_eglTestCtx.getLibrary();
316 tcu::TestLog& log = m_testCtx.getLog();
318 const EGLint attribList[] =
320 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
321 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
328 EGLint numConfigs = 0;
331 // Query from EGL implementation
332 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
336 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
337 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
340 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
342 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs));
345 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
346 TCU_FAIL("Too many configs returned");
349 EGLint components[4];
351 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]));
352 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]));
353 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]));
354 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]));
356 TCU_CHECK_MSG(components[0] == 10, "Missing 10bit deep red channel");
357 TCU_CHECK_MSG(components[1] == 10, "Missing 10bit deep green channel");
358 TCU_CHECK_MSG(components[2] == 10, "Missing 10bit deep blue channel");
359 TCU_CHECK_MSG(components[3] == 2, "Missing 2bit deep alpha channel");
362 void WideColorTest::checkFP16Support (void)
364 const Library& egl = m_eglTestCtx.getLibrary();
365 tcu::TestLog& log = m_testCtx.getLog();
366 EGLint numConfigs = 0;
369 const EGLint attribList[] =
371 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
372 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
377 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
381 // Query from EGL implementation
382 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
386 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
387 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
390 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
392 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
393 if (success != EGL_TRUE)
395 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
396 TCU_FAIL("eglChooseConfig failed");
400 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
401 TCU_FAIL("Too many configs returned");
404 EGLint components[4];
406 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
407 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
409 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
410 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
412 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
413 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
415 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
416 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
419 TCU_CHECK_MSG(components[0] == 16, "Missing 16bit deep red channel");
420 TCU_CHECK_MSG(components[1] == 16, "Missing 16bit deep green channel");
421 TCU_CHECK_MSG(components[2] == 16, "Missing 16bit deep blue channel");
422 TCU_CHECK_MSG(components[3] == 16, "Missing 16bit deep alpha channel");
425 void WideColorTest::deinit (void)
427 const Library& egl = m_eglTestCtx.getLibrary();
429 if (m_eglDisplay != EGL_NO_DISPLAY)
431 egl.terminate(m_eglDisplay);
432 m_eglDisplay = EGL_NO_DISPLAY;
436 class WideColorFP16Test : public WideColorTest
439 WideColorFP16Test (EglTestContext& eglTestCtx, const char* name, const char* description);
442 void executeTest (void);
443 IterateResult iterate (void);
446 WideColorFP16Test::WideColorFP16Test (EglTestContext& eglTestCtx,
448 const char* description)
449 : WideColorTest(eglTestCtx, name, description)
454 void WideColorFP16Test::executeTest (void)
456 checkPixelFloatSupport();
460 TestCase::IterateResult WideColorFP16Test::iterate (void)
462 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
467 void WideColorFP16Test::init (void)
469 WideColorTest::init();
472 class WideColor1010102Test : public WideColorTest
475 WideColor1010102Test (EglTestContext& eglTestCtx,
477 const char* description);
479 void executeTest (void);
480 IterateResult iterate (void);
483 WideColor1010102Test::WideColor1010102Test (EglTestContext& eglTestCtx, const char* name, const char* description)
484 : WideColorTest(eglTestCtx, name, description)
488 void WideColor1010102Test::executeTest (void)
490 check1010102Support();
493 TestCase::IterateResult WideColor1010102Test::iterate (void)
495 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
505 Iteration(float s, float i, int c)
506 : start(s), increment(i), iterationCount(c) {}
509 class WideColorSurfaceTest : public WideColorTest
512 WideColorSurfaceTest (EglTestContext& eglTestCtx,
514 const char* description,
515 const EGLint* attribList,
517 const std::vector<Iteration>& iterations);
520 void executeTest (void);
521 IterateResult iterate (void);
524 void readPixels (const glw::Functions& gl, float* dataPtr);
525 void readPixels (const glw::Functions& gl, deUint32* dataPtr);
526 void readPixels (const glw::Functions& gl, deUint8* dataPtr);
527 deUint32 expectedUint10 (float reference);
528 deUint32 expectedUint2 (float reference);
529 deUint8 expectedUint8 (float reference);
530 deUint8 expectedAlpha8 (float reference);
531 bool checkWithThreshold8 (deUint8 value, deUint8 reference, deUint8 threshold = 1);
532 bool checkWithThreshold10 (deUint32 value, deUint32 reference, deUint32 threshold = 1);
533 bool checkWithThresholdFloat (float value, float reference, float threshold);
534 void doClearTest (EGLSurface surface);
535 void testPixels (float reference, float increment);
536 void writeEglConfig (EGLConfig config);
539 std::vector<EGLint> m_attribList;
540 EGLConfig m_eglConfig;
541 EGLint m_surfaceType;
542 EGLint m_componentType;
545 const std::vector<struct Iteration> m_iterations;
546 std::stringstream m_debugLog;
549 WideColorSurfaceTest::WideColorSurfaceTest (EglTestContext& eglTestCtx, const char* name, const char* description, const EGLint* attribList, EGLint colorSpace, const std::vector<struct Iteration>& iterations)
550 : WideColorTest (eglTestCtx, name, description)
551 , m_colorSpace (colorSpace)
552 , m_iterations (iterations)
555 while (attribList[idx] != EGL_NONE)
557 if (attribList[idx] == EGL_COLOR_COMPONENT_TYPE_EXT)
559 m_componentType = attribList[idx + 1];
561 else if (attribList[idx] == EGL_SURFACE_TYPE)
563 m_surfaceType = attribList[idx+1];
565 else if (attribList[idx] == EGL_RED_SIZE)
567 m_redSize = attribList[idx + 1];
569 m_attribList.push_back(attribList[idx++]);
570 m_attribList.push_back(attribList[idx++]);
572 m_attribList.push_back(EGL_NONE);
575 void WideColorSurfaceTest::init (void)
577 const Library& egl = m_eglTestCtx.getLibrary();
578 tcu::TestLog& log = m_testCtx.getLog();
580 WideColorTest::init();
582 // Only check for pixel format required for this specific run
583 // If not available, check will abort test with "NotSupported"
587 check1010102Support();
590 checkPixelFloatSupport();
595 if (m_colorSpace != DE_NULL && !eglu::hasExtension(egl, m_eglDisplay, "EGL_KHR_gl_colorspace"))
596 TCU_THROW(NotSupportedError, "EGL_KHR_gl_colorspace is not supported");
598 switch (m_colorSpace) {
599 case EGL_GL_COLORSPACE_DISPLAY_P3_EXT:
600 checkDisplayP3Support();
602 case EGL_GL_COLORSPACE_SCRGB_EXT:
605 case EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT:
606 checkSCRGBLinearSupport();
612 EGLint numConfigs = 0;
614 // Query from EGL implementation
615 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &m_attribList[0], DE_NULL, 0, &numConfigs));
619 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
620 TCU_FAIL("No configs returned");
623 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
625 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &m_attribList[0], &m_eglConfig, 1, &numConfigs);
626 if (success != EGL_TRUE)
628 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
629 TCU_FAIL("eglChooseConfig failed");
633 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
634 TCU_FAIL("Too many configs returned");
637 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
639 writeEglConfig(m_eglConfig);
643 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, float* dataPtr)
645 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, dataPtr);
646 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with floats");
649 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint32 *dataPtr)
651 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, dataPtr);
652 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_1010102 (32bits)");
655 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint8 *dataPtr)
657 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, dataPtr);
658 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_8888 (8 bit components)");
661 void WideColorSurfaceTest::writeEglConfig (EGLConfig config)
663 const Library& egl = m_eglTestCtx.getLibrary();
664 tcu::TestLog& log = m_testCtx.getLog();
665 qpEglConfigInfo info;
668 info.bufferSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BUFFER_SIZE);
670 info.redSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RED_SIZE);
672 info.greenSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_GREEN_SIZE);
674 info.blueSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BLUE_SIZE);
676 info.luminanceSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LUMINANCE_SIZE);
678 info.alphaSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_SIZE);
680 info.alphaMaskSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_MASK_SIZE);
682 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGB);
683 info.bindToTextureRGB = val == EGL_TRUE ? true : false;
685 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGBA);
686 info.bindToTextureRGBA = val == EGL_TRUE ? true : false;
688 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_COLOR_BUFFER_TYPE);
689 std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
690 info.colorBufferType = colorBufferType.c_str();
692 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_CAVEAT);
693 std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
694 info.configCaveat = caveat.c_str();
696 info.configID = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_ID);
698 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFORMANT);
699 std::string conformant = de::toString(eglu::getAPIBitsStr(val));
700 info.conformant = conformant.c_str();
702 info.depthSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_DEPTH_SIZE);
704 info.level = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LEVEL);
706 info.maxPBufferWidth = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_WIDTH);
708 info.maxPBufferHeight = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_HEIGHT);
710 info.maxPBufferPixels = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_PIXELS);
712 info.maxSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_SWAP_INTERVAL);
714 info.minSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MIN_SWAP_INTERVAL);
716 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_NATIVE_RENDERABLE);
717 info.nativeRenderable = val == EGL_TRUE ? true : false;
719 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RENDERABLE_TYPE);
720 std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
721 info.renderableType = renderableTypes.c_str();
723 info.sampleBuffers = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLE_BUFFERS);
725 info.samples = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLES);
727 info.stencilSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_STENCIL_SIZE);
729 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SURFACE_TYPE);
730 std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
731 info.surfaceTypes = surfaceTypes.c_str();
733 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_TYPE);
734 std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
735 info.transparentType = transparentType.c_str();
737 info.transparentRedValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_RED_VALUE);
739 info.transparentGreenValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_GREEN_VALUE);
741 info.transparentBlueValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_BLUE_VALUE);
743 log.writeEglConfig(&info);
746 deUint32 WideColorSurfaceTest::expectedUint10 (float reference)
754 else if (reference > 1.0)
760 expected = static_cast<deUint32>(deRound(reference * 1023.0));
766 deUint32 WideColorSurfaceTest::expectedUint2 (float reference)
774 else if (reference > 1.0)
780 expected = static_cast<deUint32>(deRound(reference * 3.0));
786 deUint8 WideColorSurfaceTest::expectedUint8 (float reference)
793 else if (reference >= 1.0)
799 // Apply sRGB transfer function when colorspace is sRGB and pixel component
800 // size is 8 bits (which is why we are here in expectedUint8).
801 if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR)
805 if (reference <= 0.0031308)
807 srgbReference = 12.92f * reference;
811 float powRef = deFloatPow(reference, (1.0f/2.4f));
812 srgbReference = (1.055f * powRef) - 0.055f;
814 expected = static_cast<deUint8>(deRound(srgbReference * 255.0));
818 expected = static_cast<deUint8>(deRound(reference * 255.0));
824 deUint8 WideColorSurfaceTest::expectedAlpha8 (float reference)
831 else if (reference >= 1.0)
837 // The sRGB transfer function is not applied to alpha
838 expected = static_cast<deUint8>(deRound(reference * 255.0));
843 // Return true for value out of range (fail)
844 bool WideColorSurfaceTest::checkWithThreshold8(deUint8 value, deUint8 reference, deUint8 threshold)
846 const deUint8 low = reference >= threshold ? static_cast<deUint8>(reference - threshold) : 0;
847 const deUint8 high = reference <= (255 - threshold) ? static_cast<deUint8>(reference + threshold) : 255;
848 return !((value >= low) && (value <= high));
851 bool WideColorSurfaceTest::checkWithThreshold10(deUint32 value, deUint32 reference, deUint32 threshold)
853 const deUint32 low = reference >= threshold ? reference - threshold : 0;
854 const deUint32 high = reference <= (1023 - threshold) ? reference + threshold : 1023;
855 return !((value >= low) && (value <= high));
858 bool WideColorSurfaceTest::checkWithThresholdFloat(float value, float reference, float threshold)
860 const float low = reference - threshold;
861 const float high = reference + threshold;
862 return !((value >= low) && (value <= high));
865 void WideColorSurfaceTest::testPixels (float reference, float increment)
867 tcu::TestLog& log = m_testCtx.getLog();
869 if (m_componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT)
872 const float expected[4] =
875 reference + increment,
876 reference - increment,
877 reference + 2 * increment
879 readPixels(m_gl, pixels);
881 if (checkWithThresholdFloat(pixels[0], expected[0], increment) ||
882 checkWithThresholdFloat(pixels[1], expected[1], increment) ||
883 checkWithThresholdFloat(pixels[2], expected[2], increment) ||
884 checkWithThresholdFloat(pixels[3], expected[3], increment))
886 if (m_debugLog.str().size() > 0)
888 log << tcu::TestLog::Message
889 << "Prior passing tests\n"
891 << tcu::TestLog::EndMessage;
894 log << tcu::TestLog::Message
895 << "Image comparison failed: "
896 << "reference = " << reference
897 << ", expected = " << expected[0]
898 << ":" << expected[1]
899 << ":" << expected[2]
900 << ":" << expected[3]
901 << ", result = " << pixels[0]
905 << tcu::TestLog::EndMessage;
906 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
910 // Pixel matches expected value
911 m_debugLog << "Image comparison passed: "
912 << "reference = " << reference
913 << ", result = " << pixels[0]
920 else if (m_redSize > 8)
923 readPixels(m_gl, buffer);
925 deUint32 expected[4];
927 pixels[0] = buffer[0] & 0x3ff;
928 pixels[1] = (buffer[0] >> 10) & 0x3ff;
929 pixels[2] = (buffer[0] >> 20) & 0x3ff;
930 pixels[3] = (buffer[0] >> 30) & 0x3;
932 expected[0] = expectedUint10(reference);
933 expected[1] = expectedUint10(reference + increment);
934 expected[2] = expectedUint10(reference - increment);
935 expected[3] = expectedUint2(reference + 2 * increment);
936 if (checkWithThreshold10(pixels[0], expected[0]) || checkWithThreshold10(pixels[1], expected[1])
937 || checkWithThreshold10(pixels[2], expected[2]) || checkWithThreshold10(pixels[3], expected[3]))
939 if (m_debugLog.str().size() > 0) {
940 log << tcu::TestLog::Message
941 << "Prior passing tests\n"
943 << tcu::TestLog::EndMessage;
946 log << tcu::TestLog::Message
947 << "Image comparison failed: "
948 << "reference = " << reference
949 << ", expected = " << static_cast<deUint32>(expected[0])
950 << ":" << static_cast<deUint32>(expected[1])
951 << ":" << static_cast<deUint32>(expected[2])
952 << ":" << static_cast<deUint32>(expected[3])
953 << ", result = " << static_cast<deUint32>(pixels[0])
954 << ":" << static_cast<deUint32>(pixels[1])
955 << ":" << static_cast<deUint32>(pixels[2])
956 << ":" << static_cast<deUint32>(pixels[3])
957 << tcu::TestLog::EndMessage;
958 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
962 // Pixel matches expected value
963 m_debugLog << "Image comparison passed: "
964 << "reference = " << reference
965 << ", result = " << static_cast<deUint32>(pixels[0])
966 << ":" << static_cast<deUint32>(pixels[1])
967 << ":" << static_cast<deUint32>(pixels[2])
968 << ":" << static_cast<deUint32>(pixels[3])
976 readPixels(m_gl, pixels);
978 expected[0] = expectedUint8(reference);
979 expected[1] = expectedUint8(reference + increment);
980 expected[2] = expectedUint8(reference - increment);
981 expected[3] = expectedAlpha8(reference + 2 * increment);
982 if (checkWithThreshold8(pixels[0], expected[0]) || checkWithThreshold8(pixels[1], expected[1])
983 || checkWithThreshold8(pixels[2], expected[2]) || checkWithThreshold8(pixels[3], expected[3]))
985 if (m_debugLog.str().size() > 0) {
986 log << tcu::TestLog::Message
987 << "(C)Prior passing tests\n"
989 << tcu::TestLog::EndMessage;
992 log << tcu::TestLog::Message
993 << "Image comparison failed: "
994 << "reference = " << reference
995 << ", expected = " << static_cast<deUint32>(expected[0])
996 << ":" << static_cast<deUint32>(expected[1])
997 << ":" << static_cast<deUint32>(expected[2])
998 << ":" << static_cast<deUint32>(expected[3])
999 << ", result = " << static_cast<deUint32>(pixels[0])
1000 << ":" << static_cast<deUint32>(pixels[1])
1001 << ":" << static_cast<deUint32>(pixels[2])
1002 << ":" << static_cast<deUint32>(pixels[3])
1003 << tcu::TestLog::EndMessage;
1004 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
1008 // Pixel matches expected value
1009 m_debugLog << "Image comparison passed: "
1010 << "reference = " << reference
1011 << ", result = " << static_cast<deUint32>(pixels[0])
1012 << ":" << static_cast<deUint32>(pixels[1])
1013 << ":" << static_cast<deUint32>(pixels[2])
1014 << ":" << static_cast<deUint32>(pixels[3])
1020 void WideColorSurfaceTest::doClearTest (EGLSurface surface)
1022 tcu::TestLog& log = m_testCtx.getLog();
1023 const Library& egl = m_eglTestCtx.getLibrary();
1024 const EGLint attribList[] =
1026 EGL_CONTEXT_CLIENT_VERSION, 2,
1029 EGLContext eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attribList);
1030 EGLU_CHECK_MSG(egl, "eglCreateContext");
1032 egl.makeCurrent(m_eglDisplay, surface, surface, eglContext);
1033 EGLU_CHECK_MSG(egl, "eglMakeCurrent");
1036 // put gles2Renderer inside it's own scope so that it's cleaned
1037 // up before we hit the destroyContext
1038 const GLES2Renderer gles2Renderer(m_gl, 128, 128);
1040 std::vector<Iteration>::const_iterator it; // declare an Iterator to a vector of strings
1041 log << tcu::TestLog::Message << "m_iterations.count = " << m_iterations.size() << tcu::TestLog::EndMessage;
1042 for(it = m_iterations.begin() ; it < m_iterations.end(); it++)
1044 float reference = it->start;
1045 log << tcu::TestLog::Message << "start = " << it->start
1046 << tcu::TestLog::EndMessage;
1047 log << tcu::TestLog::Message
1048 << "increment = " << it->increment
1049 << tcu::TestLog::EndMessage;
1050 log << tcu::TestLog::Message
1051 << "count = " << it->iterationCount
1052 << tcu::TestLog::EndMessage;
1054 for (int iterationCount = 0; iterationCount < it->iterationCount; iterationCount++)
1056 const Color clearColor(reference, reference + it->increment, reference - it->increment, reference + 2 * it->increment);
1058 clearColorScreen(m_gl, clearColor);
1059 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to test value");
1061 testPixels(reference, it->increment);
1063 // reset buffer contents so that we know render below did something
1064 const Color clearColor2(1.0f - reference, 1.0f, 1.0f, 1.0f);
1065 clearColorScreen(m_gl, clearColor2);
1066 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to 1.0f - reference value");
1068 const ColoredRect coloredRect (IVec2(0.0f, 0.0f), IVec2(1.0f, 1.0f), clearColor);
1069 gles2Renderer.render(coloredRect);
1070 testPixels(reference, it->increment);
1072 reference += it->increment;
1075 EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, surface));
1079 // disconnect surface & context so they can be destroyed when
1080 // this function exits.
1081 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
1083 egl.destroyContext(m_eglDisplay, eglContext);
1086 void WideColorSurfaceTest::executeTest (void)
1088 tcu::TestLog& log = m_testCtx.getLog();
1089 const Library& egl = m_eglTestCtx.getLibrary();
1090 const eglu::NativeDisplayFactory& displayFactory = m_eglTestCtx.getNativeDisplayFactory();
1091 eglu::NativeDisplay& nativeDisplay = m_eglTestCtx.getNativeDisplay();
1092 egl.bindAPI(EGL_OPENGL_ES_API);
1094 if (m_surfaceType & EGL_PBUFFER_BIT)
1096 log << tcu::TestLog::Message << "Test Pbuffer" << tcu::TestLog::EndMessage;
1098 std::vector<EGLint> attribs;
1099 attribs.push_back(EGL_WIDTH);
1100 attribs.push_back(128);
1101 attribs.push_back(EGL_HEIGHT);
1102 attribs.push_back(128);
1105 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1106 attribs.push_back(m_colorSpace);
1108 attribs.push_back(EGL_NONE);
1109 attribs.push_back(EGL_NONE);
1110 const EGLSurface surface = egl.createPbufferSurface(m_eglDisplay, m_eglConfig, attribs.data());
1111 if ((surface == EGL_NO_SURFACE) && (egl.getError() == EGL_BAD_MATCH))
1113 TCU_THROW(NotSupportedError, "Colorspace is not supported with this format");
1115 TCU_CHECK(surface != EGL_NO_SURFACE);
1116 EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()");
1118 doClearTest(surface);
1120 egl.destroySurface(m_eglDisplay, surface);
1121 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1123 else if (m_surfaceType & EGL_WINDOW_BIT)
1125 log << tcu::TestLog::Message << "Test Window" << tcu::TestLog::EndMessage;
1127 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
1129 de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(128, 128, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
1130 std::vector<EGLAttrib> attribs;
1133 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1134 attribs.push_back(m_colorSpace);
1136 attribs.push_back(EGL_NONE);
1137 attribs.push_back(EGL_NONE);
1142 surface = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
1144 catch (const eglu::Error& error)
1146 if (error.getError() == EGL_BAD_MATCH)
1147 TCU_THROW(NotSupportedError, "createWindowSurface is not supported for this config");
1151 TCU_CHECK(surface != EGL_NO_SURFACE);
1152 EGLU_CHECK_MSG(egl, "eglCreateWindowSurface()");
1154 doClearTest(surface);
1156 egl.destroySurface(m_eglDisplay, surface);
1157 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1159 else if (m_surfaceType & EGL_PIXMAP_BIT)
1161 log << tcu::TestLog::Message << "Test Pixmap" << tcu::TestLog::EndMessage;
1163 const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
1165 de::UniquePtr<eglu::NativePixmap> pixmap (pixmapFactory.createPixmap(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, 128, 128));
1166 const EGLSurface surface = eglu::createPixmapSurface(nativeDisplay, *pixmap, m_eglDisplay, m_eglConfig, DE_NULL);
1167 TCU_CHECK(surface != EGL_NO_SURFACE);
1168 EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface()");
1170 doClearTest(surface);
1172 egl.destroySurface(m_eglDisplay, surface);
1173 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1176 TCU_FAIL("No valid surface types supported in config");
1179 TestCase::IterateResult WideColorSurfaceTest::iterate (void)
1181 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1188 WideColorTests::WideColorTests (EglTestContext& eglTestCtx)
1189 : TestCaseGroup(eglTestCtx, "wide_color", "Wide Color tests")
1193 void WideColorTests::init (void)
1195 addChild(new WideColorFP16Test(m_eglTestCtx, "fp16", "Verify that FP16 pixel format is present"));
1196 addChild(new WideColor1010102Test(m_eglTestCtx, "1010102", "Check if 1010102 pixel format is present"));
1198 // This is an increment FP16 can do between -1.0 to 1.0
1199 const float fp16Increment1 = deFloatPow(2.0, -11.0);
1200 // This is an increment FP16 can do between 1.0 to 2.0
1201 const float fp16Increment2 = deFloatPow(2.0, -10.0);
1203 const EGLint windowAttribListFP16[] =
1205 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1206 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1211 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1215 std::vector<Iteration> fp16Iterations;
1216 // -0.333251953125f ~ -1/3 as seen in FP16
1217 fp16Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1219 fp16Iterations.push_back( Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1220 // test crossing 1.0
1221 fp16Iterations.push_back( Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1222 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, DE_NULL, fp16Iterations));
1223 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1224 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1225 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1226 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));
1228 const EGLint pbufferAttribListFP16[] =
1230 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1231 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1236 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1239 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, DE_NULL, fp16Iterations));
1240 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1241 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1242 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1243 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));
1245 const EGLint windowAttribList1010102[] =
1247 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1248 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1256 std::vector<Iteration> int1010102Iterations;
1257 // -0.333251953125f ~ -1/3 as seen in fp16
1258 // Negative values will be 0 on read with fixed point pixel formats
1259 int1010102Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1261 int1010102Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1262 // test crossing 1.0
1263 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1264 int1010102Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1265 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, DE_NULL, int1010102Iterations));
1266 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1267 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1269 const EGLint pbufferAttribList1010102[] =
1271 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1272 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1279 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, DE_NULL, int1010102Iterations));
1280 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1281 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1283 const EGLint windowAttribList8888[] =
1285 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1286 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1294 std::vector<Iteration> int8888Iterations;
1295 // -0.333251953125f ~ -1/3 as seen in fp16
1296 // Negative values will be 0 on read with fixed point pixel formats
1297 int8888Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1299 int8888Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1300 // test crossing 1.0
1301 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1302 int8888Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1303 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, DE_NULL, int8888Iterations));
1304 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1305 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1307 const EGLint pbufferAttribList8888[] =
1309 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1310 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1317 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, DE_NULL, int8888Iterations));
1318 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1319 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1322 TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx)
1324 return new WideColorTests(eglTestCtx);