Lines Matching refs:tcu
51 SamplerType getSamplerType (tcu::TextureFormat format)
53 using tcu::TextureFormat;
77 SamplerType getFetchSamplerType (tcu::TextureFormat format)
79 using tcu::TextureFormat;
103 static tcu::Texture1DView getSubView (const tcu::Texture1DView& view, int baseLevel, int maxLevel, tcu::ImageViewMinLodParams* minLodParams DE_UNUSED_ATTR)
108 return tcu::Texture1DView(numLevels, view.getLevels()+clampedBase);
111 static tcu::Texture2DView getSubView (const tcu::Texture2DView& view, int baseLevel, int maxLevel, tcu::ImageViewMinLodParams* minLodParams = DE_NULL)
116 return tcu::Texture2DView(numLevels, view.getLevels()+clampedBase, view.isES2(), minLodParams);
119 static tcu::TextureCubeView getSubView (const tcu::TextureCubeView& view, int baseLevel, int maxLevel, tcu::ImageViewMinLodParams* minLodParams = DE_NULL)
124 const tcu::ConstPixelBufferAccess* levels[tcu::CUBEFACE_LAST];
126 for (int face = 0; face < tcu::CUBEFACE_LAST; face++)
127 levels[face] = view.getFaceLevels((tcu::CubeFace)face) + clampedBase;
129 return tcu::TextureCubeView(numLevels, levels, false, minLodParams);
132 static tcu::Texture3DView getSubView (const tcu::Texture3DView& view, int baseLevel, int maxLevel, tcu::ImageViewMinLodParams* minLodParams = DE_NULL)
137 return tcu::Texture3DView(numLevels, view.getLevels()+clampedBase, false, minLodParams);
140 static tcu::TextureCubeArrayView getSubView (const tcu::TextureCubeArrayView& view, int baseLevel, int maxLevel, tcu::ImageViewMinLodParams* minLodParams DE_UNUSED_ATTR = DE_NULL)
145 return tcu::TextureCubeArrayView(numLevels, view.getLevels()+clampedBase);
153 inline tcu::Vec4 linearInterpolate (float t, const tcu::Vec4& a, const tcu::Vec4& b)
158 inline float bilinearInterpolate (float x, float y, const tcu::Vec4& quad)
172 float triangleInterpolate (const tcu::Vec3& v, float x, float y)
198 float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, deInt32 srcSize, const tcu::Vec3& sq)
236 float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, const tcu::IVec2& srcSize, const tcu::Vec3& sq, const tcu::Vec3& tq)
277 float computeNonProjectedTriLod (LodMode mode, const tcu::IVec2& dstSize, const tcu::IVec3& srcSize, const tcu::Vec3& sq, const tcu::Vec3& tq, const tcu::Vec3& rq)
291 static inline float projectedTriInterpolate (const tcu::Vec3& s, const tcu::Vec3& w, float nx, float ny)
296 static inline float triDerivateX (const tcu::Vec3& s, const tcu::Vec3& w, float wx, float width, float ny)
302 static inline float triDerivateY (const tcu::Vec3& s, const tcu::Vec3& w, float wy, float height, float nx)
309 static float computeProjectedTriLod (LodMode mode, const tcu::Vec3& u, const tcu::Vec3& projection, float wx, float wy, float width, float height)
319 static float computeProjectedTriLod (LodMode mode, const tcu::Vec3& u, const tcu::Vec3& v, const tcu::Vec3& projection, float wx, float wy, float width, float height)
331 static float computeProjectedTriLod (LodMode mode, const tcu::Vec3& u, const tcu::Vec3& v, const tcu::Vec3& w, const tcu::Vec3& projection, float wx, float wy, float width, float height)
344 static inline tcu::Vec4 execSample (const tcu::Texture1DView& src, const ReferenceParams& params, float s, float lod)
347 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, lod), 0.0, 0.0, 1.0f);
352 static inline tcu::Vec4 execSample (const tcu::Texture2DView& src, const ReferenceParams& params, float s, float t, float lod)
355 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, t, lod), 0.0, 0.0, 1.0f);
360 static inline tcu::Vec4 execSample (const tcu::TextureCubeView& src, const ReferenceParams& params, float s, float t, float r, float lod)
363 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, t, r, lod), 0.0, 0.0, 1.0f);
368 static inline tcu::Vec4 execSample (const tcu::Texture2DArrayView& src, const ReferenceParams& params, float s, float t, float r, float lod)
371 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, t, r, lod), 0.0, 0.0, 1.0f);
376 static inline tcu::Vec4 execSample (const tcu::TextureCubeArrayView& src, const ReferenceParams& params, float s, float t, float r, float q, float lod)
379 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, t, r, q, lod), 0.0, 0.0, 1.0f);
384 static inline tcu::Vec4 execSample (const tcu::Texture1DArrayView& src, const ReferenceParams& params, float s, float t, float lod)
387 return tcu::Vec4(src.sampleCompare(params.sampler, params.ref, s, t, lod), 0.0, 0.0, 1.0f);
392 static void sampleTextureNonProjected (const tcu::SurfaceAccess& dst, const tcu::Texture1DView& rawSrc, const tcu::Vec4& sq, const ReferenceParams& params)
395 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
396 const tcu::Texture1DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
400 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
404 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
428 static void sampleTextureNonProjected (const PixelAccess& dst, const tcu::Texture2DView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const ReferenceParams& params)
431 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
432 tcu::Texture2DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
436 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
437 tcu::IVec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight());
440 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
441 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
465 s = tcu::Float16(s, tcu::ROUND_TO_ZERO).asFloat();
466 t = tcu::Float16(t, tcu::ROUND_TO_ZERO).asFloat();
474 static void sampleTextureProjected (const tcu::SurfaceAccess& dst, const tcu::Texture1DView& rawSrc, const tcu::Vec4& sq, const ReferenceParams& params)
477 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
478 const tcu::Texture1DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
484 tcu::Vec4 uq = sq * (float)src.getWidth();
486 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
487 tcu::Vec3 triU[2] = { uq.swizzle(0, 1, 2), uq.swizzle(3, 2, 1) };
488 tcu::Vec3 triW[2] = { params.w.swizzle(0, 1, 2), params.w.swizzle(3, 2, 1) };
515 static void sampleTextureProjected (const PixelAccess& dst, const tcu::Texture2DView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const ReferenceParams& params)
518 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
519 const tcu::Texture2DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
525 tcu::Vec4 uq = sq * (float)src.getWidth();
526 tcu::Vec4 vq = tq * (float)src.getHeight();
528 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
529 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
530 tcu::Vec3 triU[2] = { uq.swizzle(0, 1, 2), uq.swizzle(3, 2, 1) };
531 tcu::Vec3 triV[2] = { vq.swizzle(0, 1, 2), vq.swizzle(3, 2, 1) };
532 tcu::Vec3 triW[2] = { params.w.swizzle(0, 1, 2), params.w.swizzle(3, 2, 1) };
559 void sampleTexture (const tcu::PixelBufferAccess& dst, const tcu::Texture2DView& src, const float* texCoord, const ReferenceParams& params)
561 tcu::ImageViewMinLodParams minLodParams =
571 const tcu::Texture2DView view = getSubView(src, params.baseLevel, params.maxLevel, params.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL);
572 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
573 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
581 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::Texture2DView& src, const float* texCoord, const ReferenceParams& params)
583 tcu::ImageViewMinLodParams minLodParams =
593 const tcu::Texture2DView view = getSubView(src, params.baseLevel, params.maxLevel, params.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL);
594 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
595 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
603 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::Texture1DView& src, const float* texCoord, const ReferenceParams& params)
605 const tcu::Texture1DView view = getSubView(src, params.baseLevel, params.maxLevel, DE_NULL);
606 const tcu::Vec4 sq = tcu::Vec4(texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
614 static float computeCubeLodFromDerivates (LodMode lodMode, const tcu::Vec3& coord, const tcu::Vec3& coordDx, const tcu::Vec3& coordDy, const int faceSize)
616 const tcu::CubeFace face = tcu::selectCubeFace(coord);
624 case tcu::CUBEFACE_NEGATIVE_X:
625 case tcu::CUBEFACE_POSITIVE_X: maNdx = 0; sNdx = 2; tNdx = 1; break;
626 case tcu::CUBEFACE_NEGATIVE_Y:
627 case tcu::CUBEFACE_POSITIVE_Y: maNdx = 1; sNdx = 0; tNdx = 2; break;
628 case tcu::CUBEFACE_NEGATIVE_Z:
629 case tcu::CUBEFACE_POSITIVE_Z: maNdx = 2; sNdx = 0; tNdx = 1; break;
653 static void sampleTextureCube (const tcu::SurfaceAccess& dst, const tcu::TextureCubeView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const tcu::Vec4& rq, const ReferenceParams& params)
656 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
657 const tcu::TextureCubeView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
659 const tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
665 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
666 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
667 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
668 const tcu::Vec3 triW[2] = { params.w.swizzle(0, 1, 2), params.w.swizzle(3, 2, 1) };
685 const tcu::Vec3 coord (triangleInterpolate(triS[triNdx], triNx, triNy),
688 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
691 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
702 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::TextureCubeView& src, const float* texCoord, const ReferenceParams& params)
704 tcu::ImageViewMinLodParams minLodParams =
714 const tcu::TextureCubeView view = getSubView(src, params.baseLevel, params.maxLevel, params.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL);
715 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
716 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
717 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
722 static void sampleTextureNonProjected (const tcu::SurfaceAccess& dst, const tcu::Texture2DArrayView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const tcu::Vec4& rq, const ReferenceParams& params)
725 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
726 const tcu::Texture2DArrayView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
730 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
731 tcu::IVec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight());
734 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
735 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
736 tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
761 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::Texture2DArrayView& src, const float* texCoord, const ReferenceParams& params)
763 tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
764 tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
765 tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
771 static void sampleTextureNonProjected (const tcu::SurfaceAccess& dst, const tcu::Texture1DArrayView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const ReferenceParams& params)
774 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
775 const tcu::Texture1DArrayView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
779 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
783 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
784 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
808 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::Texture1DArrayView& src, const float* texCoord, const ReferenceParams& params)
810 tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
811 tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
817 static void sampleTextureNonProjected (const tcu::SurfaceAccess& dst, const tcu::Texture3DView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const tcu::Vec4& rq, const ReferenceParams& params)
820 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
821 const tcu::Texture3DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
825 tcu::IVec2 dstSize = tcu::IVec2(dst.getWidth(), dst.getHeight());
826 tcu::IVec3 srcSize = tcu::IVec3(src.getWidth(), src.getHeight(), src.getDepth());
829 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
830 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
831 tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
859 static void sampleTextureProjected (const tcu::SurfaceAccess& dst, const tcu::Texture3DView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const tcu::Vec4& rq, const ReferenceParams& params)
862 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
863 const tcu::Texture3DView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
869 tcu::Vec4 uq = sq * (float)src.getWidth();
870 tcu::Vec4 vq = tq * (float)src.getHeight();
871 tcu::Vec4 wq = rq * (float)src.getDepth();
873 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
874 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
875 tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
876 tcu::Vec3 triU[2] = { uq.swizzle(0, 1, 2), uq.swizzle(3, 2, 1) };
877 tcu::Vec3 triV[2] = { vq.swizzle(0, 1, 2), vq.swizzle(3, 2, 1) };
878 tcu::Vec3 triW[2] = { wq.swizzle(0, 1, 2), wq.swizzle(3, 2, 1) };
879 tcu::Vec3 triP[2] = { params.w.swizzle(0, 1, 2), params.w.swizzle(3, 2, 1) };
907 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::Texture3DView& src, const float* texCoord, const ReferenceParams& params)
909 tcu::ImageViewMinLodParams minLodParams =
919 const tcu::Texture3DView view = getSubView(src, params.baseLevel, params.maxLevel, params.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL);
920 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
921 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
922 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
930 static void sampleTextureCubeArray (const tcu::SurfaceAccess& dst, const tcu::TextureCubeArrayView& rawSrc, const tcu::Vec4& sq, const tcu::Vec4& tq, const tcu::Vec4& rq, const tcu::Vec4& qq, const ReferenceParams& params)
933 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
934 const tcu::TextureCubeArrayView src = getEffectiveTextureView(rawSrc, srcLevelStorage, params.sampler);
940 tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
941 tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
942 tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
943 tcu::Vec3 triQ[2] = { qq.swizzle(0, 1, 2), qq.swizzle(3, 2, 1) };
944 const tcu::Vec3 triW[2] = { params.w.swizzle(0, 1, 2), params.w.swizzle(3, 2, 1) };
961 const tcu::Vec3 coord (triangleInterpolate(triS[triNdx], triNx, triNy),
967 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
970 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
981 void sampleTexture (const tcu::SurfaceAccess& dst, const tcu::TextureCubeArrayView& src, const float* texCoord, const ReferenceParams& params)
983 tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[4+0], texCoord[8+0], texCoord[12+0]);
984 tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[4+1], texCoord[8+1], texCoord[12+1]);
985 tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[4+2], texCoord[8+2], texCoord[12+2]);
986 tcu::Vec4 qq = tcu::Vec4(texCoord[0+3], texCoord[4+3], texCoord[8+3], texCoord[12+3]);
991 void fetchTexture (const tcu::SurfaceAccess& dst, const tcu::ConstPixelBufferAccess& src, const float* texCoord, const tcu::Vec4& colorScale, const tcu::Vec4& colorBias)
993 const tcu::Vec4 sq = tcu::Vec4(texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
994 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
1014 bool compareImages (tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& rendered, tcu::RGBA threshold)
1016 return tcu::pixelThresholdCompare(log, "Result", "Image comparison result", reference, rendered, threshold, tcu::COMPARE_LOG_RESULT);
1019 bool compareImages (tcu::TestLog& log, const char* name, const char* desc, const tcu::Surface& reference, const tcu::Surface& rendered, tcu::RGBA threshold)
1021 return tcu::pixelThresholdCompare(log, name, desc, reference, rendered, threshold, tcu::COMPARE_LOG_RESULT);
1024 int measureAccuracy (tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& rendered, int bestScoreDiff, int worstScoreDiff)
1026 return tcu::measurePixelDiffAccuracy(log, "Result", "Image comparison result", reference, rendered, bestScoreDiff, worstScoreDiff, tcu::COMPARE_LOG_EVERYTHING);
1039 inline tcu::RGBA rangeDiff (tcu::RGBA p, tcu::RGBA a, tcu::RGBA b)
1050 return tcu::RGBA(rangeDiff(p.getRed(), rMin, rMax),
1056 inline bool rangeCompare (tcu::RGBA p, tcu::RGBA a, tcu::RGBA b, tcu::RGBA threshold)
1058 tcu::RGBA diff = rangeDiff(p, a, b);
1085 void computeQuadTexCoord2D (std::vector<float>& dst, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight)
1095 void computeQuadTexCoord2DArray (std::vector<float>& dst, int layerNdx, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight)
1105 void computeQuadTexCoord3D (std::vector<float>& dst, const tcu::Vec3& p0, const tcu::Vec3& p1, const tcu::IVec3& dirSwz)
1107 tcu::Vec3 f0 = tcu::Vec3(0.0f, 0.0f, 0.0f).swizzle(dirSwz[0], dirSwz[1], dirSwz[2]);
1108 tcu::Vec3 f1 = tcu::Vec3(0.0f, 1.0f, 0.0f).swizzle(dirSwz[0], dirSwz[1], dirSwz[2]);
1109 tcu::Vec3 f2 = tcu::Vec3(1.0f, 0.0f, 0.0f).swizzle(dirSwz[0], dirSwz[1], dirSwz[2]);
1110 tcu::Vec3 f3 = tcu::Vec3(1.0f, 1.0f, 0.0f).swizzle(dirSwz[0], dirSwz[1], dirSwz[2]);
1112 tcu::Vec3 v0 = p0 + (p1-p0)*f0;
1113 tcu::Vec3 v1 = p0 + (p1-p0)*f1;
1114 tcu::Vec3 v2 = p0 + (p1-p0)*f2;
1115 tcu::Vec3 v3 = p0 + (p1-p0)*f3;
1125 void computeQuadTexCoordCube (std::vector<float>& dst, tcu::CubeFace face)
1175 case tcu::CUBEFACE_NEGATIVE_X: texCoord = texCoordNegX; break;
1176 case tcu::CUBEFACE_POSITIVE_X: texCoord = texCoordPosX; break;
1177 case tcu::CUBEFACE_NEGATIVE_Y: texCoord = texCoordNegY; break;
1178 case tcu::CUBEFACE_POSITIVE_Y: texCoord = texCoordPosY; break;
1179 case tcu::CUBEFACE_NEGATIVE_Z: texCoord = texCoordNegZ; break;
1180 case tcu::CUBEFACE_POSITIVE_Z: texCoord = texCoordPosZ; break;
1190 void computeQuadTexCoordCube (std::vector<float>& dst, tcu::CubeFace face, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight)
1201 case tcu::CUBEFACE_NEGATIVE_X: mRow = 0; sRow = 2; tRow = 1; mSign = -1.0f; tSign = -1.0f; break;
1202 case tcu::CUBEFACE_POSITIVE_X: mRow = 0; sRow = 2; tRow = 1; sSign = -1.0f; tSign = -1.0f; break;
1203 case tcu::CUBEFACE_NEGATIVE_Y: mRow = 1; sRow = 0; tRow = 2; mSign = -1.0f; tSign = -1.0f; break;
1204 case tcu::CUBEFACE_POSITIVE_Y: mRow = 1; sRow = 0; tRow = 2; break;
1205 case tcu::CUBEFACE_NEGATIVE_Z: mRow = 2; sRow = 0; tRow = 1; mSign = -1.0f; sSign = -1.0f; tSign = -1.0f; break;
1206 case tcu::CUBEFACE_POSITIVE_Z: mRow = 2; sRow = 0; tRow = 1; tSign = -1.0f; break;
1230 void computeQuadTexCoordCubeArray (std::vector<float>& dst, tcu::CubeFace face, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight, const tcu::Vec2& layerRange)
1244 case tcu::CUBEFACE_NEGATIVE_X: mRow = 0; sRow = 2; tRow = 1; mSign = -1.0f; tSign = -1.0f; break;
1245 case tcu::CUBEFACE_POSITIVE_X: mRow = 0; sRow = 2; tRow = 1; sSign = -1.0f; tSign = -1.0f; break;
1246 case tcu::CUBEFACE_NEGATIVE_Y: mRow = 1; sRow = 0; tRow = 2; mSign = -1.0f; tSign = -1.0f; break;
1247 case tcu::CUBEFACE_POSITIVE_Y: mRow = 1; sRow = 0; tRow = 2; break;
1248 case tcu::CUBEFACE_NEGATIVE_Z: mRow = 2; sRow = 0; tRow = 1; mSign = -1.0f; sSign = -1.0f; tSign = -1.0f; break;
1249 case tcu::CUBEFACE_POSITIVE_Z: mRow = 2; sRow = 0; tRow = 1; tSign = -1.0f; break;
1291 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
1292 const tcu::ConstPixelBufferAccess& reference,
1293 const tcu::PixelBufferAccess& errorMask,
1294 const tcu::Texture1DView& baseView,
1297 const tcu::LookupPrecision& lookupPrec,
1298 const tcu::LodPrecision& lodPrec,
1304 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
1305 const tcu::Texture1DView src = getEffectiveTextureView(getSubView(baseView, sampleParams.baseLevel, sampleParams.maxLevel, DE_NULL), srcLevelStorage, sampleParams.sampler);
1307 const tcu::Vec4 sq = tcu::Vec4(texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
1309 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
1315 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
1316 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
1318 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
1322 const tcu::Vec2 lodOffsets[] =
1324 tcu::Vec2(-1, 0),
1325 tcu::Vec2(+1, 0),
1326 tcu::Vec2( 0, -1),
1327 tcu::Vec2( 0, +1),
1330 tcu::clear(errorMask, tcu::RGBA::green().toVec());
1340 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1341 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1344 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
1361 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx, coordDy, lodPrec);
1373 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo, coordDyo, lodPrec);
1379 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
1380 const bool isOk = tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix);
1384 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
1394 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
1395 const tcu::ConstPixelBufferAccess& reference,
1396 const tcu::PixelBufferAccess& errorMask,
1397 const tcu::Texture2DView& baseView,
1400 const tcu::LookupPrecision& lookupPrec,
1401 const tcu::LodPrecision& lodPrec,
1407 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
1408 tcu::ImageViewMinLodParams minLodParams =
1418 const tcu::Texture2DView view = getSubView(baseView, sampleParams.baseLevel, sampleParams.maxLevel, sampleParams.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL);
1420 const tcu::Texture2DView src = getEffectiveTextureView(view, srcLevelStorage, sampleParams.sampler);
1422 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
1423 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
1425 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
1428 const tcu::IVec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight());
1431 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
1432 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
1433 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
1435 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
1441 const float imageViewMinLodRelMode = tcu::isSamplerMipmapModeLinear(sampleParams.sampler.minFilter) ? deFloatFloor(imageViewMinLodRel) : (float)deClamp32((int)deFloatCeil(imageViewMinLodRel + 0.5f) - 1, sampleParams.baseLevel, sampleParams.maxLevel);
1448 const tcu::Vec2 lodOffsets[] =
1450 tcu::Vec2(-1, 0),
1451 tcu::Vec2(+1, 0),
1452 tcu::Vec2( 0, -1),
1453 tcu::Vec2( 0, +1),
1456 tcu::clear(errorMask, tcu::RGBA::green().toVec());
1466 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1467 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1470 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
1492 const tcu::Vec2 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
1494 const tcu::Vec2 coordDx = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
1496 const tcu::Vec2 coordDy = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
1499 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx.x(), coordDx.y(), coordDy.x(), coordDy.y(), lodPrec);
1509 const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
1511 const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
1513 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo.x(), coordDxo.y(), coordDyo.x(), coordDyo.y(), lodPrec);
1519 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(minLod, sampleParams.maxLod), lodPrec);
1520 if (tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix))
1529 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
1539 bool verifyTextureResult (tcu::TestContext& testCtx,
1540 const tcu::ConstPixelBufferAccess& result,
1541 const tcu::Texture1DView& src,
1544 const tcu::LookupPrecision& lookupPrec,
1545 const tcu::LodPrecision& lodPrec,
1546 const tcu::PixelFormat& pixelFormat)
1548 tcu::TestLog& log = testCtx.getLog();
1549 tcu::Surface reference (result.getWidth(), result.getHeight());
1550 tcu::Surface errorMask (result.getWidth(), result.getHeight());
1555 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
1559 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
1561 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
1562 << tcu::TestLog::Image("Rendered", "Rendered image", result);
1566 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
1567 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
1570 log << tcu::TestLog::EndImageSet;
1575 bool verifyTextureResult (tcu::TestContext& testCtx,
1576 const tcu::ConstPixelBufferAccess& result,
1577 const tcu::Texture2DView& src,
1580 const tcu::LookupPrecision& lookupPrec,
1581 const tcu::LodPrecision& lodPrec,
1582 const tcu::PixelFormat& pixelFormat)
1584 tcu::TestLog& log = testCtx.getLog();
1585 tcu::Surface reference (result.getWidth(), result.getHeight());
1586 tcu::Surface errorMask (result.getWidth(), result.getHeight());
1591 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
1595 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
1597 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
1598 << tcu::TestLog::Image("Rendered", "Rendered image", result);
1602 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
1603 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
1606 log << tcu::TestLog::EndImageSet;
1612 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
1613 const tcu::ConstPixelBufferAccess& reference,
1614 const tcu::PixelBufferAccess& errorMask,
1615 const tcu::TextureCubeView& baseView,
1618 const tcu::LookupPrecision& lookupPrec,
1619 const tcu::LodPrecision& lodPrec,
1625 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
1626 tcu::ImageViewMinLodParams minLodParams =
1636 const tcu::TextureCubeView src = getEffectiveTextureView(getSubView(baseView, sampleParams.baseLevel, sampleParams.maxLevel, sampleParams.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL), srcLevelStorage, sampleParams.sampler);
1638 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
1639 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
1640 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
1642 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
1648 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
1649 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
1650 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
1651 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
1653 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
1661 const float imageViewMinLodRelMode = tcu::isSamplerMipmapModeLinear(sampleParams.sampler.minFilter) ? deFloatFloor(imageViewMinLodRel) : (float)deClamp32((int)deFloatCeil(imageViewMinLodRel + 0.5f) - 1, sampleParams.baseLevel, sampleParams.maxLevel);
1666 const tcu::Vec2 lodOffsets[] =
1668 tcu::Vec2(-1, 0),
1669 tcu::Vec2(+1, 0),
1670 tcu::Vec2( 0, -1),
1671 tcu::Vec2( 0, +1),
1674 tcu::Vec2(-1, -1),
1675 tcu::Vec2(-1, +1),
1676 tcu::Vec2(+1, -1),
1677 tcu::Vec2(+1, +1),
1680 tcu::clear(errorMask, tcu::RGBA::green().toVec());
1690 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1691 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1694 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
1716 const tcu::Vec3 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
1719 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
1722 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
1726 tcu::Vec2 lodBounds = tcu::computeCubeLodBoundsFromDerivates(coord, coordDx, coordDy, srcSize, lodPrec);
1736 const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
1739 const tcu::Vec3 coordDxo (triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
1742 const tcu::Vec3 coordDyo (triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
1745 const tcu::Vec2 lodO = tcu::computeCubeLodBoundsFromDerivates(coordO, coordDxo, coordDyo, srcSize, lodPrec);
1751 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(minLod, sampleParams.maxLod), lodPrec);
1753 if (tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix))
1762 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
1772 bool verifyTextureResult (tcu::TestContext& testCtx,
1773 const tcu::ConstPixelBufferAccess& result,
1774 const tcu::TextureCubeView& src,
1777 const tcu::LookupPrecision& lookupPrec,
1778 const tcu::LodPrecision& lodPrec,
1779 const tcu::PixelFormat& pixelFormat)
1781 tcu::TestLog& log = testCtx.getLog();
1782 tcu::Surface reference (result.getWidth(), result.getHeight());
1783 tcu::Surface errorMask (result.getWidth(), result.getHeight());
1788 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
1792 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
1794 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
1795 << tcu::TestLog::Image("Rendered", "Rendered image", result);
1799 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
1800 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
1803 log << tcu::TestLog::EndImageSet;
1809 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
1810 const tcu::ConstPixelBufferAccess& reference,
1811 const tcu::PixelBufferAccess& errorMask,
1812 const tcu::Texture3DView& baseView,
1815 const tcu::LookupPrecision& lookupPrec,
1816 const tcu::LodPrecision& lodPrec,
1822 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
1823 tcu::ImageViewMinLodParams minLodParams =
1833 const tcu::Texture3DView src = getEffectiveTextureView(getSubView(baseView, sampleParams.baseLevel, sampleParams.maxLevel, sampleParams.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL), srcLevelStorage, sampleParams.sampler);
1835 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
1836 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
1837 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
1839 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
1842 const tcu::IVec3 srcSize = tcu::IVec3(src.getWidth(), src.getHeight(), src.getDepth());
1845 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
1846 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
1847 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
1848 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
1850 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
1856 const float imageViewMinLodRelMode = tcu::isSamplerMipmapModeLinear(sampleParams.sampler.minFilter) ? deFloatFloor(imageViewMinLodRel) : (float)deClamp32((int)deFloatCeil(imageViewMinLodRel + 0.5f) - 1, sampleParams.baseLevel, sampleParams.maxLevel);
1863 const tcu::Vec2 lodOffsets[] =
1865 tcu::Vec2(-1, 0),
1866 tcu::Vec2(+1, 0),
1867 tcu::Vec2( 0, -1),
1868 tcu::Vec2( 0, +1),
1871 tcu::clear(errorMask, tcu::RGBA::green().toVec());
1881 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1882 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
1885 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
1907 const tcu::Vec3 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
1910 const tcu::Vec3 coordDx = tcu::Vec3(triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
1913 const tcu::Vec3 coordDy = tcu::Vec3(triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
1917 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx.x(), coordDx.y(), coordDx.z(), coordDy.x(), coordDy.y(), coordDy.z(), lodPrec);
1927 const tcu::Vec3 coordDxo = tcu::Vec3(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
1930 const tcu::Vec3 coordDyo = tcu::Vec3(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
1933 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo.x(), coordDxo.y(), coordDxo.z(), coordDyo.x(), coordDyo.y(), coordDyo.z(), lodPrec);
1939 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(minLod, sampleParams.maxLod), lodPrec);
1941 if (tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix))
1950 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
1960 bool verifyTextureResult (tcu::TestContext& testCtx,
1961 const tcu::ConstPixelBufferAccess& result,
1962 const tcu::Texture3DView& src,
1965 const tcu::LookupPrecision& lookupPrec,
1966 const tcu::LodPrecision& lodPrec,
1967 const tcu::PixelFormat& pixelFormat)
1969 tcu::TestLog& log = testCtx.getLog();
1970 tcu::Surface reference (result.getWidth(), result.getHeight());
1971 tcu::Surface errorMask (result.getWidth(), result.getHeight());
1976 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
1980 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
1982 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
1983 << tcu::TestLog::Image("Rendered", "Rendered image", result);
1987 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
1988 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
1991 log << tcu::TestLog::EndImageSet;
1997 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
1998 const tcu::ConstPixelBufferAccess& reference,
1999 const tcu::PixelBufferAccess& errorMask,
2000 const tcu::Texture1DArrayView& baseView,
2003 const tcu::LookupPrecision& lookupPrec,
2004 const tcu::LodPrecision& lodPrec,
2010 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
2011 const tcu::Texture1DArrayView src = getEffectiveTextureView(baseView, srcLevelStorage, sampleParams.sampler);
2013 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
2014 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
2016 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2022 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2023 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2024 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2026 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2030 const tcu::Vec2 lodOffsets[] =
2032 tcu::Vec2(-1, 0),
2033 tcu::Vec2(+1, 0),
2034 tcu::Vec2( 0, -1),
2035 tcu::Vec2( 0, +1),
2038 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2048 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2049 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2052 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
2065 const tcu::Vec2 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2070 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx, coordDy, lodPrec);
2082 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo, coordDyo, lodPrec);
2088 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
2089 const bool isOk = tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix);
2093 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2104 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
2105 const tcu::ConstPixelBufferAccess& reference,
2106 const tcu::PixelBufferAccess& errorMask,
2107 const tcu::Texture2DArrayView& baseView,
2110 const tcu::LookupPrecision& lookupPrec,
2111 const tcu::LodPrecision& lodPrec,
2117 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
2118 const tcu::Texture2DArrayView src = getEffectiveTextureView(baseView, srcLevelStorage, sampleParams.sampler);
2120 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
2121 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
2122 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
2124 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2127 const tcu::Vec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight()).asFloat(); // For lod computation, thus #layers is ignored.
2130 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2131 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2132 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
2133 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2135 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2139 const tcu::Vec2 lodOffsets[] =
2141 tcu::Vec2(-1, 0),
2142 tcu::Vec2(+1, 0),
2143 tcu::Vec2( 0, -1),
2144 tcu::Vec2( 0, +1),
2147 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2157 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2158 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2161 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
2174 const tcu::Vec3 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2177 const tcu::Vec2 coordDx = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
2179 const tcu::Vec2 coordDy = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
2182 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx.x(), coordDx.y(), coordDy.x(), coordDy.y(), lodPrec);
2192 const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
2194 const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
2196 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo.x(), coordDxo.y(), coordDyo.x(), coordDyo.y(), lodPrec);
2202 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
2203 const bool isOk = tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coord, clampedLod, resPix);
2207 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2217 bool verifyTextureResult (tcu::TestContext& testCtx,
2218 const tcu::ConstPixelBufferAccess& result,
2219 const tcu::Texture1DArrayView& src,
2222 const tcu::LookupPrecision& lookupPrec,
2223 const tcu::LodPrecision& lodPrec,
2224 const tcu::PixelFormat& pixelFormat)
2226 tcu::TestLog& log = testCtx.getLog();
2227 tcu::Surface reference (result.getWidth(), result.getHeight());
2228 tcu::Surface errorMask (result.getWidth(), result.getHeight());
2233 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
2237 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
2239 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
2240 << tcu::TestLog::Image("Rendered", "Rendered image", result);
2244 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
2245 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
2248 log << tcu::TestLog::EndImageSet;
2253 bool verifyTextureResult (tcu::TestContext& testCtx,
2254 const tcu::ConstPixelBufferAccess& result,
2255 const tcu::Texture2DArrayView& src,
2258 const tcu::LookupPrecision& lookupPrec,
2259 const tcu::LodPrecision& lodPrec,
2260 const tcu::PixelFormat& pixelFormat)
2262 tcu::TestLog& log = testCtx.getLog();
2263 tcu::Surface reference (result.getWidth(), result.getHeight());
2264 tcu::Surface errorMask (result.getWidth(), result.getHeight());
2269 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
2273 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
2275 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
2276 << tcu::TestLog::Image("Rendered", "Rendered image", result);
2280 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
2281 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
2284 log << tcu::TestLog::EndImageSet;
2290 int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess& result,
2291 const tcu::ConstPixelBufferAccess& reference,
2292 const tcu::PixelBufferAccess& errorMask,
2293 const tcu::TextureCubeArrayView& baseView,
2296 const tcu::LookupPrecision& lookupPrec,
2297 const tcu::IVec4& coordBits,
2298 const tcu::LodPrecision& lodPrec,
2304 std::vector<tcu::ConstPixelBufferAccess> srcLevelStorage;
2305 tcu::ImageViewMinLodParams minLodParams =
2315 const tcu::TextureCubeArrayView src = getEffectiveTextureView(getSubView(baseView, sampleParams.baseLevel, sampleParams.maxLevel, sampleParams.imageViewMinLod != 0.0f ? &minLodParams : DE_NULL), srcLevelStorage, sampleParams.sampler);
2317 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[4+0], texCoord[8+0], texCoord[12+0]);
2318 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[4+1], texCoord[8+1], texCoord[12+1]);
2319 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[4+2], texCoord[8+2], texCoord[12+2]);
2320 const tcu::Vec4 qq = tcu::Vec4(texCoord[0+3], texCoord[4+3], texCoord[8+3], texCoord[12+3]);
2322 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2328 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2329 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2330 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
2331 const tcu::Vec3 triQ[2] = { qq.swizzle(0, 1, 2), qq.swizzle(3, 2, 1) };
2332 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2334 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2340 const tcu::Vec2 lodOffsets[] =
2342 tcu::Vec2(-1, 0),
2343 tcu::Vec2(+1, 0),
2344 tcu::Vec2( 0, -1),
2345 tcu::Vec2( 0, +1),
2348 tcu::Vec2(-1, -1),
2349 tcu::Vec2(-1, +1),
2350 tcu::Vec2(+1, -1),
2351 tcu::Vec2(+1, +1),
2354 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2364 const tcu::Vec4 resPix = (result.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2365 const tcu::Vec4 refPix = (reference.getPixel(px, py) - sampleParams.colorBias) / sampleParams.colorScale;
2368 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(resPix - refPix), lookupPrec.colorThreshold)))
2390 const tcu::Vec4 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2394 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
2397 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
2401 tcu::Vec2 lodBounds = tcu::computeCubeLodBoundsFromDerivates(coord.toWidth<3>(), coordDx, coordDy, srcSize, lodPrec);
2411 const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
2414 const tcu::Vec3 coordDxo (triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
2417 const tcu::Vec3 coordDyo (triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
2420 const tcu::Vec2 lodO = tcu::computeCubeLodBoundsFromDerivates(coordO, coordDxo, coordDyo, srcSize, lodPrec);
2426 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
2428 if (tcu::isLookupResultValid(src, sampleParams.sampler, lookupPrec, coordBits, coord, clampedLod, resPix))
2437 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2447 bool verifyTextureResult (tcu::TestContext& testCtx,
2448 const tcu::ConstPixelBufferAccess& result,
2449 const tcu::TextureCubeArrayView& src,
2452 const tcu::LookupPrecision& lookupPrec,
2453 const tcu::IVec4& coordBits,
2454 const tcu::LodPrecision& lodPrec,
2455 const tcu::PixelFormat& pixelFormat)
2457 tcu::TestLog& log = testCtx.getLog();
2458 tcu::Surface reference (result.getWidth(), result.getHeight());
2459 tcu::Surface errorMask (result.getWidth(), result.getHeight());
2464 sampleTexture(tcu::SurfaceAccess(reference, pixelFormat), src, texCoord, sampleParams);
2468 log << tcu::TestLog::Message << "ERROR: Result verification failed, got " << numFailedPixels << " invalid pixels!" << tcu::TestLog::EndMessage;
2470 log << tcu::TestLog::ImageSet("VerifyResult", "Verification result")
2471 << tcu::TestLog::Image("Rendered", "Rendered image", result);
2475 log << tcu::TestLog::Image("Reference", "Ideal reference image", reference)
2476 << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
2479 log << tcu::TestLog::EndImageSet;
2486 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
2487 const tcu::ConstPixelBufferAccess& reference,
2488 const tcu::PixelBufferAccess& errorMask,
2489 const tcu::Texture2DView& src,
2492 const tcu::TexComparePrecision& comparePrec,
2493 const tcu::LodPrecision& lodPrec,
2494 const tcu::Vec3& nonShadowThreshold)
2499 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
2500 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
2502 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2505 const tcu::IVec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight());
2508 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2509 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2510 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2512 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2518 const tcu::Vec2 lodOffsets[] =
2520 tcu::Vec2(-1, 0),
2521 tcu::Vec2(+1, 0),
2522 tcu::Vec2( 0, -1),
2523 tcu::Vec2( 0, +1),
2526 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2532 const tcu::Vec4 resPix = result.getPixel(px, py);
2533 const tcu::Vec4 refPix = reference.getPixel(px, py);
2536 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
2538 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2558 const tcu::Vec2 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2560 const tcu::Vec2 coordDx = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
2562 const tcu::Vec2 coordDy = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
2565 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx.x(), coordDx.y(), coordDy.x(), coordDy.y(), lodPrec);
2575 const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
2577 const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
2579 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo.x(), coordDxo.y(), coordDyo.x(), coordDyo.y(), lodPrec);
2585 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(minLod, sampleParams.maxLod), lodPrec);
2586 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, coord, clampedLod, sampleParams.ref, resPix.x());
2590 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2600 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
2601 const tcu::ConstPixelBufferAccess& reference,
2602 const tcu::PixelBufferAccess& errorMask,
2603 const tcu::TextureCubeView& src,
2606 const tcu::TexComparePrecision& comparePrec,
2607 const tcu::LodPrecision& lodPrec,
2608 const tcu::Vec3& nonShadowThreshold)
2613 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
2614 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
2615 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
2617 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2623 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2624 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2625 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
2626 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2628 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2634 const tcu::Vec2 lodOffsets[] =
2636 tcu::Vec2(-1, 0),
2637 tcu::Vec2(+1, 0),
2638 tcu::Vec2( 0, -1),
2639 tcu::Vec2( 0, +1),
2642 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2648 const tcu::Vec4 resPix = result.getPixel(px, py);
2649 const tcu::Vec4 refPix = reference.getPixel(px, py);
2652 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
2654 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2674 const tcu::Vec3 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2677 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
2680 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
2684 tcu::Vec2 lodBounds = tcu::computeCubeLodBoundsFromDerivates(coord, coordDx, coordDy, srcSize, lodPrec);
2694 const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
2697 const tcu::Vec3 coordDxo (triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
2700 const tcu::Vec3 coordDyo (triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
2703 const tcu::Vec2 lodO = tcu::computeCubeLodBoundsFromDerivates(coordO, coordDxo, coordDyo, srcSize, lodPrec);
2709 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(minLod, sampleParams.maxLod), lodPrec);
2710 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, coord, clampedLod, sampleParams.ref, resPix.x());
2714 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2724 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
2725 const tcu::ConstPixelBufferAccess& reference,
2726 const tcu::PixelBufferAccess& errorMask,
2727 const tcu::Texture2DArrayView& src,
2730 const tcu::TexComparePrecision& comparePrec,
2731 const tcu::LodPrecision& lodPrec,
2732 const tcu::Vec3& nonShadowThreshold)
2737 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[3+0], texCoord[6+0], texCoord[9+0]);
2738 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[3+1], texCoord[6+1], texCoord[9+1]);
2739 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[3+2], texCoord[6+2], texCoord[9+2]);
2741 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
2744 const tcu::IVec2 srcSize = tcu::IVec2(src.getWidth(), src.getHeight());
2747 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2748 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2749 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
2750 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2752 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2756 const tcu::Vec2 lodOffsets[] =
2758 tcu::Vec2(-1, 0),
2759 tcu::Vec2(+1, 0),
2760 tcu::Vec2( 0, -1),
2761 tcu::Vec2( 0, +1),
2764 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2770 const tcu::Vec4 resPix = result.getPixel(px, py);
2771 const tcu::Vec4 refPix = reference.getPixel(px, py);
2774 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
2776 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2796 const tcu::Vec3 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
2799 const tcu::Vec2 coordDx = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
2801 const tcu::Vec2 coordDy = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
2804 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx.x(), coordDx.y(), coordDy.x(), coordDy.y(), lodPrec);
2814 const tcu::Vec2 coordDxo = tcu::Vec2(triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
2816 const tcu::Vec2 coordDyo = tcu::Vec2(triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
2818 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo.x(), coordDxo.y(), coordDyo.x(), coordDyo.y(), lodPrec);
2824 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
2825 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, coord, clampedLod, sampleParams.ref, resPix.x());
2829 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2839 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
2840 const tcu::ConstPixelBufferAccess& reference,
2841 const tcu::PixelBufferAccess& errorMask,
2842 const tcu::Texture1DView& src,
2845 const tcu::TexComparePrecision& comparePrec,
2846 const tcu::LodPrecision& lodPrec,
2847 const tcu::Vec3& nonShadowThreshold)
2853 const tcu::Vec4 sq = tcu::Vec4(texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
2855 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), 1);
2861 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2862 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2864 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2868 const tcu::Vec2 lodOffsets[] =
2870 tcu::Vec2(-1, 0),
2871 tcu::Vec2(+1, 0),
2872 tcu::Vec2( 0, -1),
2873 tcu::Vec2( 0, +1),
2876 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2882 const tcu::Vec4 resPix = result.getPixel(px, py);
2883 const tcu::Vec4 refPix = reference.getPixel(px, py);
2886 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
2888 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2911 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx, coordDx, lodPrec);
2923 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo, coordDyo, lodPrec);
2929 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
2930 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, tcu::Vec1(coord), clampedLod, sampleParams.ref, resPix.x());
2934 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
2944 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
2945 const tcu::ConstPixelBufferAccess& reference,
2946 const tcu::PixelBufferAccess& errorMask,
2947 const tcu::Texture1DArrayView& src,
2950 const tcu::TexComparePrecision& comparePrec,
2951 const tcu::LodPrecision& lodPrec,
2952 const tcu::Vec3& nonShadowThreshold)
2958 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[2+0], texCoord[4+0], texCoord[6+0]);
2959 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[2+1], texCoord[4+1], texCoord[6+1]);
2961 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), 1);
2967 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
2968 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
2969 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
2971 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
2975 const tcu::Vec2 lodOffsets[] =
2977 tcu::Vec2(-1, 0),
2978 tcu::Vec2(+1, 0),
2979 tcu::Vec2( 0, -1),
2980 tcu::Vec2( 0, +1),
2983 tcu::clear(errorMask, tcu::RGBA::green().toVec());
2989 const tcu::Vec4 resPix = result.getPixel(px, py);
2990 const tcu::Vec4 refPix = reference.getPixel(px, py);
2993 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
2995 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
3015 const tcu::Vec2 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
3019 tcu::Vec2 lodBounds = tcu::computeLodBoundsFromDerivates(coordDx, coordDx, lodPrec);
3031 const tcu::Vec2 lodO = tcu::computeLodBoundsFromDerivates(coordDxo, coordDyo, lodPrec);
3037 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
3038 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, coord, clampedLod, sampleParams.ref, resPix.x());
3042 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
3052 int computeTextureCompareDiff (const tcu::ConstPixelBufferAccess& result,
3053 const tcu::ConstPixelBufferAccess& reference,
3054 const tcu::PixelBufferAccess& errorMask,
3055 const tcu::TextureCubeArrayView& src,
3058 const tcu::TexComparePrecision& comparePrec,
3059 const tcu::LodPrecision& lodPrec,
3060 const tcu::Vec3& nonShadowThreshold)
3065 const tcu::Vec4 sq = tcu::Vec4(texCoord[0+0], texCoord[4+0], texCoord[8+0], texCoord[12+0]);
3066 const tcu::Vec4 tq = tcu::Vec4(texCoord[0+1], texCoord[4+1], texCoord[8+1], texCoord[12+1]);
3067 const tcu::Vec4 rq = tcu::Vec4(texCoord[0+2], texCoord[4+2], texCoord[8+2], texCoord[12+2]);
3068 const tcu::Vec4 qq = tcu::Vec4(texCoord[0+3], texCoord[4+3], texCoord[8+3], texCoord[12+3]);
3070 const tcu::IVec2 dstSize = tcu::IVec2(result.getWidth(), result.getHeight());
3076 const tcu::Vec3 triS[2] = { sq.swizzle(0, 1, 2), sq.swizzle(3, 2, 1) };
3077 const tcu::Vec3 triT[2] = { tq.swizzle(0, 1, 2), tq.swizzle(3, 2, 1) };
3078 const tcu::Vec3 triR[2] = { rq.swizzle(0, 1, 2), rq.swizzle(3, 2, 1) };
3079 const tcu::Vec3 triQ[2] = { qq.swizzle(0, 1, 2), qq.swizzle(3, 2, 1) };
3080 const tcu::Vec3 triW[2] = { sampleParams.w.swizzle(0, 1, 2), sampleParams.w.swizzle(3, 2, 1) };
3082 const tcu::Vec2 lodBias ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
3086 const tcu::Vec2 lodOffsets[] =
3088 tcu::Vec2(-1, 0),
3089 tcu::Vec2(+1, 0),
3090 tcu::Vec2( 0, -1),
3091 tcu::Vec2( 0, +1),
3094 tcu::clear(errorMask, tcu::RGBA::green().toVec());
3100 const tcu::Vec4 resPix = result.getPixel(px, py);
3101 const tcu::Vec4 refPix = reference.getPixel(px, py);
3104 if (!tcu::boolAll(tcu::lessThanEqual(tcu::abs(refPix.swizzle(1,2,3) - resPix.swizzle(1,2,3)), nonShadowThreshold)))
3106 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
3126 const tcu::Vec4 coord (projectedTriInterpolate(triS[triNdx], triW[triNdx], triNx, triNy),
3130 const tcu::Vec3 coordDx (triDerivateX(triS[triNdx], triW[triNdx], wx, dstW, triNy),
3133 const tcu::Vec3 coordDy (triDerivateY(triS[triNdx], triW[triNdx], wy, dstH, triNx),
3137 tcu::Vec2 lodBounds = tcu::computeCubeLodBoundsFromDerivates(coord.swizzle(0,1,2), coordDx, coordDy, srcSize, lodPrec);
3147 const tcu::Vec3 coordO (projectedTriInterpolate(triS[triNdx], triW[triNdx], nxo, nyo),
3150 const tcu::Vec3 coordDxo (triDerivateX(triS[triNdx], triW[triNdx], wxo, dstW, nyo),
3153 const tcu::Vec3 coordDyo (triDerivateY(triS[triNdx], triW[triNdx], wyo, dstH, nxo),
3156 const tcu::Vec2 lodO = tcu::computeCubeLodBoundsFromDerivates(coordO, coordDxo, coordDyo, srcSize, lodPrec);
3162 const tcu::Vec2 clampedLod = tcu::clampLodBounds(lodBounds + lodBias, tcu::Vec2(sampleParams.minLod, sampleParams.maxLod), lodPrec);
3163 const bool isOk = tcu::isTexCompareResultValid(src, sampleParams.sampler, comparePrec, coord, clampedLod, sampleParams.ref, resPix.x());
3167 errorMask.setPixel(tcu::RGBA::red().toVec(), px, py);
3179 static int compareGenMipmapBilinear (const tcu::ConstPixelBufferAccess& dst, const tcu::ConstPixelBufferAccess& src, const tcu::PixelBufferAccess& errorMask, const GenMipmapPrecision& precision)
3190 const tcu::Sampler sampler (tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE,
3191 tcu::Sampler::LINEAR, tcu::Sampler::LINEAR, 0.0f, false /* non-normalized coords */);
3192 tcu::LookupPrecision lookupPrec;
3196 lookupPrec.coordBits = tcu::IVec3(22);
3202 const tcu::Vec4 result = dst.getPixel(x, y);
3205 const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result);
3207 errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
3215 static int compareGenMipmapBox (const tcu::ConstPixelBufferAccess& dst, const tcu::ConstPixelBufferAccess& src, const tcu::PixelBufferAccess& errorMask, const GenMipmapPrecision& precision)
3226 const tcu::Sampler sampler (tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE,
3227 tcu::Sampler::LINEAR, tcu::Sampler::LINEAR, 0.0f, false /* non-normalized coords */);
3228 tcu::LookupPrecision lookupPrec;
3232 lookupPrec.coordBits = tcu::IVec3(22);
3238 const tcu::Vec4 result = dst.getPixel(x, y);
3241 const bool isOk = tcu::isLinearSampleResultValid(src, sampler, lookupPrec, tcu::Vec2(cx, cy), 0, result);
3243 errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
3251 static int compareGenMipmapVeryLenient (const tcu::ConstPixelBufferAccess& dst, const tcu::ConstPixelBufferAccess& src, const tcu::PixelBufferAccess& errorMask, const GenMipmapPrecision& precision)
3265 const tcu::Vec4 result = dst.getPixel(x, y);
3270 tcu::Vec4 minVal, maxVal;
3281 const tcu::Vec4 sample = src.getPixel(sx, sy);
3298 errorMask.setPixel(isOk ? tcu::RGBA::green().toVec() : tcu::RGBA::red().toVec(), x, y);
3306 qpTestResult compareGenMipmapResult (tcu::TestLog& log, const tcu::Texture2D& resultTexture, const tcu::Texture2D& level0Reference, const GenMipmapPrecision& precision)
3312 const tcu::Vec4 threshold = select(precision.colorThreshold, tcu::Vec4(1.0f), precision.colorMask);
3313 const bool level0Ok = tcu::floatThresholdCompare(log, "Level0", "Level 0", level0Reference.getLevel(0), resultTexture.getLevel(0), threshold, tcu::COMPARE_LOG_RESULT);
3317 log << tcu::TestLog::Message << "ERROR: Level 0 comparison failed!" << tcu::TestLog::EndMessage;
3324 const tcu::ConstPixelBufferAccess src = resultTexture.getLevel(levelNdx-1);
3325 const tcu::ConstPixelBufferAccess dst = resultTexture.getLevel(levelNdx);
3326 tcu::Surface errorMask (dst.getWidth(), dst.getHeight());
3337 log << tcu::TestLog::Message << "WARNING: Level " << levelNdx << " comparison to bilinear method failed, found " << numFailed << " invalid pixels." << tcu::TestLog::EndMessage;
3346 log << tcu::TestLog::Message << "WARNING: Level " << levelNdx << " comparison to box method failed, found " << numFailed << " invalid pixels." << tcu::TestLog::EndMessage;
3359 log << tcu::TestLog::Message << "ERROR: Level " << levelNdx << " appears to contain " << numFailed << " completely wrong pixels, failing case!" << tcu::TestLog::EndMessage;
3365 log << tcu::TestLog::ImageSet(string("Level") + de::toString(levelNdx), string("Level ") + de::toString(levelNdx) + " result")
3366 << tcu::TestLog::Image("Result", "Result", dst);
3369 log << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
3371 log << tcu::TestLog::EndImageSet;
3377 qpTestResult compareGenMipmapResult (tcu::TestLog& log, const tcu::TextureCube& resultTexture, const tcu::TextureCube& level0Reference, const GenMipmapPrecision& precision)
3382 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_faceNames) == tcu::CUBEFACE_LAST);
3385 for (int faceNdx = 0; faceNdx < tcu::CUBEFACE_LAST; faceNdx++)
3387 const tcu::CubeFace face = tcu::CubeFace(faceNdx);
3388 const tcu::Vec4 threshold = select(precision.colorThreshold, tcu::Vec4(1.0f), precision.colorMask);
3389 const bool level0Ok = tcu::floatThresholdCompare(log,
3394 threshold, tcu::COMPARE_LOG_RESULT);
3398 log << tcu::TestLog::Message << "ERROR: Level 0, face " << s_faceNames[face] << " comparison failed!" << tcu::TestLog::EndMessage;
3405 for (int faceNdx = 0; faceNdx < tcu::CUBEFACE_LAST; faceNdx++)
3407 const tcu::CubeFace face = tcu::CubeFace(faceNdx);
3409 const tcu::ConstPixelBufferAccess src = resultTexture.getLevelFace(levelNdx-1, face);
3410 const tcu::ConstPixelBufferAccess dst = resultTexture.getLevelFace(levelNdx, face);
3411 tcu::Surface errorMask (dst.getWidth(), dst.getHeight());
3422 log << tcu::TestLog::Message << "WARNING: Level " << levelNdx << ", face " << faceName << " comparison to bilinear method failed, found " << numFailed << " invalid pixels." << tcu::TestLog::EndMessage;
3431 log << tcu::TestLog::Message << "WARNING: Level " << levelNdx << ", face " << faceName <<" comparison to box method failed, found " << numFailed << " invalid pixels." << tcu::TestLog::EndMessage;
3444 log << tcu::TestLog::Message << "ERROR: Level " << levelNdx << ", face " << faceName << " appears to contain " << numFailed << " completely wrong pixels, failing case!" << tcu::TestLog::EndMessage;
3450 log << tcu::TestLog::ImageSet(string("Level") + de::toString(levelNdx) + "Face" + de::toString(faceNdx), string("Level ") + de::toString(levelNdx) + ", face " + string(faceName) + " result")
3451 << tcu::TestLog::Image("Result", "Result", dst);
3454 log << tcu::TestLog::Image("ErrorMask", "Error mask", errorMask);
3456 log << tcu::TestLog::EndImageSet;