From 16aedc98f218344449fd683126f4f323e820ae87 Mon Sep 17 00:00:00 2001 From: sriharsha Date: Wed, 29 May 2019 10:32:22 +0530 Subject: [PATCH] Increase tolearance for dithering tests For small dimension render targets, gradient tests require more tolerance, as variance in adjacent pixels will be more compared to bigger render targets. Cherry pick from AOSP. Original commit: https://android.googlesource.com/platform/external/deqp/+/8dc015fa12e41a380b81c1b8fcc63a04bf34311a https://android-review.googlesource.com/c/platform/external/deqp/+/971506 Submitted on behalf of a third-party: quic_spvasu@quicinc.com Components: OpenGL Affected tests: dEQP-GLES3.functional.dither.* Bug: 132146940 Change-Id: Ie48e119d164acf5763aa7956c3ff91da20ff9f38 --- modules/gles3/functional/es3fDitheringTests.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/gles3/functional/es3fDitheringTests.cpp b/modules/gles3/functional/es3fDitheringTests.cpp index 5e52d9e4e..a677f221a 100644 --- a/modules/gles3/functional/es3fDitheringTests.cpp +++ b/modules/gles3/functional/es3fDitheringTests.cpp @@ -105,7 +105,7 @@ public: static const char* getPatternTypeName (PatternType type); private: - bool checkColor (const tcu::Vec4& inputClr, const tcu::RGBA& renderedClr, bool logErrors) const; + bool checkColor (const tcu::Vec4& inputClr, const tcu::RGBA& renderedClr, bool logErrors, const bool incTol) const; bool drawAndCheckGradient (bool isVerticallyIncreasing, const tcu::Vec4& highColor) const; bool drawAndCheckUnicoloredQuad (const tcu::Vec4& color) const; @@ -165,7 +165,7 @@ void DitheringCase::deinit (void) m_renderer = DE_NULL; } -bool DitheringCase::checkColor (const Vec4& inputClr, const tcu::RGBA& renderedClr, const bool logErrors) const +bool DitheringCase::checkColor (const Vec4& inputClr, const tcu::RGBA& renderedClr, const bool logErrors, const bool incTol) const { const IVec4 channelBits = pixelFormatToIVec4(m_renderFormat); bool allChannelsOk = true; @@ -182,6 +182,12 @@ bool DitheringCase::checkColor (const Vec4& inputClr, const tcu::RGBA& renderedC channelChoices.push_back(de::min(channelMax, (int)deFloatCeil(scaledInput))); channelChoices.push_back(de::max(0, (int)deFloatCeil(scaledInput) - 1)); + // Allow for more tolerance for small dimension render targets + if (incTol) + { + channelChoices.push_back(de::max(0,(int)deFloatCeil(scaledInput) - 2)); + channelChoices.push_back(de::max(0,(int)deFloatCeil(scaledInput) + 1)); + } // If the input color results in a scaled value that is very close to an integer, account for a little bit of possible inaccuracy. if (useRoundingMargin) @@ -288,8 +294,9 @@ bool DitheringCase::drawAndCheckGradient (const bool isVerticallyIncreasing, con { const float inputF = ((float)(isVerticallyIncreasing ? y : x) + 0.5f) / (float)(isVerticallyIncreasing ? renderedImg.getHeight() : renderedImg.getWidth()); const Vec4 inputClr = (1.0f-inputF)*quadClr0 + inputF*quadClr1; + const bool increaseTol = ((renderedImg.getWidth() < 300) || (renderedImg.getHeight() < 300)) ? true : false; - if (!checkColor(inputClr, renderedImg.getPixel(x, y), colorChoicesOk)) + if (!checkColor(inputClr, renderedImg.getPixel(x, y), colorChoicesOk, increaseTol)) { errorMask.setPixel(x, y, tcu::RGBA::red()); @@ -399,7 +406,7 @@ bool DitheringCase::drawAndCheckUnicoloredQuad (const Vec4& quadColor) const { for (int x = 0; x < renderedImg.getWidth(); x++) { - if (!checkColor(quadColor, renderedImg.getPixel(x, y), colorChoicesOk)) + if (!checkColor(quadColor, renderedImg.getPixel(x, y), colorChoicesOk, false)) { errorMask.setPixel(x, y, tcu::RGBA::red()); -- 2.34.1