[Piglit] [PATCH] gl-1.4: test some glMultiDrawArrays error conditions

Nicolai Hähnle nhaehnle at gmail.com
Tue Apr 18 13:55:10 UTC 2017


I added some spec quotes before pushing, thanks for taking a look!

Cheers,
Nicolai

On 14.04.2017 10:33, Samuel Pitoiset wrote:
>
>
> On 04/13/2017 09:38 PM, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> ---
>>   tests/all.py                               |   1 +
>>   tests/spec/gl-1.4/CMakeLists.gl.txt        |   1 +
>>   tests/spec/gl-1.4/multidrawarrays-errors.c | 114
>> +++++++++++++++++++++++++++++
>>   3 files changed, 116 insertions(+)
>>   create mode 100644 tests/spec/gl-1.4/multidrawarrays-errors.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index 0b84e5d..bc84111 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -1035,20 +1035,21 @@ with profile.test_list.group_manager(
>>       g(['tex3d-depth1'])
>>     with profile.test_list.group_manager(
>>           PiglitGLTest,
>>           grouptools.join('spec', '!opengl 1.4')) as g:
>>       g(['fdo25614-genmipmap'], run_concurrent=False)
>>       g(['tex1d-2dborder'], run_concurrent=False)
>>       g(['blendminmax'], run_concurrent=False)
>>       g(['blendsquare'], run_concurrent=False)
>>       g(['gl-1.4-dlist-multidrawarrays'])
>> +    g(['gl-1.4-multidrawarrays-errors'])
>>       g(['gl-1.4-polygon-offset'])
>>       g(['draw-batch'], run_concurrent=False)
>>       g(['stencil-wrap'], run_concurrent=False)
>>       g(['triangle-rasterization'], run_concurrent=False)
>>       g(['triangle-rasterization', '-use_fbo'],
>> 'triangle-rasterization-fbo',
>>         run_concurrent=False)
>>       g(['triangle-rasterization-overdraw'], run_concurrent=False)
>>       g(['tex-miplevel-selection', '-nobias', '-nolod'],
>>         'tex-miplevel-selection')
>>       g(['tex-miplevel-selection', '-nobias'],
>> 'tex-miplevel-selection-lod')
>> diff --git a/tests/spec/gl-1.4/CMakeLists.gl.txt
>> b/tests/spec/gl-1.4/CMakeLists.gl.txt
>> index a6888f3..22ce3c4 100644
>> --- a/tests/spec/gl-1.4/CMakeLists.gl.txt
>> +++ b/tests/spec/gl-1.4/CMakeLists.gl.txt
>> @@ -2,13 +2,14 @@ include_directories(
>>       ${GLEXT_INCLUDE_DIR}
>>       ${OPENGL_INCLUDE_PATH}
>>   )
>>     link_libraries (
>>       piglitutil_${piglit_target_api}
>>       ${OPENGL_gl_LIBRARY}
>>   )
>>     piglit_add_executable (gl-1.4-dlist-multidrawarrays
>> dlist-multidrawarrays.c)
>> +piglit_add_executable (gl-1.4-multidrawarrays-errors
>> multidrawarrays-errors.c)
>>   piglit_add_executable (gl-1.4-polygon-offset polygon-offset.c)
>>     # vim: ft=cmake:
>> diff --git a/tests/spec/gl-1.4/multidrawarrays-errors.c
>> b/tests/spec/gl-1.4/multidrawarrays-errors.c
>> new file mode 100644
>> index 0000000..db25a78
>> --- /dev/null
>> +++ b/tests/spec/gl-1.4/multidrawarrays-errors.c
>> @@ -0,0 +1,114 @@
>> +/*
>> + * Copyright 2017 Advanced Micro Devices, Inc.
>> + *
>> + * Permission is hereby granted, free of charge, to any person
>> obtaining a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * on the rights to use, copy, modify, merge, publish, distribute, sub
>> + * license, and/or sell copies of the Software, and to permit persons
>> to whom
>> + * the Software is furnished to do so, subject to the following
>> conditions:
>> + *
>> + * The above copyright notice and this permission notice (including
>> the next
>> + * paragraph) shall be included in all copies or substantial portions
>> of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT
>> SHALL
>> + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
>> OR THE
>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> + */
>> +
>> +/**
>> + * Test error conditions of glMultiDrawArrays.
>> + * glMultiDrawArrays is part of GL 1.4 and later.
>> + *
>> + * Based loosely on dlist-multidrawarrays.c.
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +    config.supports_gl_compat_version = 14;
>> +    config.window_visual = PIGLIT_GL_VISUAL_DOUBLE |
>> PIGLIT_GL_VISUAL_RGBA;
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +
>> +static const float verts[][2] = {
>> +    { -1.0f, -1.0f },
>> +    {  1.0f, -1.0f },
>> +    {  1.0f,  1.0f },
>> +    { -1.0f,  1.0f }
>> +};
>> +
>> +static const float zero[] = { 0.0f, 0.0f, 0.0f, 0.0f };
>> +
>> +static bool
>> +test_draw_negative_primcount()
>> +{
>> +    int first = 0;
>> +    GLsizei count = 4;
>> +
>> +    glClearColor(0.0, 0.0, 0.0, 0.0);
>> +    glClear(GL_COLOR_BUFFER_BIT);
>> +
>> +    glEnableClientState(GL_VERTEX_ARRAY);
>> +    glVertexPointer(2, GL_FLOAT, 0, verts);
>> +
>
> /**
>  * The GL spec says ....
>  */
>
> Maybe add this?
>
>> +    glMultiDrawArrays(GL_TRIANGLE_STRIP, &first, &count, -1);
>> +    if (!piglit_check_gl_error(GL_INVALID_VALUE))
>> +        return false;
>> +
>> +    return piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height,
>> zero);
>> +}
>> +
>> +static bool
>> +test_draw_negative_count()
>> +{
>> +    static const int first[2] = { 0, 0 };
>> +    static const GLsizei count[2] = { 4, -1 };
>> +
>> +    glClearColor(0.0, 0.0, 0.0, 0.0);
>> +    glClear(GL_COLOR_BUFFER_BIT);
>> +
>> +    glEnableClientState(GL_VERTEX_ARRAY);
>> +    glVertexPointer(2, GL_FLOAT, 0, verts);
>> +
>> +    glMultiDrawArrays(GL_TRIANGLE_STRIP, first, count, 2);
>> +    if (!piglit_check_gl_error(GL_INVALID_VALUE))
>> +        return false;
>> +
>> +    return piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
>> zero);
>> +}
>> +
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +    bool pass = true;
>> +
>> +#define subtest(name) \
>> +    do { \
>> +        if (!test_##name()) { \
>> +            printf(#name " test failed.\n"); \
>> +            pass = false; \
>> +        } \
>> +    } while (false)
>> +
>> +    subtest(draw_negative_count);
>> +    subtest(draw_negative_primcount);
>> +
>> +#undef subtest
>> +
>> +    return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>> +}
>> +
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +    /* nothing */
>> +}
>>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the Piglit mailing list