Fix DrawRangeElementsBaseVertex tests with negative basevertex
authorAlexander Galazin <alexander.galazin@arm.com>
Tue, 9 May 2017 08:44:12 +0000 (10:44 +0200)
committerPyry Haulos <phaulos@google.com>
Tue, 9 May 2017 19:37:24 +0000 (12:37 -0700)
commite490e2f2158aa9d3aec7d8e385ca3995fefc9ffd
tree30921e12fbafa592e3a8864c0393bd11f3bd093b
parentc7b2d82b1af8899eaea4def2c23f34a4adf28c6a
Fix DrawRangeElementsBaseVertex tests with negative basevertex

DrawRangeElementsBaseVertex tests with negative basevertex call
glDrawRangeElementsBaseVertex with start = 0 and basevertex = -1.
According to the spec: If no element array buffer is bound, the vertex ID of
the ith element transferred is indices[i] + basevertex...
If the vertex ID is larger than the maximum value representable by type,
it should behave as if the calculation were upconverted to 32-bit unsigned
integers (with wrapping on overflow conditions).
Behavior of DrawElementsOneInstance is undefined if the vertex ID is negative
for any element, and should be handled as described in section 6.4.

This change ensures that indexMin + baseVertex will be zero or positive value.

Components: AOSP

Affects:
dEQP-GLES31.functional.draw_base_vertex.draw_range_elements_base_vertex.base_vertex.index_neg_byte
dEQP-GLES31.functional.draw_base_vertex.draw_range_elements_base_vertex.base_vertex.index_neg_short
dEQP-GLES31.functional.draw_base_vertex.draw_range_elements_base_vertex.base_vertex.index_neg_int

Change-Id: I07a9e6bc60d4340784d400b5087bb8fff01f0e57
modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp