[Piglit] [PATCH] gl-3.0: Don't query GL_TEXTURE_{LUMINANCE, INTENSITY}_* outside compat profile

Brian Paul brianp at vmware.com
Tue Jun 17 11:41:00 PDT 2014


On 06/17/2014 12:36 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> There are no queries for GL_TEXTURE_LUMINANCE_SIZE,
> GL_TEXTURE_INTENSITY_SIZE, GL_TEXTURE_LUMINANCE_TYPE, or
> GL_TEXTURE_INTENSITY_TYPE in any version of OpenGL ES or desktop OpenGL
> core profile.
>
> v2: Move call to glGetTexLevelParameteriv to a separate function.
> Suggested by Brian.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>   tests/spec/gl-3.0/required-sized-texture-formats.c | 35 ++++++++++++++++++----
>   1 file changed, 30 insertions(+), 5 deletions(-)
>
> diff --git a/tests/spec/gl-3.0/required-sized-texture-formats.c b/tests/spec/gl-3.0/required-sized-texture-formats.c
> index ed94470..3fe00f7 100644
> --- a/tests/spec/gl-3.0/required-sized-texture-formats.c
> +++ b/tests/spec/gl-3.0/required-sized-texture-formats.c
> @@ -82,12 +82,34 @@ piglit_display(void)
>   	return PIGLIT_FAIL;
>   }
>
> +static void
> +GetTexLevelParameteriv(GLenum target, GLuint level, GLenum pname, GLint *value,
> +		      bool compat_profile)
> +{
> +	if (!compat_profile) {
> +		switch (pname) {
> +		case GL_TEXTURE_LUMINANCE_SIZE:
> +		case GL_TEXTURE_INTENSITY_SIZE:
> +		case GL_TEXTURE_LUMINANCE_TYPE:
> +		case GL_TEXTURE_INTENSITY_TYPE:
> +			*value = 0;
> +			return;
> +		default:
> +			break;
> +		}
> +	}
> +
> +	glGetTexLevelParameteriv(target, level, pname, value);
> +}
> +
>   void
>   piglit_init(int argc, char **argv)
>   {
>   	bool pass = true;
>   	GLuint tex;
>   	int i, c;
> +	const bool compat_profile = !piglit_is_gles() &&
> +		!piglit_is_core_profile;
>
>   	piglit_require_gl_version(target_version);
>
> @@ -146,12 +168,15 @@ piglit_init(int argc, char **argv)
>   		}
>
>   		for (c = 0; c < CHANNELS; c++) {
> -			glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> -						 size_queries[c], &sizes[c]);
> +			GetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> +					       size_queries[c], &sizes[c],
> +					       compat_profile);
> +
>   			if (c != S) {
> -				glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> -							 type_queries[c],
> -							 &types[c]);
> +				GetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> +						       type_queries[c],
> +						       &types[c],
> +						       compat_profile);
>   			} else {
>   				/* For stencil, there's no query for
>   				 * the type, so our table above
>

I'd have probably moved the compat_profile stuff into the function too, 
but no big deal.

Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the Piglit mailing list