[Piglit] [PATCH] Expand immutability tests for ARB_texture_storage
Matt Turner
mattst88 at gmail.com
Tue Jul 30 11:57:56 PDT 2013
On Tue, Jul 30, 2013 at 11:40 AM, Corey Richardson <corey at octayn.net> wrote:
> Signed-off-by: Corey Richardson <corey at octayn.net>
> ---
> tests/spec/arb_texture_storage/texture-storage.c | 55 ++++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
>
> diff --git a/tests/spec/arb_texture_storage/texture-storage.c b/tests/spec/arb_texture_storage/texture-storage.c
> index 1f24766..0f355a7 100644
> --- a/tests/spec/arb_texture_storage/texture-storage.c
> +++ b/tests/spec/arb_texture_storage/texture-storage.c
> @@ -421,7 +421,61 @@ test_internal_formats(void)
> return pass;
> }
>
> +static bool
> +test_immutablity(GLenum target)
> +{
> + GLuint tex;
> + GLint level;
> + GLint immutable_format;
> +
> + 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);
Indent this line with tabs and then align with the opening " on the
previous line using spaces.
> + pass = false;
> + }
> + if (level != 3) {
> + /**
> + * "However, if TEXTURE_IMMUTABLE_FORMAT is TRUE, then level_base is
> + * clamped to the range [0, <levels> - 1] and level_max is then
> + * clamped to the range [level_base, <levels> - 1], where <levels> is
> + * the parameter passed the call to TexStorage* for the texture
> + * object"
> + */
> + printf("%s: GL_TEXTURE_MAX_LEVEL changed to %d, which is outside"
> + " the clamp range for immutables\n", TestName, level);
Same.
> + pass = false;
> + }
> +
> + /**
> + * "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*"
> + */
> + glTexStorage2D(target, 3, GL_RGBA8, 256, 256);
For completeness, you could call each function and verify. I don't
feel strongly either way but others may.
> + if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
> + printf("%s: cannot call glTexStorage2D on a texture twice"
> + " but doing so didn't raise an error.\n",
> + TestName);
Same (alignment).
> + pass = false;
> + }
> +
> + glDeleteTextures(1, &tex);
> + return pass;
> +}
>
> enum piglit_result
> piglit_display(void)
> @@ -436,6 +490,7 @@ piglit_display(void)
> pass = test_mipmap_errors(GL_TEXTURE_3D) && pass;
> pass = test_2d_mipmap_rendering() && pass;
> pass = test_internal_formats() && pass;
> + pass = test_immutablity(GL_TEXTURE_2D) && pass;
>
> return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> }
> --
> 1.8.3.4
This test looks good to me, and it exposes a bug in Mesa which you can
now investigate. :)
With the couple of review comments addressed:
Reviewed-by: Matt Turner <mattst88 at gmail.com>
As a follow-on patch, you could convert this file to use
piglit_report_subtest_result() for each of the cases tested in
piglit_display().
More information about the Piglit
mailing list