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

Brian Paul brianp at vmware.com
Tue Jun 17 06:30:54 PDT 2014


On 06/16/2014 07:32 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.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>   tests/spec/gl-3.0/required-sized-texture-formats.c | 26 +++++++++++++++++-----
>   1 file changed, 21 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..e549977 100644
> --- a/tests/spec/gl-3.0/required-sized-texture-formats.c
> +++ b/tests/spec/gl-3.0/required-sized-texture-formats.c
> @@ -88,9 +88,12 @@ 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);
>
> +

Needless whitespace change.

>   	glGenTextures(1, &tex);
>   	glBindTexture(GL_TEXTURE_2D, tex);
>
> @@ -146,12 +149,25 @@ piglit_init(int argc, char **argv)
>   		}
>
>   		for (c = 0; c < CHANNELS; c++) {
> -			glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> -						 size_queries[c], &sizes[c]);
> -			if (c != S) {
> +			if (compat_profile
> +			    || (size_queries[c] != GL_TEXTURE_LUMINANCE_SIZE
> +				&& size_queries[c] != GL_TEXTURE_INTENSITY_SIZE)) {
>   				glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> -							 type_queries[c],
> -							 &types[c]);
> +							 size_queries[c], &sizes[c]);
> +			} else {
> +				sizes[c] = 0;
> +			}
> +
> +			if (c != S) {
> +				if (compat_profile
> +				    || (type_queries[c] != GL_TEXTURE_LUMINANCE_TYPE
> +					&& type_queries[c] != GL_TEXTURE_INTENSITY_TYPE)) {
> +					glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> +								 type_queries[c],
> +								 &types[c]);
> +				} else {
> +					types[c] = 0;
> +				}
>   			} else {
>   				/* For stencil, there's no query for
>   				 * the type, so our table above
>

It might be nice to put the glGetTexLevelParameteriv() call and 
surrounding checks into a separate function, but not a big deal.

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



More information about the Piglit mailing list