[Piglit] [PATCH v2] Expand immutability tests for ARB_texture_storage

Matt Turner mattst88 at gmail.com
Wed Jul 31 12:11:03 PDT 2013


On Wed, Jul 31, 2013 at 4:47 AM, Corey Richardson <corey at octayn.net> wrote:
> Previously, it only tests that various functions couldn't be called on an
> immutable texture. Now, also test that TEXTURE_IMMUTABLE_FORMAT is actually
> set, and that TEXTURE_{BASE,MAX}_LEVEL is clamped.
>
> Signed-off-by: Corey Richardson <corey at octayn.net>
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
> ---
>  tests/spec/arb_texture_storage/texture-storage.c | 52 +++++++++++++++++++++++-
>  1 file changed, 50 insertions(+), 2 deletions(-)
>
> diff --git a/tests/spec/arb_texture_storage/texture-storage.c b/tests/spec/arb_texture_storage/texture-storage.c
> index 1f24766..b92acae 100644
> --- a/tests/spec/arb_texture_storage/texture-storage.c
> +++ b/tests/spec/arb_texture_storage/texture-storage.c
> @@ -105,8 +105,15 @@ test_one_level_errors(GLenum target)
>                 }
>         }
>
> -       /*
> -        * Test immutability.
> +       /** Test immutability
> +        *
> +        * "Using any of the following commands with the same texture will result
> +        * in the error INVALID_OPERATION being generated, even if it does not
> +        * affect the dimensions or format:
> +        *     - TexImage*
> +        *     - CompressedTexImage*
> +        *     - CopyTexImage*
> +        *     - TexStorage*"
>          */
>         if (target == GL_TEXTURE_2D) {
>                 glTexImage2D(target, 0, GL_RGBA, width, height, 0,
> @@ -421,7 +428,47 @@ test_internal_formats(void)
>         return pass;
>  }
>
> +static bool
> +test_immutablity(GLenum target)
> +{
> +       GLuint tex;
> +       GLint level;
> +       GLint immutable_format;
> +       GLvoid *data;
> +
> +       bool pass = true;
> +
> +       glGenTextures(1, &tex);
> +       glBindTexture(target, tex);
>
> +       glTexStorage2D(target, 3, GL_RGBA8, 256, 256);
> +       glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, 4);
> +       glGetTexParameteriv(target, GL_TEXTURE_MAX_LEVEL, &level);
> +       glGetTexParameteriv(target, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable_format);
> +
> +       if (immutable_format != GL_TRUE) {
> +               printf("%s: GL_TEXTURE_IMMUTABLE_FORMAT was not set to GL_TRUE after"
> +                      " glTexStorage2D\n", TestName);
> +               pass = false;
> +       }
> +       if (level != 2) {

This was level != 4 in the previous patch. Shouldn't you be checking
that level != 3 -> error?


More information about the Piglit mailing list