From 737af9b128f3c1be3799196c56c94fd77741e7a1 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 15 Oct 2016 01:01:03 +0100 Subject: [PATCH] copy_and_blit.blit_image: loosen threshold of float/float blits In commit bd6f90c07f4bd0e0667ada50e134b479eeab78c5 : blit_image: compute validation threshold based on I/O formats We tried to introduce an error threshold for unorm/integer formats and removed all the precomputed thresholds for floating point formats. Also introducing a bug where the threshold was ceiled to 1.0 (making a lot of tests pass no matter the results). In commit 161314f0ff255dfe47e280dd4945292295dab1ed : copy_and_blit.blit_image: fix threshold computation We fixed the threshold to computation for unorm/integer formats but now all threshold would be computed on the assumption that the resolution of numbers is based of the number of bits in the fractional part of the number's representation (which is incorrect for floating point formats). This commit brings back the precomputed thresholds for floating point formats, while still computing a threshold based on the number of bits in the fractional part of the unorm formats. Affected tests: - dEQP-VK.api.copy_and_blit.blit_image.all_formats.*float*float* Change-Id: I52034a58d145a8e046fb33bcc6becb9e83774d73 --- .../vulkan/api/vktApiCopiesAndBlittingTests.cpp | 38 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp index c5b815b..9b79aef 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp @@ -1732,12 +1732,40 @@ static float calculateFloatConversionError (int srcBits) tcu::Vec4 getFormatThreshold (const tcu::TextureFormat& format) { - const tcu::IVec4 bits = tcu::getTextureFormatMantissaBitDepth(format); + tcu::Vec4 threshold(0.01f); - return tcu::Vec4(calculateFloatConversionError(bits.x()), - calculateFloatConversionError(bits.y()), - calculateFloatConversionError(bits.z()), - calculateFloatConversionError(bits.w())); + switch (format.type) + { + case tcu::TextureFormat::HALF_FLOAT: + threshold = tcu::Vec4(0.005f); + break; + + case tcu::TextureFormat::FLOAT: + case tcu::TextureFormat::FLOAT64: + threshold = tcu::Vec4(0.001f); + break; + + case tcu::TextureFormat::UNSIGNED_INT_11F_11F_10F_REV: + threshold = tcu::Vec4(0.02f, 0.02f, 0.0625f, 1.0f); + break; + + case tcu::TextureFormat::UNSIGNED_INT_999_E5_REV: + threshold = tcu::Vec4(0.05f, 0.05f, 0.05f, 1.0f); + break; + + default: + const tcu::IVec4 bits = tcu::getTextureFormatMantissaBitDepth(format); + threshold = tcu::Vec4(calculateFloatConversionError(bits.x()), + calculateFloatConversionError(bits.y()), + calculateFloatConversionError(bits.z()), + calculateFloatConversionError(bits.w())); + } + + // Return value matching the channel order specified by the format + if (format.order == tcu::TextureFormat::BGR || format.order == tcu::TextureFormat::BGRA) + return threshold.swizzle(2, 1, 0, 3); + else + return threshold; } bool BlittingImages::checkClampedAndUnclampedResult(const tcu::ConstPixelBufferAccess& result, -- 2.7.4