[Piglit] [PATCH V2 2/2] arb_texture_storage_multisample: add new tex-param test

Eric Anholt eric at anholt.net
Wed May 8 15:10:25 PDT 2013


Other than the style notes from the previous test...

Chris Forbes <chrisf at ijw.co.nz> writes:
> +void
> +check_subtest(struct subtest *t)
> +{
> +    GLint val;
> +    const char *test_name = t->label ? t->label : piglit_get_gl_enum_name(t->param);
> +
> +    glGetTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, t->param, &val);
> +
> +    if (!piglit_check_gl_error(GL_NO_ERROR)) {
> +        printf("GetTexParameteriv failed\n");
> +        piglit_report_subtest_result(PIGLIT_FAIL, test_name);
> +        return;
> +    }
> +
> +    if (t->initial_value != val) {
> +        printf("parameter %s expected initially %d, got %d\n",
> +                piglit_get_gl_enum_name(t->param),
> +                t->initial_value,
> +                val);
> +        piglit_report_subtest_result(PIGLIT_FAIL, test_name);
> +        return;
> +    }
> +
> +    glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, t->param, t->value);
> +
> +    if (!piglit_check_gl_error(t->expected_error)) {
> +        printf("error setting parameter %s\n",
> +                piglit_get_gl_enum_name(t->param));
> +        piglit_report_subtest_result(PIGLIT_FAIL, test_name);
> +        return;
> +    }

Idea for more thorough test: check that the new parameter we tried to
set didn't land by getting and checking for the initial value again?

> +    piglit_report_subtest_result(PIGLIT_PASS, test_name);
> +}


> +void
> +piglit_init(int argc, char **argv)
> +{
> +    GLuint tex;
> +    GLint param;
> +    struct subtest *t = subtests;
> +
> +    piglit_require_extension("GL_ARB_texture_storage_multisample");
> +
> +    glGenTextures(1, &tex);
> +    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
> +    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
> +            4, GL_RGBA, 64, 64, GL_TRUE);
> +
> +    for (; t->param; t++)
> +        check_subtest(t);

Move the initialization of t down here?  this loop looks really weird
otherwise.

> +
> +    piglit_report_result(PIGLIT_PASS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130508/a6022e48/attachment.pgp>


More information about the Piglit mailing list