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 checkColorSpaceSupport (void);
104 void checkDisplayP3Support (void);
105 void checkDisplayP3LinearSupport (void);
106 void check1010102Support (void);
107 void checkFP16Support (void);
108 void checkSCRGBSupport (void);
109 void checkSCRGBLinearSupport (void);
112 void initEGLSurface (EGLConfig config);
113 void initEGLContext (EGLConfig config);
115 EGLDisplay m_eglDisplay;
122 ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_);
128 ColoredRect::ColoredRect (const IVec2& bottomLeft_, const IVec2& topRight_, const Color& color_)
129 : bottomLeft (bottomLeft_)
130 , topRight (topRight_)
135 void clearColorScreen (const glw::Functions& gl, const Color& clearColor)
137 gl.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
138 gl.clear(GL_COLOR_BUFFER_BIT);
141 float windowToDeviceCoordinates (int x, int length)
143 return (2.0f * float(x) / float(length)) - 1.0f;
149 GLES2Renderer (const glw::Functions& gl, int width, int height);
150 ~GLES2Renderer (void);
151 void render (const ColoredRect& coloredRect) const;
154 GLES2Renderer (const GLES2Renderer&);
155 GLES2Renderer& operator= (const GLES2Renderer&);
157 const glw::Functions& m_gl;
158 glu::ShaderProgram m_glProgram;
159 glw::GLuint m_coordLoc;
160 glw::GLuint m_colorLoc;
161 glw::GLuint m_bufWidth;
162 glw::GLuint m_bufHeight;
165 // generate sources for vertex and fragment buffer
166 glu::ProgramSources getSources (void)
168 const char* const vertexShaderSource =
169 "attribute mediump vec2 a_pos;\n"
170 "attribute mediump vec4 a_color;\n"
171 "varying mediump vec4 v_color;\n"
174 "\tv_color = a_color;\n"
175 "\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
178 const char* const fragmentShaderSource =
179 "varying mediump vec4 v_color;\n"
182 "\tgl_FragColor = v_color;\n"
185 return glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource);
188 GLES2Renderer::GLES2Renderer (const glw::Functions& gl, int width, int height)
190 , m_glProgram (gl, getSources())
191 , m_coordLoc ((glw::GLuint)-1)
192 , m_colorLoc ((glw::GLuint)-1)
194 , m_bufHeight (height)
196 m_colorLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_color");
197 m_coordLoc = m_gl.getAttribLocation(m_glProgram.getProgram(), "a_pos");
198 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to get attribute locations");
201 GLES2Renderer::~GLES2Renderer (void)
205 void GLES2Renderer::render (const struct ColoredRect &coloredRect) const
207 const float x1 = windowToDeviceCoordinates(coloredRect.bottomLeft.x(), m_bufWidth);
208 const float y1 = windowToDeviceCoordinates(coloredRect.bottomLeft.y(), m_bufHeight);
209 const float x2 = windowToDeviceCoordinates(coloredRect.topRight.x(), m_bufWidth);
210 const float y2 = windowToDeviceCoordinates(coloredRect.topRight.y(), m_bufHeight);
212 const glw::GLfloat coords[] =
223 const glw::GLfloat colors[] =
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(),
227 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(),
231 coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), coloredRect.color.w(),
234 m_gl.useProgram(m_glProgram.getProgram());
235 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
237 m_gl.enableVertexAttribArray(m_coordLoc);
238 m_gl.enableVertexAttribArray(m_colorLoc);
239 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to enable attributes");
241 m_gl.vertexAttribPointer(m_coordLoc, 4, GL_FLOAT, GL_FALSE, 0, coords);
242 m_gl.vertexAttribPointer(m_colorLoc, 4, GL_FLOAT, GL_TRUE, 0, colors);
243 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to set attribute pointers");
245 m_gl.drawArrays(GL_TRIANGLES, 0, DE_LENGTH_OF_ARRAY(coords)/4);
246 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glDrawArrays(), failed");
248 m_gl.disableVertexAttribArray(m_coordLoc);
249 m_gl.disableVertexAttribArray(m_colorLoc);
250 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Failed to disable attributes");
253 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glUseProgram() failed");
256 class ReferenceRenderer
259 ReferenceRenderer (void);
261 ReferenceRenderer (const ReferenceRenderer&);
262 ReferenceRenderer& operator= (const ReferenceRenderer&);
265 ReferenceRenderer::ReferenceRenderer (void)
269 WideColorTest::WideColorTest (EglTestContext& eglTestCtx, const char* name, const char* description)
270 : TestCase (eglTestCtx, name, description)
271 , m_eglDisplay (EGL_NO_DISPLAY)
275 WideColorTest::~WideColorTest (void)
280 void WideColorTest::init (void)
282 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
284 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
287 void WideColorTest::checkPixelFloatSupport (void)
289 const Library& egl = m_eglTestCtx.getLibrary();
291 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_pixel_format_float"))
292 TCU_THROW(NotSupportedError, "EGL_EXT_pixel_format_float is not supported");
295 void WideColorTest::checkColorSpaceSupport (void)
297 const Library& egl = m_eglTestCtx.getLibrary();
299 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_KHR_gl_colorspace"))
300 TCU_THROW(NotSupportedError, "EGL_KHR_gl_colorspace is not supported");
303 void WideColorTest::checkDisplayP3Support (void)
305 const Library& egl = m_eglTestCtx.getLibrary();
307 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3"))
308 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3 is not supported");
311 void WideColorTest::checkDisplayP3LinearSupport (void)
313 const Library& egl = m_eglTestCtx.getLibrary();
315 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_display_p3_linear"))
316 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_display_p3_linear is not supported");
319 void WideColorTest::checkSCRGBSupport (void)
321 const Library& egl = m_eglTestCtx.getLibrary();
323 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb"))
324 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb is not supported");
327 void WideColorTest::checkSCRGBLinearSupport (void)
329 const Library& egl = m_eglTestCtx.getLibrary();
331 if (!eglu::hasExtension(egl, m_eglDisplay, "EGL_EXT_gl_colorspace_scrgb_linear"))
332 TCU_THROW(NotSupportedError, "EGL_EXT_gl_colorspace_scrgb_linear is not supported");
335 void WideColorTest::check1010102Support (void)
337 const Library& egl = m_eglTestCtx.getLibrary();
338 tcu::TestLog& log = m_testCtx.getLog();
340 const EGLint attribList[] =
342 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
343 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
350 EGLint numConfigs = 0;
353 // Query from EGL implementation
354 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
358 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
359 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
362 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
364 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs));
367 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
368 TCU_FAIL("Too many configs returned");
371 EGLint components[4];
373 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]));
374 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]));
375 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]));
376 EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]));
378 TCU_CHECK_MSG(components[0] == 10, "Missing 10bit deep red channel");
379 TCU_CHECK_MSG(components[1] == 10, "Missing 10bit deep green channel");
380 TCU_CHECK_MSG(components[2] == 10, "Missing 10bit deep blue channel");
381 TCU_CHECK_MSG(components[3] == 2, "Missing 2bit deep alpha channel");
384 void WideColorTest::checkFP16Support (void)
386 const Library& egl = m_eglTestCtx.getLibrary();
387 tcu::TestLog& log = m_testCtx.getLog();
388 EGLint numConfigs = 0;
391 const EGLint attribList[] =
393 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
394 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
399 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
403 // Query from EGL implementation
404 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &attribList[0], DE_NULL, 0, &numConfigs));
408 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
409 TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported");
412 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
414 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &attribList[0], &config, 1, &numConfigs);
415 if (success != EGL_TRUE)
417 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
418 TCU_FAIL("eglChooseConfig failed");
422 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
423 TCU_FAIL("Too many configs returned");
426 EGLint components[4];
428 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &components[0]);
429 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
431 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &components[1]);
432 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
434 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &components[2]);
435 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
437 success = egl.getConfigAttrib(m_eglDisplay, config, EGL_ALPHA_SIZE, &components[3]);
438 TCU_CHECK_MSG(success == EGL_TRUE, "eglGetConfigAttrib failed");
441 TCU_CHECK_MSG(components[0] == 16, "Missing 16bit deep red channel");
442 TCU_CHECK_MSG(components[1] == 16, "Missing 16bit deep green channel");
443 TCU_CHECK_MSG(components[2] == 16, "Missing 16bit deep blue channel");
444 TCU_CHECK_MSG(components[3] == 16, "Missing 16bit deep alpha channel");
447 void WideColorTest::deinit (void)
449 const Library& egl = m_eglTestCtx.getLibrary();
451 if (m_eglDisplay != EGL_NO_DISPLAY)
453 egl.terminate(m_eglDisplay);
454 m_eglDisplay = EGL_NO_DISPLAY;
458 class WideColorFP16Test : public WideColorTest
461 WideColorFP16Test (EglTestContext& eglTestCtx, const char* name, const char* description);
464 void executeTest (void);
465 IterateResult iterate (void);
468 WideColorFP16Test::WideColorFP16Test (EglTestContext& eglTestCtx,
470 const char* description)
471 : WideColorTest(eglTestCtx, name, description)
476 void WideColorFP16Test::executeTest (void)
478 checkPixelFloatSupport();
482 TestCase::IterateResult WideColorFP16Test::iterate (void)
484 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
489 void WideColorFP16Test::init (void)
491 WideColorTest::init();
494 class WideColor1010102Test : public WideColorTest
497 WideColor1010102Test (EglTestContext& eglTestCtx,
499 const char* description);
501 void executeTest (void);
502 IterateResult iterate (void);
505 WideColor1010102Test::WideColor1010102Test (EglTestContext& eglTestCtx, const char* name, const char* description)
506 : WideColorTest(eglTestCtx, name, description)
510 void WideColor1010102Test::executeTest (void)
512 check1010102Support();
515 TestCase::IterateResult WideColor1010102Test::iterate (void)
517 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
527 Iteration(float s, float i, int c)
528 : start(s), increment(i), iterationCount(c) {}
531 class WideColorSurfaceTest : public WideColorTest
534 WideColorSurfaceTest (EglTestContext& eglTestCtx,
536 const char* description,
537 const EGLint* attribList,
539 const std::vector<Iteration>& iterations);
542 void executeTest (void);
543 IterateResult iterate (void);
546 void readPixels (const glw::Functions& gl, float* dataPtr);
547 void readPixels (const glw::Functions& gl, deUint32* dataPtr);
548 void readPixels (const glw::Functions& gl, deUint8* dataPtr);
549 deUint32 expectedUint10 (float reference);
550 deUint32 expectedUint2 (float reference);
551 deUint8 expectedUint8 (float reference);
552 deUint8 expectedAlpha8 (float reference);
553 bool checkWithThreshold8 (deUint8 value, deUint8 reference, deUint8 threshold = 1);
554 bool checkWithThreshold10 (deUint32 value, deUint32 reference, deUint32 threshold = 1);
555 bool checkWithThresholdFloat (float value, float reference, float threshold);
556 void doClearTest (EGLSurface surface);
557 void testPixels (float reference, float increment);
558 void writeEglConfig (EGLConfig config);
561 std::vector<EGLint> m_attribList;
562 EGLConfig m_eglConfig;
563 EGLint m_surfaceType;
564 EGLint m_componentType;
567 const std::vector<struct Iteration> m_iterations;
568 std::stringstream m_debugLog;
571 WideColorSurfaceTest::WideColorSurfaceTest (EglTestContext& eglTestCtx, const char* name, const char* description, const EGLint* attribList, EGLint colorSpace, const std::vector<struct Iteration>& iterations)
572 : WideColorTest (eglTestCtx, name, description)
573 , m_colorSpace (colorSpace)
574 , m_iterations (iterations)
577 while (attribList[idx] != EGL_NONE)
579 if (attribList[idx] == EGL_COLOR_COMPONENT_TYPE_EXT)
581 m_componentType = attribList[idx + 1];
583 else if (attribList[idx] == EGL_SURFACE_TYPE)
585 m_surfaceType = attribList[idx+1];
587 else if (attribList[idx] == EGL_RED_SIZE)
589 m_redSize = attribList[idx + 1];
591 m_attribList.push_back(attribList[idx++]);
592 m_attribList.push_back(attribList[idx++]);
594 m_attribList.push_back(EGL_NONE);
597 void WideColorSurfaceTest::init (void)
599 const Library& egl = m_eglTestCtx.getLibrary();
600 tcu::TestLog& log = m_testCtx.getLog();
602 WideColorTest::init();
604 // Only check for pixel format required for this specific run
605 // If not available, check will abort test with "NotSupported"
609 check1010102Support();
612 checkPixelFloatSupport();
617 if (m_colorSpace != DE_NULL && !eglu::hasExtension(egl, m_eglDisplay, "EGL_KHR_gl_colorspace"))
618 TCU_THROW(NotSupportedError, "EGL_KHR_gl_colorspace is not supported");
620 switch (m_colorSpace) {
621 case EGL_GL_COLORSPACE_SRGB_KHR:
622 checkColorSpaceSupport();
624 case EGL_GL_COLORSPACE_DISPLAY_P3_EXT:
625 checkDisplayP3Support();
627 case EGL_GL_COLORSPACE_SCRGB_EXT:
630 case EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT:
631 checkSCRGBLinearSupport();
637 EGLint numConfigs = 0;
639 // Query from EGL implementation
640 EGLU_CHECK_CALL(egl, chooseConfig(m_eglDisplay, &m_attribList[0], DE_NULL, 0, &numConfigs));
644 log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage;
645 TCU_FAIL("No configs returned");
648 log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage;
650 EGLBoolean success = egl.chooseConfig(m_eglDisplay, &m_attribList[0], &m_eglConfig, 1, &numConfigs);
651 if (success != EGL_TRUE)
653 log << tcu::TestLog::Message << "Fail, eglChooseConfig returned an error." << tcu::TestLog::EndMessage;
654 TCU_FAIL("eglChooseConfig failed");
658 log << tcu::TestLog::Message << "Fail, more configs returned than requested." << tcu::TestLog::EndMessage;
659 TCU_FAIL("Too many configs returned");
662 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
664 writeEglConfig(m_eglConfig);
668 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, float* dataPtr)
670 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, dataPtr);
671 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with floats");
674 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint32 *dataPtr)
676 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, dataPtr);
677 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_1010102 (32bits)");
680 void WideColorSurfaceTest::readPixels (const glw::Functions& gl, deUint8 *dataPtr)
682 gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, dataPtr);
683 GLU_EXPECT_NO_ERROR(m_gl.getError(), "glReadPixels with RGBA_8888 (8 bit components)");
686 void WideColorSurfaceTest::writeEglConfig (EGLConfig config)
688 const Library& egl = m_eglTestCtx.getLibrary();
689 tcu::TestLog& log = m_testCtx.getLog();
690 qpEglConfigInfo info;
693 info.bufferSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BUFFER_SIZE);
695 info.redSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RED_SIZE);
697 info.greenSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_GREEN_SIZE);
699 info.blueSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BLUE_SIZE);
701 info.luminanceSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LUMINANCE_SIZE);
703 info.alphaSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_SIZE);
705 info.alphaMaskSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_ALPHA_MASK_SIZE);
707 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGB);
708 info.bindToTextureRGB = val == EGL_TRUE ? true : false;
710 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_BIND_TO_TEXTURE_RGBA);
711 info.bindToTextureRGBA = val == EGL_TRUE ? true : false;
713 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_COLOR_BUFFER_TYPE);
714 std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
715 info.colorBufferType = colorBufferType.c_str();
717 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_CAVEAT);
718 std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
719 info.configCaveat = caveat.c_str();
721 info.configID = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFIG_ID);
723 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_CONFORMANT);
724 std::string conformant = de::toString(eglu::getAPIBitsStr(val));
725 info.conformant = conformant.c_str();
727 info.depthSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_DEPTH_SIZE);
729 info.level = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_LEVEL);
731 info.maxPBufferWidth = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_WIDTH);
733 info.maxPBufferHeight = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_HEIGHT);
735 info.maxPBufferPixels = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_PBUFFER_PIXELS);
737 info.maxSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MAX_SWAP_INTERVAL);
739 info.minSwapInterval = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_MIN_SWAP_INTERVAL);
741 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_NATIVE_RENDERABLE);
742 info.nativeRenderable = val == EGL_TRUE ? true : false;
744 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_RENDERABLE_TYPE);
745 std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
746 info.renderableType = renderableTypes.c_str();
748 info.sampleBuffers = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLE_BUFFERS);
750 info.samples = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SAMPLES);
752 info.stencilSize = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_STENCIL_SIZE);
754 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_SURFACE_TYPE);
755 std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
756 info.surfaceTypes = surfaceTypes.c_str();
758 val = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_TYPE);
759 std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
760 info.transparentType = transparentType.c_str();
762 info.transparentRedValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_RED_VALUE);
764 info.transparentGreenValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_GREEN_VALUE);
766 info.transparentBlueValue = eglu::getConfigAttribInt(egl, m_eglDisplay, config, EGL_TRANSPARENT_BLUE_VALUE);
768 log.writeEglConfig(&info);
771 deUint32 WideColorSurfaceTest::expectedUint10 (float reference)
779 else if (reference > 1.0)
785 expected = static_cast<deUint32>(deRound(reference * 1023.0));
791 deUint32 WideColorSurfaceTest::expectedUint2 (float reference)
799 else if (reference > 1.0)
805 expected = static_cast<deUint32>(deRound(reference * 3.0));
811 deUint8 WideColorSurfaceTest::expectedUint8 (float reference)
818 else if (reference >= 1.0)
824 // Apply sRGB transfer function when colorspace is sRGB and pixel component
825 // size is 8 bits (which is why we are here in expectedUint8).
826 if (m_colorSpace == EGL_GL_COLORSPACE_SRGB_KHR)
830 if (reference <= 0.0031308)
832 srgbReference = 12.92f * reference;
836 float powRef = deFloatPow(reference, (1.0f/2.4f));
837 srgbReference = (1.055f * powRef) - 0.055f;
839 expected = static_cast<deUint8>(deRound(srgbReference * 255.0));
843 expected = static_cast<deUint8>(deRound(reference * 255.0));
849 deUint8 WideColorSurfaceTest::expectedAlpha8 (float reference)
856 else if (reference >= 1.0)
862 // The sRGB transfer function is not applied to alpha
863 expected = static_cast<deUint8>(deRound(reference * 255.0));
868 // Return true for value out of range (fail)
869 bool WideColorSurfaceTest::checkWithThreshold8(deUint8 value, deUint8 reference, deUint8 threshold)
871 const deUint8 low = reference >= threshold ? static_cast<deUint8>(reference - threshold) : 0;
872 const deUint8 high = reference <= (255 - threshold) ? static_cast<deUint8>(reference + threshold) : 255;
873 return !((value >= low) && (value <= high));
876 bool WideColorSurfaceTest::checkWithThreshold10(deUint32 value, deUint32 reference, deUint32 threshold)
878 const deUint32 low = reference >= threshold ? reference - threshold : 0;
879 const deUint32 high = reference <= (1023 - threshold) ? reference + threshold : 1023;
880 return !((value >= low) && (value <= high));
883 bool WideColorSurfaceTest::checkWithThresholdFloat(float value, float reference, float threshold)
885 const float low = reference - threshold;
886 const float high = reference + threshold;
887 return !((value >= low) && (value <= high));
890 void WideColorSurfaceTest::testPixels (float reference, float increment)
892 tcu::TestLog& log = m_testCtx.getLog();
894 if (m_componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT)
897 const float expected[4] =
900 reference + increment,
901 reference - increment,
902 reference + 2 * increment
904 readPixels(m_gl, pixels);
906 if (checkWithThresholdFloat(pixels[0], expected[0], increment) ||
907 checkWithThresholdFloat(pixels[1], expected[1], increment) ||
908 checkWithThresholdFloat(pixels[2], expected[2], increment) ||
909 checkWithThresholdFloat(pixels[3], expected[3], increment))
911 if (m_debugLog.str().size() > 0)
913 log << tcu::TestLog::Message
914 << "Prior passing tests\n"
916 << tcu::TestLog::EndMessage;
919 log << tcu::TestLog::Message
920 << "Image comparison failed: "
921 << "reference = " << reference
922 << ", expected = " << expected[0]
923 << ":" << expected[1]
924 << ":" << expected[2]
925 << ":" << expected[3]
926 << ", result = " << pixels[0]
930 << tcu::TestLog::EndMessage;
931 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
935 // Pixel matches expected value
936 m_debugLog << "Image comparison passed: "
937 << "reference = " << reference
938 << ", result = " << pixels[0]
945 else if (m_redSize > 8)
948 readPixels(m_gl, buffer);
950 deUint32 expected[4];
952 pixels[0] = buffer[0] & 0x3ff;
953 pixels[1] = (buffer[0] >> 10) & 0x3ff;
954 pixels[2] = (buffer[0] >> 20) & 0x3ff;
955 pixels[3] = (buffer[0] >> 30) & 0x3;
957 expected[0] = expectedUint10(reference);
958 expected[1] = expectedUint10(reference + increment);
959 expected[2] = expectedUint10(reference - increment);
960 expected[3] = expectedUint2(reference + 2 * increment);
961 if (checkWithThreshold10(pixels[0], expected[0]) || checkWithThreshold10(pixels[1], expected[1])
962 || checkWithThreshold10(pixels[2], expected[2]) || checkWithThreshold10(pixels[3], expected[3]))
964 if (m_debugLog.str().size() > 0) {
965 log << tcu::TestLog::Message
966 << "Prior passing tests\n"
968 << tcu::TestLog::EndMessage;
971 log << tcu::TestLog::Message
972 << "Image comparison failed: "
973 << "reference = " << reference
974 << ", expected = " << static_cast<deUint32>(expected[0])
975 << ":" << static_cast<deUint32>(expected[1])
976 << ":" << static_cast<deUint32>(expected[2])
977 << ":" << static_cast<deUint32>(expected[3])
978 << ", result = " << static_cast<deUint32>(pixels[0])
979 << ":" << static_cast<deUint32>(pixels[1])
980 << ":" << static_cast<deUint32>(pixels[2])
981 << ":" << static_cast<deUint32>(pixels[3])
982 << tcu::TestLog::EndMessage;
983 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
987 // Pixel matches expected value
988 m_debugLog << "Image comparison passed: "
989 << "reference = " << reference
990 << ", result = " << static_cast<deUint32>(pixels[0])
991 << ":" << static_cast<deUint32>(pixels[1])
992 << ":" << static_cast<deUint32>(pixels[2])
993 << ":" << static_cast<deUint32>(pixels[3])
1000 deUint8 expected[4];
1001 readPixels(m_gl, pixels);
1003 expected[0] = expectedUint8(reference);
1004 expected[1] = expectedUint8(reference + increment);
1005 expected[2] = expectedUint8(reference - increment);
1006 expected[3] = expectedAlpha8(reference + 2 * increment);
1007 if (checkWithThreshold8(pixels[0], expected[0]) || checkWithThreshold8(pixels[1], expected[1])
1008 || checkWithThreshold8(pixels[2], expected[2]) || checkWithThreshold8(pixels[3], expected[3]))
1010 if (m_debugLog.str().size() > 0) {
1011 log << tcu::TestLog::Message
1012 << "(C)Prior passing tests\n"
1014 << tcu::TestLog::EndMessage;
1017 log << tcu::TestLog::Message
1018 << "Image comparison failed: "
1019 << "reference = " << reference
1020 << ", expected = " << static_cast<deUint32>(expected[0])
1021 << ":" << static_cast<deUint32>(expected[1])
1022 << ":" << static_cast<deUint32>(expected[2])
1023 << ":" << static_cast<deUint32>(expected[3])
1024 << ", result = " << static_cast<deUint32>(pixels[0])
1025 << ":" << static_cast<deUint32>(pixels[1])
1026 << ":" << static_cast<deUint32>(pixels[2])
1027 << ":" << static_cast<deUint32>(pixels[3])
1028 << tcu::TestLog::EndMessage;
1029 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Color test failed");
1033 // Pixel matches expected value
1034 m_debugLog << "Image comparison passed: "
1035 << "reference = " << reference
1036 << ", result = " << static_cast<deUint32>(pixels[0])
1037 << ":" << static_cast<deUint32>(pixels[1])
1038 << ":" << static_cast<deUint32>(pixels[2])
1039 << ":" << static_cast<deUint32>(pixels[3])
1045 void WideColorSurfaceTest::doClearTest (EGLSurface surface)
1047 tcu::TestLog& log = m_testCtx.getLog();
1048 const Library& egl = m_eglTestCtx.getLibrary();
1049 const EGLint attribList[] =
1051 EGL_CONTEXT_CLIENT_VERSION, 2,
1054 EGLContext eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attribList);
1055 EGLU_CHECK_MSG(egl, "eglCreateContext");
1057 egl.makeCurrent(m_eglDisplay, surface, surface, eglContext);
1058 EGLU_CHECK_MSG(egl, "eglMakeCurrent");
1061 // put gles2Renderer inside it's own scope so that it's cleaned
1062 // up before we hit the destroyContext
1063 const GLES2Renderer gles2Renderer(m_gl, 128, 128);
1065 std::vector<Iteration>::const_iterator it; // declare an Iterator to a vector of strings
1066 log << tcu::TestLog::Message << "m_iterations.count = " << m_iterations.size() << tcu::TestLog::EndMessage;
1067 for(it = m_iterations.begin() ; it < m_iterations.end(); it++)
1069 float reference = it->start;
1070 log << tcu::TestLog::Message << "start = " << it->start
1071 << tcu::TestLog::EndMessage;
1072 log << tcu::TestLog::Message
1073 << "increment = " << it->increment
1074 << tcu::TestLog::EndMessage;
1075 log << tcu::TestLog::Message
1076 << "count = " << it->iterationCount
1077 << tcu::TestLog::EndMessage;
1079 for (int iterationCount = 0; iterationCount < it->iterationCount; iterationCount++)
1081 const Color clearColor(reference, reference + it->increment, reference - it->increment, reference + 2 * it->increment);
1083 clearColorScreen(m_gl, clearColor);
1084 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to test value");
1086 testPixels(reference, it->increment);
1088 // reset buffer contents so that we know render below did something
1089 const Color clearColor2(1.0f - reference, 1.0f, 1.0f, 1.0f);
1090 clearColorScreen(m_gl, clearColor2);
1091 GLU_EXPECT_NO_ERROR(m_gl.getError(), "Clear to 1.0f - reference value");
1093 const ColoredRect coloredRect (IVec2(0.0f, 0.0f), IVec2(1.0f, 1.0f), clearColor);
1094 gles2Renderer.render(coloredRect);
1095 testPixels(reference, it->increment);
1097 reference += it->increment;
1100 EGLU_CHECK_CALL(egl, swapBuffers(m_eglDisplay, surface));
1104 // disconnect surface & context so they can be destroyed when
1105 // this function exits.
1106 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
1108 egl.destroyContext(m_eglDisplay, eglContext);
1111 void WideColorSurfaceTest::executeTest (void)
1113 tcu::TestLog& log = m_testCtx.getLog();
1114 const Library& egl = m_eglTestCtx.getLibrary();
1115 const eglu::NativeDisplayFactory& displayFactory = m_eglTestCtx.getNativeDisplayFactory();
1116 eglu::NativeDisplay& nativeDisplay = m_eglTestCtx.getNativeDisplay();
1117 egl.bindAPI(EGL_OPENGL_ES_API);
1119 if (m_surfaceType & EGL_PBUFFER_BIT)
1121 log << tcu::TestLog::Message << "Test Pbuffer" << tcu::TestLog::EndMessage;
1123 std::vector<EGLint> attribs;
1124 attribs.push_back(EGL_WIDTH);
1125 attribs.push_back(128);
1126 attribs.push_back(EGL_HEIGHT);
1127 attribs.push_back(128);
1128 if (m_colorSpace != EGL_NONE)
1130 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1131 attribs.push_back(m_colorSpace);
1133 attribs.push_back(EGL_NONE);
1134 attribs.push_back(EGL_NONE);
1135 const EGLSurface surface = egl.createPbufferSurface(m_eglDisplay, m_eglConfig, attribs.data());
1136 if ((surface == EGL_NO_SURFACE) && (egl.getError() == EGL_BAD_MATCH))
1138 TCU_THROW(NotSupportedError, "Colorspace is not supported with this format");
1140 TCU_CHECK(surface != EGL_NO_SURFACE);
1141 EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()");
1143 doClearTest(surface);
1145 egl.destroySurface(m_eglDisplay, surface);
1146 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1148 else if (m_surfaceType & EGL_WINDOW_BIT)
1150 log << tcu::TestLog::Message << "Test Window" << tcu::TestLog::EndMessage;
1152 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
1154 de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(128, 128, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
1155 std::vector<EGLAttrib> attribs;
1156 if (m_colorSpace != EGL_NONE)
1158 attribs.push_back(EGL_GL_COLORSPACE_KHR);
1159 attribs.push_back(m_colorSpace);
1161 attribs.push_back(EGL_NONE);
1162 attribs.push_back(EGL_NONE);
1164 const EGLSurface surface = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
1165 TCU_CHECK(surface != EGL_NO_SURFACE);
1166 EGLU_CHECK_MSG(egl, "eglCreateWindowSurface()");
1168 doClearTest(surface);
1170 egl.destroySurface(m_eglDisplay, surface);
1171 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1173 else if (m_surfaceType & EGL_PIXMAP_BIT)
1175 log << tcu::TestLog::Message << "Test Pixmap" << tcu::TestLog::EndMessage;
1177 const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
1179 de::UniquePtr<eglu::NativePixmap> pixmap (pixmapFactory.createPixmap(&nativeDisplay, m_eglDisplay, m_eglConfig, DE_NULL, 128, 128));
1180 const EGLSurface surface = eglu::createPixmapSurface(nativeDisplay, *pixmap, m_eglDisplay, m_eglConfig, DE_NULL);
1181 TCU_CHECK(surface != EGL_NO_SURFACE);
1182 EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface()");
1184 doClearTest(surface);
1186 egl.destroySurface(m_eglDisplay, surface);
1187 EGLU_CHECK_MSG(egl, "eglDestroySurface()");
1190 TCU_FAIL("No valid surface types supported in config");
1193 TestCase::IterateResult WideColorSurfaceTest::iterate (void)
1195 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1202 WideColorTests::WideColorTests (EglTestContext& eglTestCtx)
1203 : TestCaseGroup(eglTestCtx, "wide_color", "Wide Color tests")
1207 void WideColorTests::init (void)
1209 addChild(new WideColorFP16Test(m_eglTestCtx, "fp16", "Verify that FP16 pixel format is present"));
1210 addChild(new WideColor1010102Test(m_eglTestCtx, "1010102", "Check if 1010102 pixel format is present"));
1212 // This is an increment FP16 can do between -1.0 to 1.0
1213 const float fp16Increment1 = deFloatPow(2.0, -11.0);
1214 // This is an increment FP16 can do between 1.0 to 2.0
1215 const float fp16Increment2 = deFloatPow(2.0, -10.0);
1217 const EGLint windowAttribListFP16[] =
1219 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1220 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1225 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1229 std::vector<Iteration> fp16Iterations;
1230 // -0.333251953125f ~ -1/3 as seen in FP16
1231 fp16Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1233 fp16Iterations.push_back( Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1234 // test crossing 1.0
1235 fp16Iterations.push_back( Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1236 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_default_colorspace", "FP16 window surface has FP16 pixels in it", windowAttribListFP16, DE_NULL, fp16Iterations));
1237 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_srgb", "FP16 window surface, explicit sRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1238 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_p3", "FP16 window surface, explicit Display-P3 colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1239 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_fp16_colorspace_scrgb", "FP16 window surface, explicit scRGB colorspace", windowAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1240 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));
1242 const EGLint pbufferAttribListFP16[] =
1244 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1245 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1250 EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
1253 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_default_colorspace", "FP16 pbuffer surface has FP16 pixels in it", pbufferAttribListFP16, DE_NULL, fp16Iterations));
1254 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_srgb", "FP16 pbuffer surface, explicit sRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SRGB_KHR, fp16Iterations));
1255 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_p3", "FP16 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, fp16Iterations));
1256 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_fp16_colorspace_scrgb", "FP16 pbuffer surface, explicit scRGB colorspace", pbufferAttribListFP16, EGL_GL_COLORSPACE_SCRGB_EXT, fp16Iterations));
1257 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));
1259 const EGLint windowAttribList1010102[] =
1261 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1262 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1270 std::vector<Iteration> int1010102Iterations;
1271 // -0.333251953125f ~ -1/3 as seen in fp16
1272 // Negative values will be 0 on read with fixed point pixel formats
1273 int1010102Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1275 int1010102Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1276 // test crossing 1.0
1277 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1278 int1010102Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1279 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_default", "1010102 Window surface, default (sRGB) colorspace", windowAttribList1010102, DE_NULL, int1010102Iterations));
1280 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_srgb", "1010102 Window surface, explicit sRGB colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1281 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_1010102_colorspace_p3", "1010102 Window surface, explicit Display-P3 colorspace", windowAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1283 const EGLint pbufferAttribList1010102[] =
1285 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1286 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1293 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_default", "1010102 pbuffer surface, default (sRGB) colorspace", pbufferAttribList1010102, DE_NULL, int1010102Iterations));
1294 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_srgb", "1010102 pbuffer surface, explicit sRGB colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_SRGB_KHR, int1010102Iterations));
1295 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_1010102_colorspace_p3", "1010102 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList1010102, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int1010102Iterations));
1297 const EGLint windowAttribList8888[] =
1299 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
1300 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1308 std::vector<Iteration> int8888Iterations;
1309 // -0.333251953125f ~ -1/3 as seen in fp16
1310 // Negative values will be 0 on read with fixed point pixel formats
1311 int8888Iterations.push_back(Iteration(-0.333251953125f, fp16Increment1, 10));
1313 int8888Iterations.push_back(Iteration(-fp16Increment1 * 5.0f, fp16Increment1, 10));
1314 // test crossing 1.0
1315 // Values > 1.0 will be truncated to 1.0 with fixed point pixel formats
1316 int8888Iterations.push_back(Iteration(1.0f - fp16Increment2 * 5.0f, fp16Increment2, 10));
1317 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_default", "8888 window surface, default (sRGB) colorspace", windowAttribList8888, DE_NULL, int8888Iterations));
1318 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_srgb", "8888 window surface, explicit sRGB colorspace", windowAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1319 addChild(new WideColorSurfaceTest(m_eglTestCtx, "window_8888_colorspace_p3", "8888 window surface, explicit Display-P3 colorspace", windowAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1321 const EGLint pbufferAttribList8888[] =
1323 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1324 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
1331 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_default", "8888 pbuffer surface, default (sRGB) colorspace", pbufferAttribList8888, DE_NULL, int8888Iterations));
1332 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_srgb", "8888 pbuffer surface, explicit sRGB colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_SRGB_KHR, int8888Iterations));
1333 addChild(new WideColorSurfaceTest(m_eglTestCtx, "pbuffer_8888_colorspace_p3", "8888 pbuffer surface, explicit Display-P3 colorspace", pbufferAttribList8888, EGL_GL_COLORSPACE_DISPLAY_P3_EXT, int8888Iterations));
1336 TestCaseGroup* createWideColorTests (EglTestContext& eglTestCtx)
1338 return new WideColorTests(eglTestCtx);