Use correct, stricter coverage variation thresholds in texture tests
authorPyry Haulos <phaulos@google.com>
Wed, 25 Feb 2015 18:51:52 +0000 (10:51 -0800)
committerPyry Haulos <phaulos@google.com>
Wed, 25 Feb 2015 18:51:52 +0000 (10:51 -0800)
Cube map and 3D texture lookup validation utilities accommodate for
potential coverage computation differences by allowing pixels around
triangle edges to match either of the two triangles forming the test
quad.

The thresholds used eariler applied slightly too small bias, but in
wrong coordinate space (clip-space instead of window coords). This
change fixes both issues, making tests a bit more strict, and correct.

Bug: 19099914
Change-Id: Ife90c9a6a5261954e9f98b68e199248cfc589920

modules/glshared/glsTextureTestUtil.cpp

index 438ba02..ae6a470 100644 (file)
@@ -1990,7 +1990,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess&  result,
 
        const tcu::Vec2         lodBias                 ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
 
-       const float                     posEps                  = 1.0f / float((1<<MIN_SUBPIXEL_BITS) + 1);
+       const float                     posEps                  = 1.0f / float(1<<MIN_SUBPIXEL_BITS);
 
        int                                     numFailed               = 0;
 
@@ -2029,8 +2029,8 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess&  result,
                                const float             nx              = wx / dstW;
                                const float             ny              = wy / dstH;
 
-                               const bool              tri0    = nx + ny - posEps <= 1.0f;
-                               const bool              tri1    = nx + ny + posEps >= 1.0f;
+                               const bool              tri0    = (wx-posEps)/dstW + (wy-posEps)/dstH <= 1.0f;
+                               const bool              tri1    = (wx+posEps)/dstW + (wy+posEps)/dstH >= 1.0f;
 
                                bool                    isOk    = false;
 
@@ -2169,7 +2169,7 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess&  result,
 
        const tcu::Vec2         lodBias                 ((sampleParams.flags & ReferenceParams::USE_BIAS) ? sampleParams.bias : 0.0f);
 
-       const float                     posEps                  = 1.0f / float((1<<MIN_SUBPIXEL_BITS) + 1);
+       const float                     posEps                  = 1.0f / float(1<<MIN_SUBPIXEL_BITS);
 
        int                                     numFailed               = 0;
 
@@ -2202,8 +2202,8 @@ int computeTextureLookupDiff (const tcu::ConstPixelBufferAccess&  result,
                                const float             nx              = wx / dstW;
                                const float             ny              = wy / dstH;
 
-                               const bool              tri0    = nx + ny - posEps <= 1.0f;
-                               const bool              tri1    = nx + ny + posEps >= 1.0f;
+                               const bool              tri0    = (wx-posEps)/dstW + (wy-posEps)/dstH <= 1.0f;
+                               const bool              tri1    = (wx+posEps)/dstW + (wy+posEps)/dstH >= 1.0f;
 
                                bool                    isOk    = false;