[Piglit] [PATCH] GL 3.2: Test that GetTexLevelParameterfv() generates an error when passed TEXTURE_BORDER

Chad Versace chad.versace at linux.intel.com
Mon Sep 30 16:13:32 PDT 2013


On 09/27/2013 03:07 PM, Nicholas Mack wrote:
> ---
>   tests/spec/gl-3.2/CMakeLists.gl.txt           |  1 +
>   tests/spec/gl-3.2/texture-border-deprecated.c | 63 +++++++++++++++++++++++++++
>   2 files changed, 64 insertions(+)
>   create mode 100644 tests/spec/gl-3.2/texture-border-deprecated.c


This needs to get added to all.tests.



> +
> +/**
> + * Test that GetTexLevelParameterfv() generates an error if passed
> + * TEXTURE_BORDER.
> + *
> + * In GL 3.2 core spec section 6.1.3 (Enumerated Queries), TEXTURE_BORDER is not
> + * included in the list of acceptable targets for GetTexLevelParameterfv()
> + *
> + */

The above comment needs a Doxygen \file command. Like this:

     /**
      * \file
      * Test that blah blah.
      *
      * In GL 3.2 there is stuff.
      */

Otherwise, Doxygen applies this comment to first following symbol rather than
to the file itself.

> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_core_version = 32;
> +	config.supports_gl_compat_version = 32;

This test verifies behavior that is present *only* in the Core profile. The
test is invalid for the compatibility profile. So, set `support_gl_compat_version = 0`.

> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	/* UNREACHED */
> +	return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	bool pass = true;
> +	GLfloat data = -1;
> +
> +	glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &data);

I don't think it's legal to call this unless a texture is actually bound to
GL_TEXTURE_2D. But I could be wrong. That is, I think you need this first:

glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);

> +
> +	if(piglit_check_gl_error(GL_NO_ERROR)) {
> +		printf("Expected an error but did not recieve any.\n");
> +		pass = false;
> +	}

The specific error expected is GL_INVALID_ENUM.

> +
> +	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
>



More information about the Piglit mailing list