Loosen threshold in Texture3D tests
authorYabin Zheng <yabin.zheng@arm.com>
Tue, 22 May 2018 03:02:27 +0000 (11:02 +0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 18 Jul 2018 07:05:20 +0000 (03:05 -0400)
The verification function should consider both src and dst formats
when computing allowed error threshold.

Components: OpenGL

Affects:
KHR-GLES2.texture_3d.sub_image.*

VK-GL-CTS issue: 1243

Change-Id: Ie53aed63724aa75a0da697e30e7625a309acf76b

external/openglcts/modules/gles2/es2cTexture3DTests.cpp

index 32a0851..0560212 100644 (file)
@@ -195,8 +195,12 @@ void Texture3DBase::verifyTestResult(const float* texCoords, const tcu::Surface&
                                                                         const ReferenceParams& refParams, bool isNearestOnly) const
 {
        const tcu::PixelFormat pixelFormat = m_context.getRenderTarget().getPixelFormat();
-       const tcu::IVec4           colorBits   = max(getBitsVec(pixelFormat) - (isNearestOnly ? 1 : 2),
-                                                                        tcu::IVec4(0)); // 1 inaccurate bit if nearest only, 2 otherwise
+       const tcu::IVec4    refChannelBitDepth  = tcu::getTextureFormatBitDepth(reference.getFormat());
+       const tcu::IVec4    colorBits = max(tcu::IVec4(de::min(pixelFormat.redBits, refChannelBitDepth[0]),
+                                               de::min(pixelFormat.greenBits, refChannelBitDepth[1]),
+                                               de::min(pixelFormat.blueBits, refChannelBitDepth[2]),
+                                               de::min(pixelFormat.alphaBits, refChannelBitDepth[3])) - (isNearestOnly ? 1 : 2),
+                                               tcu::IVec4(0)); // 1 inaccurate bit if nearest only, 2 otherwise
        tcu::LodPrecision       lodPrecision(18, 6);
        tcu::LookupPrecision lookupPrecision;
        lookupPrecision.colorThreshold = tcu::computeFixedPointThreshold(colorBits) / refParams.colorScale;