ShaderRenderDerivateTests: fix threshold calculation.
authorAkos Dirner <adirner.uszeged@partner.samsung.com>
Thu, 23 Jun 2016 12:14:23 +0000 (14:14 +0200)
committerAkos Dirner <adirner.uszeged@partner.samsung.com>
Thu, 23 Jun 2016 12:14:23 +0000 (14:14 +0200)
external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp

index bb0732a..6f706f6 100644 (file)
@@ -974,11 +974,14 @@ bool LinearDerivateCaseInstance::verify (const tcu::ConstPixelBufferAccess& resu
                const bool                      isX                     = isDfdxFunc(m_definitions.func);
                const float                     div                     = isX ? float(result.getWidth()) : float(result.getHeight());
                const tcu::Vec4         scale           = isX ? xScale : yScale;
-               const tcu::Vec4         reference       = ((m_values.coordMax - m_values.coordMin) / div) * scale;
-               const tcu::Vec4         opThreshold     = getDerivateThreshold(m_definitions.precision, m_values.coordMin*scale, m_values.coordMax*scale, reference);
+               tcu::Vec4                       reference       = ((m_values.coordMax - m_values.coordMin) / div);
+               const tcu::Vec4         opThreshold     = getDerivateThreshold(m_definitions.precision, m_values.coordMin, m_values.coordMax, reference);
                const tcu::Vec4         threshold       = max(surfaceThreshold, opThreshold);
                const int                       numComps        = glu::getDataTypeFloatScalars(m_definitions.dataType);
 
+               /* adjust the reference value for the correct dfdx or dfdy sample adjacency */
+               reference = reference * scale;
+
                m_context.getTestContext().getLog()
                        << tcu::TestLog::Message
                        << "Verifying result image.\n"
@@ -1265,11 +1268,14 @@ bool TextureDerivateCaseInstance::verify (const tcu::ConstPixelBufferAccess& res
                const bool                      isX                     = isDfdxFunc(m_definitions.func);
                const float                     div                     = isX ? w : h;
                const tcu::Vec4         scale           = isX ? xScale : yScale;
-               const tcu::Vec4         reference       = ((m_textureValues.texValueMax - m_textureValues.texValueMin) / div) * scale;
-               const tcu::Vec4         opThreshold     = getDerivateThreshold(m_definitions.precision, m_textureValues.texValueMin*scale, m_textureValues.texValueMax*scale, reference);
+               tcu::Vec4                       reference       = ((m_textureValues.texValueMax - m_textureValues.texValueMin) / div);
+               const tcu::Vec4         opThreshold     = getDerivateThreshold(m_definitions.precision, m_textureValues.texValueMin, m_textureValues.texValueMax, reference);
                const tcu::Vec4         threshold       = max(surfaceThreshold, opThreshold);
                const int                       numComps        = glu::getDataTypeFloatScalars(m_definitions.dataType);
 
+               /* adjust the reference value for the correct dfdx or dfdy sample adjacency */
+               reference = reference * scale;
+
                m_context.getTestContext().getLog()
                        << tcu::TestLog::Message
                        << "Verifying result image.\n"