copy_and_blit.blit_image: fix threshold computation
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 12 Oct 2016 18:03:31 +0000 (19:03 +0100)
committerPyry Haulos <phaulos@google.com>
Fri, 14 Oct 2016 20:40:41 +0000 (16:40 -0400)
Threshold should not be ceiled, affecting all blit tests with
floating point format as destination :

dEQP-VK.api.copy_and_blit.blit_image.all_formats.*sfloat*

Also use the source texture to get the source format.

Fixes #516

Change-Id: I4c49007070306d597e36f7b79ee969ef5081d19e

external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp

index 88986ef..c5b815b 100644 (file)
@@ -1722,7 +1722,7 @@ static float calculateFloatConversionError (int srcBits)
        {
                const int       clampedBits     = de::clamp<int>(srcBits, 0, 32);
                const float     srcMaxValue     = de::max((float)(1ULL<<clampedBits) - 1.0f, 1.0f);
-               const float     error           = deFloatCeil(1.0f / srcMaxValue);
+               const float     error           = 1.0f / srcMaxValue;
 
                return de::clamp<float>(error, 0.0f, 1.0f);
        }
@@ -1746,7 +1746,7 @@ bool BlittingImages::checkClampedAndUnclampedResult(const tcu::ConstPixelBufferA
 {
        tcu::TestLog&                           log                     (m_context.getTestContext().getLog());
        const bool                                      isLinear        = m_params.filter == VK_FILTER_LINEAR;
-       const tcu::TextureFormat        srcFormat       = clampedExpected.getFormat();
+       const tcu::TextureFormat        srcFormat       = m_sourceTextureLevel->getFormat();
        const tcu::TextureFormat        dstFormat       = result.getFormat();
        bool                                            isOk            = false;