Generate flat triangles in polygon offset tests.
authorAlexander Galazin <alexander.galazin@arm.com>
Wed, 11 Jan 2017 07:50:13 +0000 (08:50 +0100)
committerPyry Haulos <phaulos@google.com>
Wed, 18 Jan 2017 19:29:53 +0000 (19:29 +0000)
The tests setup triangles with a depth slope and then call
glPolygonOffset(factor, units) with variable units and
always 0 slope scaled factor.

According to the GLES 3.2 spec 13.7.2 Depth Offset:
"void PolygonOffset( float factor, float units );
factor scales the maximum depth slope of the polygon, and units scales an
implementation-dependent constant that relates to the usable resolution of the
depth buffer."

If the polygon has a depth slope,
the depth slope factor has to be not equal to zero.
The rationale of the slope scaled factor is to ensure that the offset
(equation 13.11) is greater than max(dz/dx, dz/dy) for all resolutions,
which may not be the case for the constant offset since it doesn't take
the screen resolution into account.

Changed tests:

dEQP-GLES2.functional.polygon_offset.*_displacement_with_units
dEQP-GLES3.functional.polygon_offset.*_displacement_with_units

Bug: 34386628

Change-Id: Ie8009ba1766eb50c3c5a750122aa8bb231144210

modules/gles2/functional/es2fPolygonOffsetTests.cpp
modules/gles3/functional/es3fPolygonOffsetTests.cpp

index 4a933d8..7ec850f 100644 (file)
@@ -475,7 +475,7 @@ tcu::Vec4 UsageDisplacementTestCase::genRandomVec4 (de::Random& rnd) const
 
        retVal.x() = rnd.getFloat(-1, 1);
        retVal.y() = rnd.getFloat(-1, 1);
-       retVal.z() = rnd.getFloat(-0.9f, 0.9f);
+       retVal.z() = 0.5f;
        retVal.w() = 1.0f + rnd.getFloat();
 
        return retVal;
index 554539d..7352ee6 100644 (file)
@@ -478,7 +478,7 @@ tcu::Vec4 UsageDisplacementTestCase::genRandomVec4 (de::Random& rnd) const
 
        retVal.x() = rnd.getFloat(-1, 1);
        retVal.y() = rnd.getFloat(-1, 1);
-       retVal.z() = rnd.getFloat(-0.9f, 0.9f);
+       retVal.z() = 0.5f;
        retVal.w() = 1.0f + rnd.getFloat();
 
        return retVal;