diff options
author | Marek Olšák <marek.olsak@amd.com> | 2017-02-17 12:59:54 +0100 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2017-02-19 17:16:37 +0100 |
commit | 970c58a008ff5d134128d052526221322b9b8ffb (patch) | |
tree | 5c04a219afc577ad3ec258b1528e30f8a40f3f52 /tests/general | |
parent | 8ca1f35c70b89a0af4ec47587afb22c93429821f (diff) |
draw-elements: test glMultiDrawElements(GL_UNSIGNED_BYTE)
this was broken in radeonsi
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'tests/general')
-rw-r--r-- | tests/general/draw-elements.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/general/draw-elements.c b/tests/general/draw-elements.c index 29436cf2d..d20e85a1a 100644 --- a/tests/general/draw-elements.c +++ b/tests/general/draw-elements.c @@ -62,8 +62,10 @@ void piglit_init(int argc, char **argv) glClearColor(0.2, 0.2, 0.2, 1.0); } -static void test_ubyte_indices(float x1, float y1, float x2, float y2, int index) +static void test_ubyte_indices(float x1, float y1, float x2, float y2, int test) { + bool use_multi = test / 4; + int index = test % 4; float v[] = { x1, y1, x1, y2, @@ -100,11 +102,32 @@ static void test_ubyte_indices(float x1, float y1, float x2, float y2, int index glGenBuffers(1, &buf); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indx), indx, GL_STATIC_DRAW); - glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, (void*)(intptr_t)(index*9)); + if (use_multi) { + GLsizei count[] = {3, 3}; + /* We need 2 draws in order to get non-zero in + * pipe_draw_info::start, so make the second draw + * a zero-area triangle. */ + const void *offset[] = {(void*)(intptr_t)(index*9), + (void*)(intptr_t)1}; + glMultiDrawElements(GL_TRIANGLES, count, + GL_UNSIGNED_BYTE, offset, 2); + } else { + glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, + (void*)(intptr_t)(index*9)); + } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDeleteBuffers(1, &buf); } else { - glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, indx + index*9); + if (use_multi) { + GLsizei count[] = {3, 3}; + /* The second draw is a zero-area triangle. */ + const void *indices[] = {indx + index*9, indx + 1}; + glMultiDrawElements(GL_TRIANGLES, count, + GL_UNSIGNED_BYTE, indices, 2); + } else { + glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, + indx + index*9); + } } } @@ -215,6 +238,11 @@ struct test tests[] = { {test_ubyte_indices, 2, {1, 1, 1}, BOTH, "Ubyte indices - offset: 2"}, {test_ubyte_indices, 3, {1, 1, 1}, BOTH, "Ubyte indices - offset: 3"}, + {test_ubyte_indices, 4, {1, 1, 1}, BOTH, "Ubyte indices - offset: 0 (glMultiDraw)"}, + {test_ubyte_indices, 5, {1, 1, 1}, BOTH, "Ubyte indices - offset: 1 (glMultiDraw)"}, + {test_ubyte_indices, 6, {1, 1, 1}, BOTH, "Ubyte indices - offset: 2 (glMultiDraw)"}, + {test_ubyte_indices, 7, {1, 1, 1}, BOTH, "Ubyte indices - offset: 3 (glMultiDraw)"}, + {test_ushort_indices, 0, {1, 1, 1}, BOTH, "Ushort indices - offset: 0"}, {test_ushort_indices, 1, {1, 1, 1}, BOTH, "Ushort indices - offset: 2"}, |