[Piglit] [PATCH 4/8] arb_texture_multisample: new test for teximage state

Chris Forbes chrisf at ijw.co.nz
Mon Jan 7 13:19:49 PST 2013


I do indeed.

On Tue, Jan 8, 2013 at 10:11 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> On 5 January 2013 01:07, Chris Forbes <chrisf at ijw.co.nz> wrote:
>>
>> This tests that the new teximage state added in ARB_texture_multisample
>> exists and has correct defaults for non-multisample textures:
>>
>>     - GL_TEXTURE_SAMPLES = 0
>>     - GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = false
>
>
> I think you mean "true" here.
>
>>
>>
>> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>> ---
>>  tests/all.tests                                    |  1 +
>>  .../spec/arb_texture_multisample/CMakeLists.gl.txt |  1 +
>>  tests/spec/arb_texture_multisample/texstate.c      | 58
>> ++++++++++++++++++++++
>>  3 files changed, 60 insertions(+)
>>  create mode 100644 tests/spec/arb_texture_multisample/texstate.c
>>
>> diff --git a/tests/all.tests b/tests/all.tests
>> index 379964f..9963e46 100644
>> --- a/tests/all.tests
>> +++ b/tests/all.tests
>> @@ -845,6 +845,7 @@ arb_texture_multisample = Group()
>>  spec['ARB_texture_multisample'] = arb_texture_multisample
>>  add_concurrent_test(arb_texture_multisample,
>> 'arb_texture_multisample-minmax')
>>  add_concurrent_test(arb_texture_multisample,
>> 'arb_texture_multisample-fb-completeness')
>> +add_concurrent_test(arb_texture_multisample,
>> 'arb_texture_multisample-texstate')
>>
>>  # Group AMD_shader_stencil_export
>>  spec['AMD_shader_stencil_export'] = Group()
>> diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
>> b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
>> index d793256..d4cd51f 100644
>> --- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
>> @@ -12,5 +12,6 @@ link_libraries (
>>
>>  piglit_add_executable (arb_texture_multisample-minmax minmax.c)
>>  piglit_add_executable (arb_texture_multisample-fb-completeness
>> fb-completeness.c)
>> +piglit_add_executable (arb_texture_multisample-texstate texstate.c)
>>
>>  # vim: ft=cmake:
>> diff --git a/tests/spec/arb_texture_multisample/texstate.c
>> b/tests/spec/arb_texture_multisample/texstate.c
>> new file mode 100644
>> index 0000000..37c111e
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_multisample/texstate.c
>> @@ -0,0 +1,58 @@
>> +#include "piglit-util-gl-common.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +    config.supports_gl_compat_version = 30;
>> +
>> +    config.window_width = 10;
>> +    config.window_height = 10;
>> +    config.window_visual = PIGLIT_GL_VISUAL_RGB;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +    return PIGLIT_FAIL;
>> +}
>> +
>> +static bool
>> +check_texlevelparameter_int(GLuint target, GLuint level,
>> +        char const *name, GLuint pname, GLint expected_value)
>> +{
>> +    GLint actual_value;
>> +    glGetTexLevelParameteriv(target, level, pname, &actual_value);
>> +    if (!piglit_check_gl_error(GL_NO_ERROR))
>> +        return false;
>> +
>> +    if (actual_value != expected_value) {
>> +        printf("Expected %s value of %d but got %d\n",
>> +                name, expected_value, actual_value);
>> +        return false;
>> +    }
>> +
>> +    return true;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +    GLuint tex2d;
>> +    bool pass = true;
>> +    piglit_require_extension("GL_ARB_texture_multisample");
>> +
>> +    /* check that new image state required by ARB_texture_multisample
>> +     * exists, and has correct defaults. Tests against a non-multisample
>> +     * texture target, since this state exists on all images. */
>> +
>> +    glGenTextures(1, &tex2d);
>> +    glBindTexture(GL_TEXTURE_2D, tex2d);
>> +    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA,
>> GL_UNSIGNED_BYTE, 0);
>> +
>> +    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0,
>> "GL_TEXTURE_SAMPLES",
>> +            GL_TEXTURE_SAMPLES, 0) && pass;
>> +    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0,
>> "GL_TEXTURE_FIXED_SAMPLE_LOCATIONS",
>> +            GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_TRUE) && pass;
>> +
>> +    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
>> +}
>> --
>> 1.8.1
>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit
>
>


More information about the Piglit mailing list