From: Dejan Mircevski Date: Fri, 6 Nov 2015 22:08:44 +0000 (-0500) Subject: Make RGBA constants methods. X-Git-Tag: upstream/0.1.0~1353 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c215aaa83047ebbaabafef7acd71275a256da6ab;p=platform%2Fupstream%2FVK-GL-CTS.git Make RGBA constants methods. Without this, other global variables that are initialized with values like RGBA::white will have a race condition with the RGBA::white initialization. We have seen a bug where a global array of RGBA constants was being initialized before the constants themselves, so all elements were (0, 0, 0, 0). Change-Id: Idd6a88efda8375e52f15ed285afe38631b9c464a --- diff --git a/framework/common/tcuRGBA.cpp b/framework/common/tcuRGBA.cpp index fedd91c..a212378 100644 --- a/framework/common/tcuRGBA.cpp +++ b/framework/common/tcuRGBA.cpp @@ -28,13 +28,6 @@ namespace tcu { -const RGBA RGBA::red (0xFF, 0x0, 0x0, 0xFF); -const RGBA RGBA::green (0x0, 0xFF, 0x0, 0xFF); -const RGBA RGBA::blue (0x0, 0x0, 0xFF, 0xFF); -const RGBA RGBA::gray (0x80, 0x80, 0x80, 0xFF); -const RGBA RGBA::white (0xFF, 0xFF, 0xFF, 0xFF); -const RGBA RGBA::black (0x0, 0x0, 0x0, 0xFF); - RGBA::RGBA (const Vec4& v) { const deUint32 r = (deUint32)floatToU8(v.x()); diff --git a/framework/common/tcuRGBA.hpp b/framework/common/tcuRGBA.hpp index 76e7dbc..b7fb451 100644 --- a/framework/common/tcuRGBA.hpp +++ b/framework/common/tcuRGBA.hpp @@ -92,13 +92,13 @@ public: bool operator== (const RGBA& v) const { return (m_value == v.m_value); } bool operator!= (const RGBA& v) const { return (m_value != v.m_value); } - // Color constants - const static RGBA red; - const static RGBA green; - const static RGBA blue; - const static RGBA gray; - const static RGBA white; - const static RGBA black; + // Color constants. Designed as methods to avoid static-initialization-order fiasco. + static inline const RGBA red (void) { return RGBA(0xFF, 0x0, 0x0, 0xFF); } + static inline const RGBA green (void) { return RGBA(0x0, 0xFF, 0x0, 0xFF); } + static inline const RGBA blue (void) { return RGBA(0x0, 0x0, 0xFF, 0xFF); } + static inline const RGBA gray (void) { return RGBA(0x80, 0x80, 0x80, 0xFF); } + static inline const RGBA white (void) { return RGBA(0xFF, 0xFF, 0xFF, 0xFF); } + static inline const RGBA black (void) { return RGBA(0x0, 0x0, 0x0, 0xFF); } private: deUint32 m_value; diff --git a/modules/egl/teglColorClearCase.cpp b/modules/egl/teglColorClearCase.cpp index db38ad0..e2006cb 100644 --- a/modules/egl/teglColorClearCase.cpp +++ b/modules/egl/teglColorClearCase.cpp @@ -192,7 +192,7 @@ void SingleThreadColorClearCase::executeForContexts (EGLDisplay display, EGLSurf { EGLint api = contexts[0].first; EGLContext context = contexts[0].second; - ClearOp clear (0, 0, width, height, RGBA::black); + ClearOp clear (0, 0, width, height, RGBA::black()); egl.makeCurrent(display, surface, surface, context); EGLU_CHECK_MSG(egl, "eglMakeCurrent"); @@ -376,7 +376,7 @@ void MultiThreadColorClearCase::executeForContexts (EGLDisplay display, EGLSurfa { // First clear is always full-screen black. if (threadNdx == 0 && packetNdx == 0 && clearNdx == 0) - packet.clears[clearNdx] = ClearOp(0, 0, width, height, RGBA::black); + packet.clears[clearNdx] = ClearOp(0, 0, width, height, RGBA::black()); else packet.clears[clearNdx] = computeRandomClear(rnd, width, height); } diff --git a/modules/gles2/functional/es2fDefaultVertexAttributeTests.cpp b/modules/gles2/functional/es2fDefaultVertexAttributeTests.cpp index b2672bb..30379f8 100644 --- a/modules/gles2/functional/es2fDefaultVertexAttributeTests.cpp +++ b/modules/gles2/functional/es2fDefaultVertexAttributeTests.cpp @@ -429,7 +429,7 @@ bool AttributeCase::verifyUnicoloredBuffer (const tcu::Surface& scene, const tcu tcu::RGBA exampleColor; tcu::IVec2 examplePos; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); m_testCtx.getLog() << tcu::TestLog::Message << "Verifying rendered image. Expecting color " << refColor << ", threshold " << colorThreshold << tcu::TestLog::EndMessage; @@ -450,7 +450,7 @@ bool AttributeCase::verifyUnicoloredBuffer (const tcu::Surface& scene, const tcu } error = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } diff --git a/modules/gles2/functional/es2fDepthRangeTests.cpp b/modules/gles2/functional/es2fDepthRangeTests.cpp index a59b1a0..1e7170c 100644 --- a/modules/gles2/functional/es2fDepthRangeTests.cpp +++ b/modules/gles2/functional/es2fDepthRangeTests.cpp @@ -238,7 +238,7 @@ DepthRangeCompareCase::IterateResult DepthRangeCompareCase::iterate (void) float d = depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar); bool dpass = compare(m_compareFunc, d, constDepth*0.5f + 0.5f); - referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue); + referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue()); } // Fill right half - comparison to interpolated depth @@ -250,7 +250,7 @@ DepthRangeCompareCase::IterateResult DepthRangeCompareCase::iterate (void) float d = depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar); bool dpass = compare(m_compareFunc, d, rd); - referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green : tcu::RGBA::blue); + referenceFrame.setPixel(x, y, dpass ? tcu::RGBA::green() : tcu::RGBA::blue()); } } diff --git a/modules/gles2/functional/es2fDepthStencilClearTests.cpp b/modules/gles2/functional/es2fDepthStencilClearTests.cpp index cbbcf99..ec1c130 100644 --- a/modules/gles2/functional/es2fDepthStencilClearTests.cpp +++ b/modules/gles2/functional/es2fDepthStencilClearTests.cpp @@ -400,7 +400,7 @@ void DepthStencilClearCase::renderReference (tcu::Surface& dst, const vector& basicUniforms, const S { for (int x = 0; x < renderedImg.getWidth(); x++) { - if (renderedImg.getPixel(x, y) != tcu::RGBA::white) + if (renderedImg.getPixel(x, y) != tcu::RGBA::white()) numFailedPixels += 1; } } diff --git a/modules/gles2/stress/es2sSpecialFloatTests.cpp b/modules/gles2/stress/es2sSpecialFloatTests.cpp index 3602575..9a1c812 100644 --- a/modules/gles2/stress/es2sSpecialFloatTests.cpp +++ b/modules/gles2/stress/es2sSpecialFloatTests.cpp @@ -187,10 +187,10 @@ bool RenderCase::checkResultImage (const tcu::Surface& result) const tcu::RGBA col = result.getPixel(x, y); if (col.getGreen() == 255) - errorMask.setPixel(x, y, tcu::RGBA::green); + errorMask.setPixel(x, y, tcu::RGBA::green()); else { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); error = true; } } @@ -324,11 +324,11 @@ bool RenderCase::drawTestPattern (bool useTexture) colorDiff.y() > formatThreshold.getGreen() + colorThreshold || colorDiff.z() > formatThreshold.getBlue() + colorThreshold) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); error = true; } else - errorMask.setPixel(x, y, tcu::RGBA::green); + errorMask.setPixel(x, y, tcu::RGBA::green()); } // report error @@ -1390,8 +1390,8 @@ void OutputCase::testFBO (void) // Check results { tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE); - const tcu::RGBA badPixelColor = tcu::RGBA::red; - const tcu::RGBA okPixelColor = tcu::RGBA::green; + const tcu::RGBA badPixelColor = tcu::RGBA::red(); + const tcu::RGBA okPixelColor = tcu::RGBA::green(); int badPixels = 0; m_testCtx.getLog() << tcu::TestLog::Message << "Checking passes have identical red and blue channels and the green channel is correct in the constant pass." << tcu::TestLog::EndMessage; @@ -1612,8 +1612,8 @@ void BlendingCase::testFBO (void) // Check results { tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE); - const tcu::RGBA badPixelColor = tcu::RGBA::red; - const tcu::RGBA okPixelColor = tcu::RGBA::green; + const tcu::RGBA badPixelColor = tcu::RGBA::red(); + const tcu::RGBA okPixelColor = tcu::RGBA::green(); int badPixels = 0; m_testCtx.getLog() << tcu::TestLog::Message << "Checking patterns are identical." << tcu::TestLog::EndMessage; diff --git a/modules/gles3/functional/es3fASTCDecompressionCases.cpp b/modules/gles3/functional/es3fASTCDecompressionCases.cpp index c668dfd..5389b33 100644 --- a/modules/gles3/functional/es3fASTCDecompressionCases.cpp +++ b/modules/gles3/functional/es3fASTCDecompressionCases.cpp @@ -1566,7 +1566,7 @@ static bool compareBlockImages (const Surface& reference, maxDiffDst = tcu::max(maxDiffDst, diff); - errorMaskDst.setPixel(x, y, isOk ? tcu::RGBA::green : tcu::RGBA::red); + errorMaskDst.setPixel(x, y, isOk ? tcu::RGBA::green() : tcu::RGBA::red()); if (!isOk && firstFailedBlockCoordDst.x() == -1) firstFailedBlockCoordDst = blockCoord; diff --git a/modules/gles3/functional/es3fDefaultVertexAttributeTests.cpp b/modules/gles3/functional/es3fDefaultVertexAttributeTests.cpp index 7c769a8..5117e83 100644 --- a/modules/gles3/functional/es3fDefaultVertexAttributeTests.cpp +++ b/modules/gles3/functional/es3fDefaultVertexAttributeTests.cpp @@ -506,7 +506,7 @@ bool AttributeCase::verifyUnicoloredBuffer (const tcu::Surface& scene, const tcu tcu::RGBA exampleColor; tcu::IVec2 examplePos; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); m_testCtx.getLog() << tcu::TestLog::Message << "Verifying rendered image. Expecting color " << refColor << ", threshold " << colorThreshold << tcu::TestLog::EndMessage; @@ -527,7 +527,7 @@ bool AttributeCase::verifyUnicoloredBuffer (const tcu::Surface& scene, const tcu } error = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } diff --git a/modules/gles3/functional/es3fDepthStencilClearTests.cpp b/modules/gles3/functional/es3fDepthStencilClearTests.cpp index 0138bc8..77bd5a5 100644 --- a/modules/gles3/functional/es3fDepthStencilClearTests.cpp +++ b/modules/gles3/functional/es3fDepthStencilClearTests.cpp @@ -403,7 +403,7 @@ void DepthStencilClearCase::renderReference (tcu::Surface& dst, const vector& basicUniforms, const S { for (int x = 0; x < renderedImg.getWidth(); x++) { - if (renderedImg.getPixel(x, y) != tcu::RGBA::white) + if (renderedImg.getPixel(x, y) != tcu::RGBA::white()) numFailedPixels += 1; } } diff --git a/modules/gles3/stress/es3sSpecialFloatTests.cpp b/modules/gles3/stress/es3sSpecialFloatTests.cpp index 64ba419..aee32de 100644 --- a/modules/gles3/stress/es3sSpecialFloatTests.cpp +++ b/modules/gles3/stress/es3sSpecialFloatTests.cpp @@ -190,10 +190,10 @@ bool RenderCase::checkResultImage (const tcu::Surface& result) const tcu::RGBA col = result.getPixel(x, y); if (col.getGreen() == 255) - errorMask.setPixel(x, y, tcu::RGBA::green); + errorMask.setPixel(x, y, tcu::RGBA::green()); else { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); error = true; } } @@ -332,11 +332,11 @@ bool RenderCase::drawTestPattern (bool useTexture) colorDiff.y() > formatThreshold.getGreen() + colorThreshold || colorDiff.z() > formatThreshold.getBlue() + colorThreshold) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); error = true; } else - errorMask.setPixel(x, y, tcu::RGBA::green); + errorMask.setPixel(x, y, tcu::RGBA::green()); } // report error @@ -1753,8 +1753,8 @@ void OutputCase::testFBO (void) // Check results { tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE); - const tcu::RGBA badPixelColor = tcu::RGBA::red; - const tcu::RGBA okPixelColor = tcu::RGBA::green; + const tcu::RGBA badPixelColor = tcu::RGBA::red(); + const tcu::RGBA okPixelColor = tcu::RGBA::green(); int badPixels = 0; m_testCtx.getLog() << tcu::TestLog::Message << "Checking passes have identical red and blue channels and the green channel is correct in the constant pass." << tcu::TestLog::EndMessage; @@ -1980,8 +1980,8 @@ void BlendingCase::testFBO (void) // Check results { tcu::Surface errorMask (TEST_CANVAS_SIZE, TEST_CANVAS_SIZE); - const tcu::RGBA badPixelColor = tcu::RGBA::red; - const tcu::RGBA okPixelColor = tcu::RGBA::green; + const tcu::RGBA badPixelColor = tcu::RGBA::red(); + const tcu::RGBA okPixelColor = tcu::RGBA::green(); int badPixels = 0; m_testCtx.getLog() << tcu::TestLog::Message << "Checking patterns are identical." << tcu::TestLog::EndMessage; diff --git a/modules/gles31/functional/es31fGeometryShaderTests.cpp b/modules/gles31/functional/es31fGeometryShaderTests.cpp index 2f4e60c..fe55d52 100644 --- a/modules/gles31/functional/es31fGeometryShaderTests.cpp +++ b/modules/gles31/functional/es31fGeometryShaderTests.cpp @@ -3404,7 +3404,7 @@ bool LayeredRenderCase::verifyImageSingleColoredRow (const tcu::Surface& layer, if (logging) m_testCtx.getLog() << tcu::TestLog::Message << "Expecting all pixels with distance less or equal to (about) " << barLength << " pixels from left border to be of color " << barColor.swizzle(0,1,2) << "." << tcu::TestLog::EndMessage; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); for (int y = 0; y < layer.getHeight(); ++y) for (int x = 0; x < layer.getWidth(); ++x) @@ -3427,7 +3427,7 @@ bool LayeredRenderCase::verifyImageSingleColoredRow (const tcu::Surface& layer, allPixelsOk &= isOk; if (!isOk) - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } if (allPixelsOk) diff --git a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp index d25314e..4748b7f 100644 --- a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp +++ b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp @@ -1341,7 +1341,7 @@ void GridRenderCase::verifyRenderResult (const IterationConfig& config) if (error) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); anyError = true; } } @@ -3401,7 +3401,7 @@ bool BlitFboCase::verifyImage (const BlitArgs& args) if (error) { anyError = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } @@ -3898,7 +3898,7 @@ bool DepthDrawCase::verifyImage (const tcu::Surface& viewport) const if (error) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); anyError = true; } } @@ -4256,14 +4256,14 @@ bool ClearCase::verifyImagesEqual (const tcu::PixelBufferAccess& withoutBBox, co tcu::Surface errorMask (withoutBBox.getWidth(), withoutBBox.getHeight()); bool anyError = false; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); for (int y = 0; y < withoutBBox.getHeight(); ++y) for (int x = 0; x < withoutBBox.getWidth(); ++x) { if (withoutBBox.getPixelInt(x, y) != withBBox.getPixelInt(x, y)) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); anyError = true; } } @@ -4289,7 +4289,7 @@ bool ClearCase::verifyImageResultValid (const tcu::PixelBufferAccess& result) tcu::Surface errorMask (result.getWidth(), result.getHeight()); bool anyError = false; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); for (int y = 0; y < result.getHeight(); ++y) for (int x = 0; x < result.getWidth(); ++x) @@ -4299,7 +4299,7 @@ bool ClearCase::verifyImageResultValid (const tcu::PixelBufferAccess& result) // allow green, yellow and any shade between if (pixel[1] != 255 || pixel[2] != 0) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); anyError = true; } } @@ -4626,7 +4626,7 @@ bool ViewportCallOrderCase::verifyImage (const tcu::PixelBufferAccess& result) tcu::Surface errorMask (result.getWidth(), result.getHeight()); bool anyError = false; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toIVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toIVec()); for (int y = 0; y < result.getHeight(); ++y) for (int x = 0; x < result.getWidth(); ++x) @@ -4641,7 +4641,7 @@ bool ViewportCallOrderCase::verifyImage (const tcu::PixelBufferAccess& result) if ((insideMeshArea && (pixel[1] != 255 || pixel[2] != 0)) || (outsideMeshArea && (pixel[0] != 0 || pixel[1] != 0 || pixel[2] != 0))) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); anyError = true; } } diff --git a/modules/gles31/functional/es31fProgramUniformTests.cpp b/modules/gles31/functional/es31fProgramUniformTests.cpp index c020b34..91a1257 100644 --- a/modules/gles31/functional/es31fProgramUniformTests.cpp +++ b/modules/gles31/functional/es31fProgramUniformTests.cpp @@ -1632,7 +1632,7 @@ bool UniformCase::renderTest (const vector& basicUniforms, const S { for (int x = 0; x < renderedImg.getWidth(); x++) { - if (renderedImg.getPixel(x, y) != tcu::RGBA::green) + if (renderedImg.getPixel(x, y) != tcu::RGBA::green()) numFailedPixels += 1; } } diff --git a/modules/gles31/functional/es31fSampleVariableTests.cpp b/modules/gles31/functional/es31fSampleVariableTests.cpp index 14b2c31..f60b862 100644 --- a/modules/gles31/functional/es31fSampleVariableTests.cpp +++ b/modules/gles31/functional/es31fSampleVariableTests.cpp @@ -221,7 +221,7 @@ static bool verifyImageWithVerifier (const tcu::Surface& resultImage, tcu::TestL if (!verifier.verify(color, tcu::IVec2(x,y))) { error = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } @@ -756,7 +756,7 @@ bool SamplePosDistributionCase::verifySampleBuffers (const std::vector& maskNdxNotUnique = true; uniquenessOk = false; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } } diff --git a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp index 5fcb276..64e60e0 100644 --- a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp +++ b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp @@ -2509,7 +2509,7 @@ bool GridRenderCase::verifyResultLayer (int layerNdx, const tcu::Surface& image) // Color must be a linear combination of green and yellow if (color.getGreen() < 255 - threshold || color.getBlue() > threshold) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); foundError = true; } } diff --git a/modules/gles31/functional/es31fTessellationTests.cpp b/modules/gles31/functional/es31fTessellationTests.cpp index 73e2cf3..27d945c 100644 --- a/modules/gles31/functional/es31fTessellationTests.cpp +++ b/modules/gles31/functional/es31fTessellationTests.cpp @@ -1074,7 +1074,7 @@ static void drawTessCoordVisualization (tcu::Surface& dst, TessPrimitiveType pri tcu::clear(dst.getAccess(), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f)); for (int i = 0; i < (int)coords.size(); i++) - drawTessCoordPoint(dst, primitiveType, coords[i], tcu::RGBA::white, 2); + drawTessCoordPoint(dst, primitiveType, coords[i], tcu::RGBA::white(), 2); } static int binarySearchFirstVec3WithXAtLeast (const vector& sorted, float x) @@ -1171,9 +1171,9 @@ static bool compareTessCoords (TestLog& log, TessPrimitiveType primitiveType, co drawTessCoordVisualization(resVisual, primitiveType, resCoords); // Check that all points in reference also exist in result. - success = oneWayComparePointSets(log, refVisual, primitiveType, refCoords, resCoords, "reference", "result", tcu::RGBA::blue) && success; + success = oneWayComparePointSets(log, refVisual, primitiveType, refCoords, resCoords, "reference", "result", tcu::RGBA::blue()) && success; // Check that all points in result also exist in reference. - success = oneWayComparePointSets(log, resVisual, primitiveType, resCoords, refCoords, "result", "reference", tcu::RGBA::red) && success; + success = oneWayComparePointSets(log, resVisual, primitiveType, resCoords, refCoords, "result", "reference", tcu::RGBA::red()) && success; if (!success) { @@ -2797,8 +2797,8 @@ WindingCase::IterateResult WindingCase::iterate (void) for (int y = 0; y < rendered.getHeight(); y++) for (int x = 0; x < rendered.getWidth(); x++) { - numWhitePixels += rendered.getPixel(x, y) == tcu::RGBA::white ? 1 : 0; - numRedPixels += rendered.getPixel(x, y) == tcu::RGBA::red ? 1 : 0; + numWhitePixels += rendered.getPixel(x, y) == tcu::RGBA::white() ? 1 : 0; + numRedPixels += rendered.getPixel(x, y) == tcu::RGBA::red() ? 1 : 0; } DE_ASSERT(numWhitePixels + numRedPixels <= totalNumPixels); @@ -3277,7 +3277,7 @@ PerPatchDataCase::IterateResult PerPatchDataCase::iterate (void) for (int y = 0; y < rendered.getHeight(); y++) for (int x = 0; x < rendered.getWidth(); x++) { - if (rendered.getPixel(x, y) != tcu::RGBA::white) + if (rendered.getPixel(x, y) != tcu::RGBA::white()) { log << TestLog::Message << "Failure: expected all white pixels" << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Image verification failed"); @@ -5415,12 +5415,12 @@ PrimitiveDiscardCase::IterateResult PrimitiveDiscardCase::iterate (void) if (isMSAA) { - if (pixels.getPixel(x, y) != tcu::RGBA::black) + if (pixels.getPixel(x, y) != tcu::RGBA::black()) pixelOk = true; } else { - if (pixels.getPixel(x, y) == tcu::RGBA::white) + if (pixels.getPixel(x, y) == tcu::RGBA::white()) pixelOk = true; } } @@ -5444,7 +5444,7 @@ PrimitiveDiscardCase::IterateResult PrimitiveDiscardCase::iterate (void) { if (y > lastWhitePixelRow || (y > secondToLastWhitePixelRow && x > lastWhitePixelColumnOnSecondToLastWhitePixelRow)) { - if (pixels.getPixel(x, y) != tcu::RGBA::black) + if (pixels.getPixel(x, y) != tcu::RGBA::black()) { log << TestLog::Message << "Failure: expected all pixels to be black in the area " << (lastWhitePixelColumnOnSecondToLastWhitePixelRow < pixels.getWidth()-1 diff --git a/modules/gles31/functional/es31fTextureBorderClampTests.cpp b/modules/gles31/functional/es31fTextureBorderClampTests.cpp index 742324b..66daaf4 100644 --- a/modules/gles31/functional/es31fTextureBorderClampTests.cpp +++ b/modules/gles31/functional/es31fTextureBorderClampTests.cpp @@ -1117,7 +1117,7 @@ bool TextureBorderClampTest::verifyTextureGatherResult (const tcu::ConstPixelBuf tcu::Surface errorMask (renderedFrame.getWidth(), renderedFrame.getHeight()); int numFailedPixels = 0; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); for (int py = 0; py < reference.getHeight(); ++py) for (int px = 0; px < reference.getWidth(); ++px) @@ -1137,7 +1137,7 @@ bool TextureBorderClampTest::verifyTextureGatherResult (const tcu::ConstPixelBuf { if (!tcu::isGatherOffsetsResultValid(effectiveView, samplerParams.sampler, lookupPrecision, texCoord, 0, glu::getDefaultGatherOffsets(), resultValue)) { - errorMask.setPixel(px, py, tcu::RGBA::red); + errorMask.setPixel(px, py, tcu::RGBA::red()); ++numFailedPixels; } } @@ -1182,7 +1182,7 @@ bool TextureBorderClampTest::verifyTextureGatherCmpResult (const tcu::ConstPixel int numFailedPixels = 0; bool lowQuality = false; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); for (int py = 0; py < reference.getHeight(); ++py) for (int px = 0; px < reference.getWidth(); ++px) @@ -1204,7 +1204,7 @@ bool TextureBorderClampTest::verifyTextureGatherCmpResult (const tcu::ConstPixel // fall back to low quality verification if (!tcu::isGatherOffsetsCompareResultValid(effectiveView, samplerParams.sampler, lowQualityTexComparePrecision, texCoord, glu::getDefaultGatherOffsets(), refZ, resultValue)) { - errorMask.setPixel(px, py, tcu::RGBA::red); + errorMask.setPixel(px, py, tcu::RGBA::red()); ++numFailedPixels; } } diff --git a/modules/gles31/functional/es31fTextureGatherTests.cpp b/modules/gles31/functional/es31fTextureGatherTests.cpp index 1eecc83..128b75a 100644 --- a/modules/gles31/functional/es31fTextureGatherTests.cpp +++ b/modules/gles31/functional/es31fTextureGatherTests.cpp @@ -587,7 +587,7 @@ static bool verifyGatherOffsets (TestLog& log, tcu::Surface errorMask (width, height); bool success = true; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); for (int py = 0; py < height; py++) for (int px = 0; px < width; px++) @@ -608,7 +608,7 @@ static bool verifyGatherOffsets (TestLog& log, { if (!isGatherOffsetsResultValid(texture, sampler, lookupPrec, texCoord, componentNdx, offsets, resultPix)) { - errorMask.setPixel(px, py, tcu::RGBA::red); + errorMask.setPixel(px, py, tcu::RGBA::red()); success = false; } } @@ -665,7 +665,7 @@ static bool verifyGatherOffsetsCompare (TestLog& log, tcu::Surface errorMask (width, height); bool success = true; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); for (int py = 0; py < height; py++) for (int px = 0; px < width; px++) @@ -685,7 +685,7 @@ static bool verifyGatherOffsetsCompare (TestLog& log, { if (!isGatherOffsetsCompareResultValid(texture, sampler, compPrec, texCoord, offsets, refZ, resultPix)) { - errorMask.setPixel(px, py, tcu::RGBA::red); + errorMask.setPixel(px, py, tcu::RGBA::red()); success = false; } } @@ -714,7 +714,7 @@ static bool verifySingleColored (TestLog& log, const ConstPixelBufferAccess& res tcu::Surface errorMask (width, height); bool success = true; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); tcu::clear(idealAccess, refColor); for (int py = 0; py < height; py++) @@ -722,7 +722,7 @@ static bool verifySingleColored (TestLog& log, const ConstPixelBufferAccess& res { if (result.getPixel(px, py) != refColor) { - errorMask.setPixel(px, py, tcu::RGBA::red); + errorMask.setPixel(px, py, tcu::RGBA::red()); success = false; } } diff --git a/modules/gles31/functional/es31fTextureMultisampleTests.cpp b/modules/gles31/functional/es31fTextureMultisampleTests.cpp index 1bdf3e4..88bede3 100644 --- a/modules/gles31/functional/es31fTextureMultisampleTests.cpp +++ b/modules/gles31/functional/es31fTextureMultisampleTests.cpp @@ -934,7 +934,7 @@ bool SampleMaskCase::verifyTexture (int sample) tcu::Surface errorMask (m_canvasSize, m_canvasSize); bool error = false; - tcu::clear(errorMask.getAccess(), tcu::RGBA::green.toVec()); + tcu::clear(errorMask.getAccess(), tcu::RGBA::green().toVec()); // Draw sample: // Sample sampleNdx is set to red channel @@ -954,13 +954,13 @@ bool SampleMaskCase::verifyTexture (int sample) if (color.getGreen() != 0) { error = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } // enabled sample was not written to else if (color.getRed() != 255 && !allowMissingCoverage) { error = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } diff --git a/modules/gles31/stress/es31sTessellationGeometryInteractionTests.cpp b/modules/gles31/stress/es31sTessellationGeometryInteractionTests.cpp index 9165ef5..2269522 100644 --- a/modules/gles31/stress/es31sTessellationGeometryInteractionTests.cpp +++ b/modules/gles31/stress/es31sTessellationGeometryInteractionTests.cpp @@ -394,7 +394,7 @@ bool GridRenderCase::verifyResultLayer (int layerNdx, const tcu::Surface& image) // Color must be a linear combination of green and yellow if (color.getGreen() < 255 - threshold || color.getBlue() > threshold) { - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); foundError = true; } } diff --git a/modules/glshared/glsRasterizationTestUtil.cpp b/modules/glshared/glsRasterizationTestUtil.cpp index 6088888..b55df3b 100644 --- a/modules/glshared/glsRasterizationTestUtil.cpp +++ b/modules/glshared/glsRasterizationTestUtil.cpp @@ -1124,7 +1124,7 @@ bool verifySinglesampleLineGroupRasterization (const tcu::Surface& surface, cons for (int x = 0; x < referenceLineMap.getWidth(); ++x) { const bool reference = referenceLineMap.getAccess().getPixelInt(x, y).x() != 0; - const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits); + const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits); if (reference) ++referenceFragments; @@ -1149,14 +1149,14 @@ bool verifySinglesampleLineGroupRasterization (const tcu::Surface& surface, cons for (int dy = -1; dy < 2 && !foundFragment; ++dy) for (int dx = -1; dx < 2 && !foundFragment; ++dx) { - if (compareColors(surface.getPixel(x+dx, y+dy), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits)) + if (compareColors(surface.getPixel(x+dx, y+dy), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits)) foundFragment = true; } if (!foundFragment) { missingFragments = true; - errorMask.setPixel(x, y, tcu::RGBA::red); + errorMask.setPixel(x, y, tcu::RGBA::red()); } } } @@ -1201,7 +1201,7 @@ bool verifySinglesampleLineGroupRasterization (const tcu::Surface& surface, cons for (int y = 0; y < surface.getHeight(); ++y) for (int x = 0; x < surface.getWidth(); ++x) if (referenceLineMap.getAccess().getPixelInt(x, y).x()) - reference.setPixel(x, y, tcu::RGBA::white); + reference.setPixel(x, y, tcu::RGBA::white()); log << tcu::TestLog::Message << "Invalid fragment count in result image." << tcu::TestLog::EndMessage; log << tcu::TestLog::ImageSet("Verification result", "Result of rendering") @@ -1237,7 +1237,7 @@ bool verifySinglesampleLineGroupRasterization (const tcu::Surface& surface, cons for (int x = 1; x < referenceLineMap.getWidth() - 1; ++x) { - const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits); + const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits); int lineID = 0; // Which line does this fragment belong to? @@ -1318,7 +1318,7 @@ bool verifySinglesampleLineGroupRasterization (const tcu::Surface& surface, cons for (int y = 1; y < referenceLineMap.getHeight() - 1; ++y) { - const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white, args.redBits, args.greenBits, args.blueBits); + const bool result = compareColors(surface.getPixel(x, y), tcu::RGBA::white(), args.redBits, args.greenBits, args.blueBits); int lineID = 0; // Which line does this fragment belong to? @@ -1541,7 +1541,7 @@ bool verifyLineGroupPixelIndependentInterpolation (const tcu::Surface& surfac } // background color is possible? - if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black, args.redBits, args.greenBits, args.blueBits)) + if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black(), args.redBits, args.greenBits, args.blueBits)) continue; // Check those lines @@ -1865,7 +1865,7 @@ bool verifySinglesampleWideLineGroupInterpolation (const tcu::Surface& surface, } // background color is possible? - if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black, args.redBits, args.greenBits, args.blueBits)) + if (lineSurroundingCoverage == 0 && compareColors(color, tcu::RGBA::black(), args.redBits, args.greenBits, args.blueBits)) continue; // Check those lines diff --git a/modules/glshared/glsTextureTestUtil.cpp b/modules/glshared/glsTextureTestUtil.cpp index 452f3c9..7e7da21 100644 --- a/modules/glshared/glsTextureTestUtil.cpp +++ b/modules/glshared/glsTextureTestUtil.cpp @@ -1725,7 +1725,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -1779,7 +1779,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -1830,7 +1830,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -1889,7 +1889,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2023,7 +2023,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2(+1, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2105,7 +2105,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2197,7 +2197,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2276,7 +2276,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2364,7 +2364,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2419,7 +2419,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2473,7 +2473,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2533,7 +2533,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2670,7 +2670,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2(+1, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2753,7 +2753,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2840,7 +2840,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2852,7 +2852,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, // Other channels should trivially match to reference. if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold))) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; continue; } @@ -2904,7 +2904,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -2954,7 +2954,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -2966,7 +2966,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, // Other channels should trivially match to reference. if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold))) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; continue; } @@ -3026,7 +3026,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -3076,7 +3076,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, tcu::Vec2( 0, +1), }; - tcu::clear(errorMask, tcu::RGBA::green.toVec()); + tcu::clear(errorMask, tcu::RGBA::green().toVec()); for (int py = 0; py < result.getHeight(); py++) { @@ -3088,7 +3088,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, // Other channels should trivially match to reference. if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold))) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; continue; } @@ -3141,7 +3141,7 @@ int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result, if (!isOk) { - errorMask.setPixel(tcu::RGBA::red.toVec(), px, py); + errorMask.setPixel(tcu::RGBA::red().toVec(), px, py); numFailed += 1; } } @@ -3181,7 +3181,7 @@ static int compareGenMipmapBilinear (const tcu::ConstPixelBufferAccess& dst, con const float cy = (float(y)+0.5f) / dstH * srcH; const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result); - errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y); + errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y); if (!isOk) numFailed += 1; } @@ -3217,7 +3217,7 @@ static int compareGenMipmapBox (const tcu::ConstPixelBufferAccess& dst, const tc const float cy = deFloatFloor(float(y) / dstH * srcH) + 1.0f; const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result); - errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y); + errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y); if (!isOk) numFailed += 1; } @@ -3272,7 +3272,7 @@ static int compareGenMipmapVeryLenient (const tcu::ConstPixelBufferAccess& dst, isOk = boolAll(logicalAnd(lessThanEqual(minVal, result), lessThanEqual(result, maxVal))); - errorMask.setPixel(isOk ? tcu::RGBA::green.toVec() : tcu::RGBA::red.toVec(), x, y); + errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y); if (!isOk) numFailed += 1; } diff --git a/modules/glshared/glsUniformBlockCase.cpp b/modules/glshared/glsUniformBlockCase.cpp index fd272bf..e766c52 100644 --- a/modules/glshared/glsUniformBlockCase.cpp +++ b/modules/glshared/glsUniformBlockCase.cpp @@ -1933,7 +1933,7 @@ bool UniformBlockCase::render (deUint32 program) const { for (int x = 0; x < pixels.getWidth(); x++) { - if (pixels.getPixel(x, y) != tcu::RGBA::white) + if (pixels.getPixel(x, y) != tcu::RGBA::white()) numFailedPixels += 1; } }