#include "tcuVectorUtil.hpp"
#include "deSharedPtr.hpp"
+#include <cmath>
#include <memory>
namespace vkt
virtual tcu::TestStatus iterate (void) override;
protected:
+ tcu::IVec4 computeColorDistance () const;
bool verifyPixels (const tcu::PixelBufferAccess& rendered,
const tcu::PixelBufferAccess& reference,
const ReferenceParams& samplerParams,
tcu::Texture2D m_swTexture;
TextureRenderer m_renderer;
+ const tcu::IVec4 m_cd;
const tcu::IVec4 m_a;
const tcu::IVec4 m_b;
const tcu::IVec4 m_c;
, m_hwTexture (TestTexture2DSp(new pipeline::TestTexture2D(m_inFormat, textureWidth, textureHeight)))
, m_swTexture (m_inFormat, textureWidth, textureHeight, 1)
, m_renderer (context, VK_SAMPLE_COUNT_1_BIT, m_params->width, m_params->height, 1u, makeComponentMappingRGBA(), VK_IMAGE_TYPE_2D, VK_IMAGE_VIEW_TYPE_2D, m_outFormat)
- , m_a (lim(m_inFormat, 0), lim(m_inFormat, 1)+2, lim(m_inFormat, 2), lim(m_inFormat, 3)+2)
- , m_b (lim(m_inFormat, 0)+2, lim(m_inFormat, 1), lim(m_inFormat, 2)+2, lim(m_inFormat, 3) )
- , m_c (lim(m_inFormat, 0)+1, lim(m_inFormat, 1)+1, lim(m_inFormat, 2)+1, lim(m_inFormat, 3)+1)
- , m_d (lim(m_inFormat, 0), lim(m_inFormat, 1), lim(m_inFormat, 2), lim(m_inFormat, 3) )
+ , m_cd (computeColorDistance())
+ , m_a (lim(m_inFormat, 0), lim(m_inFormat, 1)+m_cd[1]*2, lim(m_inFormat, 2), lim(m_inFormat, 3)+m_cd[3]*2)
+ , m_b (lim(m_inFormat, 0)+m_cd[0]*2, lim(m_inFormat, 1), lim(m_inFormat, 2)+m_cd[2]*2, lim(m_inFormat, 3) )
+ , m_c (lim(m_inFormat, 0)+m_cd[0]*1, lim(m_inFormat, 1)+m_cd[1]*1, lim(m_inFormat, 2)+m_cd[2]*1, lim(m_inFormat, 3)+m_cd[3]*1)
+ , m_d (lim(m_inFormat, 0), lim(m_inFormat, 1), lim(m_inFormat, 2), lim(m_inFormat, 3) )
{
tcu::IVec4 data[textureWidth * textureHeight] =
{
return channelBits[channelIdx] ? (-deIntMaxValue32(channelBits[channelIdx])) : (-1);
}
+tcu::IVec4 SnormLinearClampInstance::computeColorDistance () const
+{
+ return tcu::IVec4
+ (
+ static_cast<int>(std::floor(static_cast<float>(-lim(m_inFormat, 0)) / 127.0f)),
+ static_cast<int>(std::floor(static_cast<float>(-lim(m_inFormat, 0)) / 127.0f)),
+ static_cast<int>(std::floor(static_cast<float>(-lim(m_inFormat, 0)) / 127.0f)),
+ static_cast<int>(std::floor(static_cast<float>(-lim(m_inFormat, 0)) / 127.0f))
+ );
+}
+
bool SnormLinearClampInstance::verifyPixels (const tcu::PixelBufferAccess& rendered, const tcu::PixelBufferAccess& reference, const ReferenceParams& samplerParams, const std::vector<float>& texCoords) const
{
tcu::LodPrecision lodPrec;
const int width (m_renderer.getRenderWidth());
const int height (m_renderer.getRenderHeight());
+ const tcu::IVec4 colorDistance (computeColorDistance());
std::unique_ptr<deUint8[]> errorMaskData (new deUint8[width * height * 4 * 4]);
tcu::PixelBufferAccess errorMask (mapVkFormat(m_outFormat), width, height, 1, errorMaskData.get());
lookupPrec.uvwBits = tcu::IVec3(5,5,0);
lookupPrec.coordBits = tcu::IVec3(20,20,0);
lookupPrec.colorMask = tcu::BVec4(nuc >= 1, nuc >= 2, nuc >=3, nuc >= 4);
- lookupPrec.colorThreshold = tcu::Vec4(0.9f/float(-lim(m_inFormat, 0)),
- 0.9f/float(-lim(m_inFormat, 1)),
- 0.9f/float(-lim(m_inFormat, 2)),
- 0.9f/float(-lim(m_inFormat, 3)));
+ lookupPrec.colorThreshold = tcu::Vec4(0.9f/float(colorDistance[0]),
+ 0.9f/float(colorDistance[1]),
+ 0.9f/float(colorDistance[2]),
+ 0.9f/float(colorDistance[3]));
const int numFailedPixels = glu::TextureTestUtil::computeTextureLookupDiff(rendered, reference, errorMask,
m_swTexture, texCoords.data(), samplerParams,