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)
commit975a59ebca3ae91c767876765fac6ccc036e4370
tree6a603a27501411bf0daaf2aa5d6f1cbeb7cbc249
parent302bd7c6b3d468e33b19b693a25d67f2b54b961c
Generate flat triangles in polygon offset tests.

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