diff options
author | Neil Roberts <nroberts@igalia.com> | 2017-11-10 16:58:14 +0100 |
---|---|---|
committer | Neil Roberts <nroberts@igalia.com> | 2018-02-07 17:49:16 +0100 |
commit | 891f1ee52c86ec03fa2523e48e9a23c122e4fac0 (patch) | |
tree | 0e18d2c55e95f427410720c713184b425bc219c0 /tests | |
parent | 99ba901ead85f59305c78b93750a78c823dae43f (diff) |
shader_draw_parameters: Also test using glDrawArrays with first > 0
The ‘first’ parameter should not affect the value of gl_BaseVertex but
it should be added to gl_VertexID. This patch adds an extra rectangle
to the drawn area to test a non-zero ‘first’ parameter. This is worth
testing because Mesa is currently getting this wrong.
Reviewed-by: Antia Puentes <apuentes@igalia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spec/arb_shader_draw_parameters/basevertex.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/tests/spec/arb_shader_draw_parameters/basevertex.c b/tests/spec/arb_shader_draw_parameters/basevertex.c index 2279e0f24..333d4e2e9 100644 --- a/tests/spec/arb_shader_draw_parameters/basevertex.c +++ b/tests/spec/arb_shader_draw_parameters/basevertex.c @@ -24,10 +24,26 @@ /** * \file basevertex.c * - * Test that gl_BaseVertexARB has the correct values. Draw left side - * of window with a non-base-vertex draw call to verify - * gl_BaseVertexARB is 0 in that case, then draw other half with base - * vertex 4 and verifies that that works. + * Test that gl_BaseVertexARB has the correct values. + * + * The framebuffer is filled with three quads like this: + * + * ######### + * # # # + * # # B # + * # A ##### + * # # C # + * # # # + * ######### + * + * Quad A is rendered using a non-base-vertex draw call to verify that + * gl_BaseVertexARB is zero in that case. + * + * Quad B is rendered with baseVertex as 4. + * + * Quad C is rendered using a non-indexed draw call with a non-zero + * ‘first’ parameter. This shouldn’t affect gl_BaseVertex but it + * should affect gl_VertexID. */ #include "piglit-util-gl.h" @@ -104,19 +120,27 @@ piglit_display() { bool pass; - static const float vertex_array[16] = { + static const float vertex_array[24] = { + /* Left half of the screen */ -1, -1, 0, -1, 0, 1, -1, 1, - 0, -1, - 1, -1, + /* Top-right quarter of the screen */ + 0, 0, + 1, 0, 1, 1, 0, 1, + + /* Bottom-right quarter of the screen */ + 0, -1, + 1, -1, + 0, 0, + 1, 0, }; - static const int reference_array[32] = { + static const int reference_array[48] = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, @@ -125,6 +149,10 @@ piglit_display() 4, 7, 1, 0, 4, 7, 2, 0, 4, 7, 3, 0, + 0, 0, 8, 0, + 0, 0, 9, 0, + 0, 0, 10, 0, + 0, 0, 11, 0, }; const int indices[6] = { @@ -167,6 +195,14 @@ piglit_display() 4, /* basevertex */ 7 /* baseinstance */); + /* Test using glDrawArrays with a non-zero ‘first’ parameter. + * This value should be included in gl_VertexID but not in + * gl_BaseVertex. + */ + glDrawArrays(GL_TRIANGLE_STRIP, + 8, /* first */ + 4 /* count */); + pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green); |