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 checkDisplayP3LinearSupport (void);
105 void check1010102Support (void);
106 void checkFP16Support (void);
107 void checkSCRGBSupport (void);
108 void checkSCRGBLinearSupport (void);
111 void initEGLSurface (EGLConfig config);
112 void initEGLContext (EGLConfig config);
114 EGLDisplay m_eglDisplay;
121 ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
127 ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
128 : bottomLeft (bottomLeft_)
129 , topRight (topRight_)
134 void clearColorScreen (const glw::Functions& gl, const Color& clearColor)
136 gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
137 gl.clear(GL_COLOR_BUFFER_BIT);
140 float windowToDeviceCoordinates (int x, int length)
142 return (2.0f * float(x) / float(length)) - 1.0f;
148 GLES2Renderer (const glw::Functions& gl, int width, int height);
149 ~GLES2Renderer (void);
150 void render (const ColoredRect& coloredRect) const;
153 GLES2Renderer (const GLES2Renderer&);
154 GLES2Renderer& operator= (const GLES2Renderer&);
156 const glw::Functions& m_gl;
157 glu::ShaderProgram m_glProgram;
158 glw::GLuint m_coordLoc;
159 glw::GLuint m_colorLoc;
160 glw::GLuint m_bufWidth;
161 glw::GLuint m_bufHeight;
164 // generate sources for vertex and fragment buffer
165 glu::ProgramSources getSources (void)
167 const char* const vertexShaderSource =
168 "attribute mediump vec2 a_pos;\n"
169 "attribute mediump vec4 a_color;\n"
170 "varying mediump vec4 v_color;\n"
173 "\tv_color = a_color;\n"
174 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
177 const char* const fragmentShaderSource =
178 "varying mediump vec4 v_color;\n"
181 "\tgl_FragColor = v_color;\n"
184 return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
187 GLES2Renderer::GLES2Renderer (const glw::Functions& gl, int width, int height)
189 , m_glProgram (gl, getSources())
190 , m_coordLoc ((glw::GLuint)-1)
191 , m_colorLoc ((glw::GLuint)-1)
193 , m_bufHeight (height)
195 m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
196 m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
197 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
200 GLES2Renderer::~GLES2Renderer (void)
204 void GLES2Renderer::render (const struct ColoredRect &coloredRect) const
206 const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), m_bufWidth);
207 const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), m_bufHeight);
208 const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), m_bufWidth);
209 const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), m_bufHeight);
211 const glw::GLfloat coords[] =
222 const glw::GLfloat colors[] =
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(),
226 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(),
230 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
233 m_gl.useProgram(m_glProgram.getProgram());
234 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
236 m_gl.enableVertexAttribArray(m_coordLoc);
237 m_gl.enableVertexAttribArray(m_colorLoc);
238 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
240 m_gl.vertexAttribPointer(m_coordLoc, 4, GL_FLOAT, GL_FALSE, 0, coords);
241 m_gl.vertexAttribPointer(m_colorLoc, 4, GL_FLOAT, GL_TRUE, 0, colors);
242 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
244 m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/4);
245 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
247 m_gl.disableVertexAttribArray(m_coordLoc);
248 m_gl.disableVertexAttribArray(m_colorLoc);
249 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
252 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
255 class ReferenceRenderer
258 ReferenceRenderer (void);
260 ReferenceRenderer (const ReferenceRenderer&);
261 ReferenceRenderer& operator= (const ReferenceRenderer&);
264 ReferenceRenderer::ReferenceRenderer (void)
268 WideColorTest::WideColorTest (EglTestContext& eglTestCtx, const char* name, const char* description)
269 : TestCase (eglTestCtx, name, description)
270 , m_eglDisplay (EGL_NO_DISPLAY)
274 WideColorTest::~WideColorTest (void)
279 void WideColorTest::init (void)
281 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
283 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
286 void WideColorTest::checkPixelFloatSupport (void)
288 const Library& egl = m_eglTestCtx.getLibrary();
290 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_pixel_format_float"))
291 TCU_THROW(NotSupportedError, "EGL_EXT_pixel_format_float is not supported");
294 void WideColorTest::checkDisplayP3Support (void)
296 const Library& egl = m_eglTestCtx.getLibrary();
298 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3"))
299 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3 is not supported");
302 void WideColorTest::checkDisplayP3LinearSupport (void)
304 const Library& egl = m_eglTestCtx.getLibrary();
306 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3_linear"))
307 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3_linear is not supported");
310 void WideColorTest::checkSCRGBSupport (void)
312 const Library& egl = m_eglTestCtx.getLibrary();
314 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb"))
315 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb is not supported");
318 void WideColorTest::checkSCRGBLinearSupport (void)
320 const Library& egl = m_eglTestCtx.getLibrary();
322 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb_linear"))
323 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb_linear is not supported");
326 void WideColorTest::check1010102Support (void)
328 const Library& egl = m_eglTestCtx.getLibrary();
329 tcu::TestLog& log = m_testCtx.getLog();
331 const EGLint attribList[] =
333 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
334 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
341 EGLint numConfigs = 0;
344 // Query from EGL implementation
345 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
349 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
350 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
353 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
355 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs));
358 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
359 TCU_FAIL("Too many configs returned");
362 EGLint components[4];
364 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]));
365 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]));
366 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]));
367 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]));
369 TCU_CHECK_MSG(components[0] == 10, "Missing 10bit deep red channel");
370 TCU_CHECK_MSG(components[1] == 10, "Missing 10bit deep green channel");
371 TCU_CHECK_MSG(components[2] == 10, "Missing 10bit deep blue channel");
372 TCU_CHECK_MSG(components[3] == 2, "Missing 2bit deep alpha channel");
375 void WideColorTest::checkFP16Support (void)
377 const Library& egl = m_eglTestCtx.getLibrary();
378 tcu::TestLog& log = m_testCtx.getLog();
379 EGLint numConfigs = 0;
382 const EGLint attribList[] =
384 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
385 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
390 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
394 // Query from EGL implementation
395 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
399 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
400 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
403 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
405 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
406 if (success != EGL_TRUE)
408 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
409 TCU_FAIL("eglChooseConfig failed");
413 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
414 TCU_FAIL("Too many configs returned");
417 EGLint components[4];
419 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
420 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
422 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
423 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
425 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
426 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
428 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
429 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
432 TCU_CHECK_MSG(components[0] == 16, "Missing 16bit deep red channel");
433 TCU_CHECK_MSG(components[1] == 16, "Missing 16bit deep green channel");
434 TCU_CHECK_MSG(components[2] == 16, "Missing 16bit deep blue channel");
435 TCU_CHECK_MSG(components[3] == 16, "Missing 16bit deep alpha channel");
438 void WideColorTest::deinit (void)
440 const Library& egl = m_eglTestCtx.getLibrary();
442 if (m_eglDisplay != EGL_NO_DISPLAY)
444 egl.terminate(m_eglDisplay);
445 m_eglDisplay = EGL_NO_DISPLAY;
449 class WideColorFP16Test : public WideColorTest
452 WideColorFP16Test (EglTestContext& eglTestCtx, const char* name, const char* description);
455 void executeTest (void);
456 IterateResult iterate (void);
459 WideColorFP16Test::WideColorFP16Test (EglTestContext& eglTestCtx,
461 const char* description)
462 : WideColorTest(eglTestCtx, name, description)
467 void WideColorFP16Test::executeTest (void)
469 checkPixelFloatSupport();
473 TestCase::IterateResult WideColorFP16Test::iterate (void)
475 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
480 void WideColorFP16Test::init (void)
482 WideColorTest::init();
485 class WideColor1010102Test : public WideColorTest
488 WideColor1010102Test (EglTestContext& eglTestCtx,
490 const char* description);
492 void executeTest (void);
493 IterateResult iterate (void);
496 WideColor1010102Test::WideColor1010102Test (EglTestContext& eglTestCtx, const char* name, const char* description)
497 : WideColorTest(eglTestCtx, name, description)
501 void WideColor1010102Test::executeTest (void)
503 check1010102Support();
506 TestCase::IterateResult WideColor1010102Test::iterate (void)
508 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
518 Iteration(float s, float i, int c)
519 : start(s), increment(i), iterationCount(c) {}
522 class WideColorSurfaceTest : public WideColorTest
525 WideColorSurfaceTest (EglTestContext& eglTestCtx,
527 const char* description,
528 const EGLint* attribList,
530 const std::vector<Iteration>& iterations);
533 void executeTest (void);
534 IterateResult iterate (void);
537 void readPixels (const glw::Functions& gl, float* dataPtr);
538 void readPixels (const glw::Functions& gl, deUint32* dataPtr);
539 void readPixels (const glw::Functions& gl, deUint8* dataPtr);
540 deUint32 expectedUint10 (float reference);
541 deUint32 expectedUint2 (float reference);
542 deUint8 expectedUint8 (float reference);
543 deUint8 expectedAlpha8 (float reference);
544 bool checkWithThreshold8 (deUint8 value, deUint8 reference, deUint8 threshold = 1);
545 bool checkWithThreshold10 (deUint32 value, deUint32 reference, deUint32 threshold = 1);
546 bool checkWithThresholdFloat (float value, float reference, float threshold);
547 void doClearTest (EGLSurface surface);
548 void testPixels (float reference, float increment);
549 void writeEglConfig (EGLConfig config);
552 std::vector<EGLint> m_attribList;
553 EGLConfig m_eglConfig;
554 EGLint m_surfaceType;
555 EGLint m_componentType;
558 const std::vector<struct Iteration> m_iterations;
559 std::stringstream m_debugLog;
562 WideColorSurfaceTest::WideColorSurfaceTest (EglTestContext& eglTestCtx, const char* name, const char* description, const EGLint* attribList, EGLint colorSpace, const std::vector<struct Iteration>& iterations)
563 : WideColorTest (eglTestCtx, name, description)
564 , m_colorSpace (colorSpace)
565 , m_iterations (iterations)
568 while (attribList[idx] != EGL_NONE)
570 if (attribList[idx] == EGL_COLOR_COMPONENT_TYPE_EXT)
572 m_componentType = attribList[idx + 1];
574 else if (attribList[idx] == EGL_SURFACE_TYPE)
576 m_surfaceType = attribList[idx+1];
578 else if (attribList[idx] == EGL_RED_SIZE)
580 m_redSize = attribList[idx + 1];
582 m_attribList.push_back(attribList[idx++]);
583 m_attribList.push_back(attribList[idx++]);
585 m_attribList.push_back(EGL_NONE);
588 void WideColorSurfaceTest::init (void)
590 const Library& egl = m_eglTestCtx.getLibrary();
591 tcu::TestLog& log = m_testCtx.getLog();
593 WideColorTest::init();
595 // Only check for pixel format required for this specific run
596 // If not available, check will abort test with "NotSupported"
600 check1010102Support();
603 checkPixelFloatSupport();
608 switch (m_colorSpace) {
609 case EGL_GL_COLORSPACE_DISPLAY_P3_EXT:
610 checkDisplayP3Support();
612 case EGL_GL_COLORSPACE_SCRGB_EXT:
615 case EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT:
616 checkSCRGBLinearSupport();
622 EGLint numConfigs = 0;
624 // Query from EGL implementation
625 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &m_attribList[0], DE_NULL, 0, &numConfigs));
629 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
630 TCU_FAIL("No configs returned");
633 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
635 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &m_attribList[0], &m_eglConfig, 1, &numConfigs);
636 if (success != EGL_TRUE)
638 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
639 TCU_FAIL("eglChooseConfig failed");
643 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
644 TCU_FAIL("Too many configs returned");
647 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
649 writeEglConfig(m_eglConfig);
653 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, float* dataPtr)
655 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, dataPtr);
656 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with floats");
659 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint32 *dataPtr)
661 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, dataPtr);
662 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_1010102 (32bits)");
665 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint8 *dataPtr)
667 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, dataPtr);
668 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_8888 (8 bit components)");
671 void WideColorSurfaceTest::writeEglConfig (EGLConfig config)
673 const Library& egl = m_eglTestCtx.getLibrary();
674 tcu::TestLog& log = m_testCtx.getLog();
675 qpEglConfigInfo info;
678 info.bufferSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BUFFER_SIZE);
680 info.redSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RED_SIZE);
682 info.greenSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_GREEN_SIZE);
684 info.blueSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BLUE_SIZE);
686 info.luminanceSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LUMINANCE_SIZE);
688 info.alphaSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_SIZE);
690 info.alphaMaskSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_MASK_SIZE);
692 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGB);
693 info.bindToTextureRGB = val == EGL_TRUE ? true : false;
695 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGBA);
696 info.bindToTextureRGBA = val == EGL_TRUE ? true : false;
698 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_COLOR_BUFFER_TYPE);
699 std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
700 info.colorBufferType = colorBufferType.c_str();
702 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_CAVEAT);
703 std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
704 info.configCaveat = caveat.c_str();
706 info.configID = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_ID);
708 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFORMANT);
709 std::string conformant = de::toString(eglu::getAPIBitsStr(val));
710 info.conformant = conformant.c_str();
712 info.depthSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_DEPTH_SIZE);
714 info.level = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LEVEL);
716 info.maxPBufferWidth = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_WIDTH);
718 info.maxPBufferHeight = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_HEIGHT);
720 info.maxPBufferPixels = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_PIXELS);
722 info.maxSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_SWAP_INTERVAL);
724 info.minSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MIN_SWAP_INTERVAL);
726 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_NATIVE_RENDERABLE);
727 info.nativeRenderable = val == EGL_TRUE ? true : false;
729 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RENDERABLE_TYPE);
730 std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
731 info.renderableType = renderableTypes.c_str();
733 info.sampleBuffers = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLE_BUFFERS);
735 info.samples = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLES);
737 info.stencilSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_STENCIL_SIZE);
739 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SURFACE_TYPE);
740 std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
741 info.surfaceTypes = surfaceTypes.c_str();
743 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_TYPE);
744 std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
745 info.transparentType = transparentType.c_str();
747 info.transparentRedValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_RED_VALUE);
749 info.transparentGreenValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_GREEN_VALUE);
751 info.transparentBlueValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_BLUE_VALUE);
753 log.writeEglConfig(&info);
756 deUint32 WideColorSurfaceTest::expectedUint10 (float reference)
764 else if (reference > 1.0)
770 expected = static_cast<deUint32>(deRound(reference * 1023.0));
776 deUint32 WideColorSurfaceTest::expectedUint2 (float reference)
784 else if (reference > 1.0)
790 expected = static_cast<deUint32>(deRound(reference * 3.0));
796 deUint8 WideColorSurfaceTest::expectedUint8 (float reference)
803 else if (reference >= 1.0)
809 // Apply sRGB transfer function when colorspace is sRGB and pixel component
810 // size is 8 bits (which is why we are here in expectedUint8).
811 if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR)
815 if (reference <= 0.0031308)
817 srgbReference = 12.92f * reference;
821 float powRef = deFloatPow(reference, (1.0f/2.4f));
822 srgbReference = (1.055f * powRef) - 0.055f;
824 expected = static_cast<deUint8>(deRound(srgbReference * 255.0));
828 expected = static_cast<deUint8>(deRound(reference * 255.0));
834 deUint8 WideColorSurfaceTest::expectedAlpha8 (float reference)
841 else if (reference >= 1.0)
847 // The sRGB transfer function is not applied to alpha
848 expected = static_cast<deUint8>(deRound(reference * 255.0));
853 // Return true for value out of range (fail)
854 bool WideColorSurfaceTest::checkWithThreshold8(deUint8 value, deUint8 reference, deUint8 threshold)
856 const deUint8 low = reference >= threshold ? static_cast<deUint8>(reference - threshold) : 0;
857 const deUint8 high = reference <= (255 - threshold) ? static_cast<deUint8>(reference + threshold) : 255;
858 return !((value >= low) && (value <= high));
861 bool WideColorSurfaceTest::checkWithThreshold10(deUint32 value, deUint32 reference, deUint32 threshold)
863 const deUint32 low = reference >= threshold ? reference - threshold : 0;
864 const deUint32 high = reference <= (1023 - threshold) ? reference + threshold : 1023;
865 return !((value >= low) && (value <= high));
868 bool WideColorSurfaceTest::checkWithThresholdFloat(float value, float reference, float threshold)
870 const float low = reference - threshold;
871 const float high = reference + threshold;
872 return !((value >= low) && (value <= high));
875 void WideColorSurfaceTest::testPixels (float reference, float increment)
877 tcu::TestLog& log = m_testCtx.getLog();
879 if (m_componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT)
882 const float expected[4] =
885 reference + increment,
886 reference - increment,
887 reference + 2 * increment
889 readPixels(m_gl, pixels);
891 if (checkWithThresholdFloat(pixels[0], expected[0], increment) ||
892 checkWithThresholdFloat(pixels[1], expected[1], increment) ||
893 checkWithThresholdFloat(pixels[2], expected[2], increment) ||
894 checkWithThresholdFloat(pixels[3], expected[3], increment))
896 if (m_debugLog.str().size() > 0)
898 log << tcu::TestLog::Message
899 << "Prior passing tests\n"
901 << tcu::TestLog::EndMessage;
904 log << tcu::TestLog::Message
905 << "Image comparison failed: "
906 << "reference = " << reference
907 << ", expected = " << expected[0]
908 << ":" << expected[1]
909 << ":" << expected[2]
910 << ":" << expected[3]
911 << ", result = " << pixels[0]
915 << tcu::TestLog::EndMessage;
916 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
920 // Pixel matches expected value
921 m_debugLog << "Image comparison passed: "
922 << "reference = " << reference
923 << ", result = " << pixels[0]
930 else if (m_redSize > 8)
933 readPixels(m_gl, buffer);
935 deUint32 expected[4];
937 pixels[0] = buffer[0] & 0x3ff;
938 pixels[1] = (buffer[0] >> 10) & 0x3ff;
939 pixels[2] = (buffer[0] >> 20) & 0x3ff;
940 pixels[3] = (buffer[0] >> 30) & 0x3;
942 expected[0] = expectedUint10(reference);
943 expected[1] = expectedUint10(reference + increment);
944 expected[2] = expectedUint10(reference - increment);
945 expected[3] = expectedUint2(reference + 2 * increment);
946 if (checkWithThreshold10(pixels[0], expected[0]) || checkWithThreshold10(pixels[1], expected[1])
947 || checkWithThreshold10(pixels[2], expected[2]) || checkWithThreshold10(pixels[3], expected[3]))
949 if (m_debugLog.str().size() > 0) {
950 log << tcu::TestLog::Message
951 << "Prior passing tests\n"
953 << tcu::TestLog::EndMessage;
956 log << tcu::TestLog::Message
957 << "Image comparison failed: "
958 << "reference = " << reference
959 << ", expected = " << static_cast<deUint32>(expected[0])
960 << ":" << static_cast<deUint32>(expected[1])
961 << ":" << static_cast<deUint32>(expected[2])
962 << ":" << static_cast<deUint32>(expected[3])
963 << ", result = " << static_cast<deUint32>(pixels[0])
964 << ":" << static_cast<deUint32>(pixels[1])
965 << ":" << static_cast<deUint32>(pixels[2])
966 << ":" << static_cast<deUint32>(pixels[3])
967 << tcu::TestLog::EndMessage;
968 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
972 // Pixel matches expected value
973 m_debugLog << "Image comparison passed: "
974 << "reference = " << reference
975 << ", result = " << static_cast<deUint32>(pixels[0])
976 << ":" << static_cast<deUint32>(pixels[1])
977 << ":" << static_cast<deUint32>(pixels[2])
978 << ":" << static_cast<deUint32>(pixels[3])
986 readPixels(m_gl, pixels);
988 expected[0] = expectedUint8(reference);
989 expected[1] = expectedUint8(reference + increment);
990 expected[2] = expectedUint8(reference - increment);
991 expected[3] = expectedAlpha8(reference + 2 * increment);
992 if (checkWithThreshold8(pixels[0], expected[0]) || checkWithThreshold8(pixels[1], expected[1])
993 || checkWithThreshold8(pixels[2], expected[2]) || checkWithThreshold8(pixels[3], expected[3]))
995 if (m_debugLog.str().size() > 0) {
996 log << tcu::TestLog::Message
997 << "(C)Prior passing tests\n"
999 << tcu::TestLog::EndMessage;
1002 log << tcu::TestLog::Message
1003 << "Image comparison failed: "
1004 << "reference = " << reference
1005 << ", expected = " << static_cast<deUint32>(expected[0])
1006 << ":" << static_cast<deUint32>(expected[1])
1007 << ":" << static_cast<deUint32>(expected[2])
1008 << ":" << static_cast<deUint32>(expected[3])
1009 << ", result = " << static_cast<deUint32>(pixels[0])
1010 << ":" << static_cast<deUint32>(pixels[1])
1011 << ":" << static_cast<deUint32>(pixels[2])
1012 << ":" << static_cast<deUint32>(pixels[3])
1013 << tcu::TestLog::EndMessage;
1014 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
1018 // Pixel matches expected value
1019 m_debugLog << "Image comparison passed: "
1020 << "reference = " << reference
1021 << ", result = " << static_cast<deUint32>(pixels[0])
1022 << ":" << static_cast<deUint32>(pixels[1])
1023 << ":" << static_cast<deUint32>(pixels[2])
1024 << ":" << static_cast<deUint32>(pixels[3])
1030 void WideColorSurfaceTest::doClearTest (EGLSurface surface)
1032 tcu::TestLog& log = m_testCtx.getLog();
1033 const Library& egl = m_eglTestCtx.getLibrary();
1034 const EGLint attribList[] =
1036 EGL_CONTEXT_CLIENT_VERSION, 2,
1039 EGLContext eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attribList);
1040 EGLU_CHECK_MSG(egl, "eglCreateContext");
1042 egl.makeCurrent(m_eglDisplay, surface, surface, eglContext);
1043 EGLU_CHECK_MSG(egl, "eglMakeCurrent");
1046 // put gles2Renderer inside it's own scope so that it's cleaned
1047 // up before we hit the destroyContext
1048 const GLES2Renderer gles2Renderer(m_gl, 128, 128);
1050 std::vector<Iteration>::const_iterator it; // declare an Iterator to a vector of strings
1051 log << tcu::TestLog::Message << "m_iterations.count = " << m_iterations.size() << tcu::TestLog::EndMessage;
1052 for(it = m_iterations.begin() ; it < m_iterations.end(); it++)
1054 float reference = it->start;
1055 log << tcu::TestLog::Message << "start = " << it->start
1056 << tcu::TestLog::EndMessage;
1057 log << tcu::TestLog::Message
1058 << "increment = " << it->increment
1059 << tcu::TestLog::EndMessage;
1060 log << tcu::TestLog::Message
1061 << "count = " << it->iterationCount
1062 << tcu::TestLog::EndMessage;
1064 for (int iterationCount = 0; iterationCount < it->iterationCount; iterationCount++)
1066 const Color clearColor(reference, reference + it->increment, reference - it->increment, reference + 2 * it->increment);
1068 clearColorScreen(m_gl, clearColor);
1069 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to test value");
1071 testPixels(reference, it->increment);
1073 // reset buffer contents so that we know render below did something
1074 const Color clearColor2(1.0f - reference, 1.0f, 1.0f, 1.0f);
1075 clearColorScreen(m_gl, clearColor2);
1076 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to 1.0f - reference value");
1078 const ColoredRect coloredRect (IVec2(0.0f, 0.0f), IVec2(1.0f, 1.0f), clearColor);
1079 gles2Renderer.render(coloredRect);
1080 testPixels(reference, it->increment);
1082 reference += it->increment;
1085 EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, surface));
1089 // disconnect surface & context so they can be destroyed when
1090 // this function exits.
1091 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
1093 egl.destroyContext(m_eglDisplay, eglContext);
1096 void WideColorSurfaceTest::executeTest (void)
1098 tcu::TestLog& log = m_testCtx.getLog();
1099 const Library& egl = m_eglTestCtx.getLibrary();
1100 const eglu::NativeDisplayFactory& displayFactory = m_eglTestCtx.getNativeDisplayFactory();
1101 eglu::NativeDisplay& nativeDisplay = m_eglTestCtx.getNativeDisplay();
1102 egl.bindAPI(EGL_OPENGL_ES_API);
1104 if (m_surfaceType & EGL_PBUFFER_BIT)
1106 log << tcu::TestLog::Message << "Test Pbuffer" << tcu::TestLog::EndMessage;
1108 std::vector<EGLint> attribs;
1109 attribs.push_back(EGL_WIDTH);
1110 attribs.push_back(128);
1111 attribs.push_back(EGL_HEIGHT);
1112 attribs.push_back(128);
1115 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1116 attribs.push_back(m_colorSpace);
1118 attribs.push_back(EGL_NONE);
1119 attribs.push_back(EGL_NONE);
1120 const EGLSurface surface = egl.createPbufferSurface(m_eglDisplay, m_eglConfig, attribs.data());
1121 if ((surface == EGL_NO_SURFACE) && (egl.getError() == EGL_BAD_MATCH))
1123 TCU_THROW(NotSupportedError, "Colorspace is not supported with this format");
1125 TCU_CHECK(surface != EGL_NO_SURFACE);
1126 EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()");
1128 doClearTest(surface);
1130 egl.destroySurface(m_eglDisplay, surface);
1131 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1133 else if (m_surfaceType & EGL_WINDOW_BIT)
1135 log << tcu::TestLog::Message << "Test Window" << tcu::TestLog::EndMessage;
1137 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
1139 de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(128, 128, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
1140 std::vector<EGLAttrib> attribs;
1143 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1144 attribs.push_back(m_colorSpace);
1146 attribs.push_back(EGL_NONE);
1147 attribs.push_back(EGL_NONE);
1149 const EGLSurface surface = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
1150 TCU_CHECK(surface != EGL_NO_SURFACE);
1151 EGLU_CHECK_MSG(egl, "eglCreateWindowSurface()");
1153 doClearTest(surface);
1155 egl.destroySurface(m_eglDisplay, surface);
1156 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1158 else if (m_surfaceType & EGL_PIXMAP_BIT)
1160 log << tcu::TestLog::Message << "Test Pixmap" << tcu::TestLog::EndMessage;
1162 const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
1164 de::UniquePtr<eglu::NativePixmap> pixmap (pixmapFactory.createPixmap(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, 128, 128));
1165 const EGLSurface surface = eglu::createPixmapSurface(nativeDisplay, *pixmap, m_eglDisplay, m_eglConfig, DE_NULL);
1166 TCU_CHECK(surface != EGL_NO_SURFACE);
1167 EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface()");
1169 doClearTest(surface);
1171 egl.destroySurface(m_eglDisplay, surface);
1172 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1175 TCU_FAIL("No valid surface types supported in config");
1178 TestCase::IterateResult WideColorSurfaceTest::iterate (void)
1180 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1187 WideColorTests::WideColorTests (EglTestContext& eglTestCtx)
1188 : TestCaseGroup(eglTestCtx, "wide_color", "Wide Color tests")
1192 void WideColorTests::init (void)
1194 addChild(new WideColorFP16Test(m_eglTestCtx, "fp16", "Verify that FP16 pixel format is present"));
1195 addChild(new WideColor1010102Test(m_eglTestCtx, "1010102", "Check if 1010102 pixel format is present"));
1197 // This is an increment FP16 can do between -1.0 to 1.0
1198 const float fp16Increment1 = deFloatPow(2.0, -11.0);
1199 // This is an increment FP16 can do between 1.0 to 2.0
1200 const float fp16Increment2 = deFloatPow(2.0, -10.0);
1202 const EGLint windowAttribListFP16[] =
1204 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1205 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1210 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1214 std::vector<Iteration> fp16Iterations;
1215 // -0.333251953125f ~ -1/3 as seen in FP16
1216 fp16Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1218 fp16Iterations.push_back( Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1219 // test crossing 1.0
1220 fp16Iterations.push_back( Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1221 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, DE_NULL, fp16Iterations));
1222 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1223 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1224 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1225 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));
1227 const EGLint pbufferAttribListFP16[] =
1229 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1230 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1235 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1238 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, DE_NULL, fp16Iterations));
1239 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1240 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1241 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1242 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));
1244 const EGLint windowAttribList1010102[] =
1246 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1247 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1255 std::vector<Iteration> int1010102Iterations;
1256 // -0.333251953125f ~ -1/3 as seen in fp16
1257 // Negative values will be 0 on read with fixed point pixel formats
1258 int1010102Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1260 int1010102Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1261 // test crossing 1.0
1262 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1263 int1010102Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1264 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, DE_NULL, int1010102Iterations));
1265 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1266 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1268 const EGLint pbufferAttribList1010102[] =
1270 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1271 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1278 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, DE_NULL, int1010102Iterations));
1279 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1280 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1282 const EGLint windowAttribList8888[] =
1284 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1285 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1293 std::vector<Iteration> int8888Iterations;
1294 // -0.333251953125f ~ -1/3 as seen in fp16
1295 // Negative values will be 0 on read with fixed point pixel formats
1296 int8888Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1298 int8888Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1299 // test crossing 1.0
1300 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1301 int8888Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1302 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, DE_NULL, int8888Iterations));
1303 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1304 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1306 const EGLint pbufferAttribList8888[] =
1308 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1309 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1316 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, DE_NULL, int8888Iterations));
1317 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1318 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1321 TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx)
1323 return new WideColorTests(eglTestCtx);