[Piglit] [PATCH 5/6] built-in-constants: Fix up tessellation shader #extension work-around for ES

Tapani Pälli tapani.palli at intel.com
Tue Jul 26 10:50:50 UTC 2016



On 07/21/2016 10:04 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  tests/shaders/built-in-constants.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/tests/shaders/built-in-constants.c b/tests/shaders/built-in-constants.c
> index be4eb64..16bba8a 100644
> --- a/tests/shaders/built-in-constants.c
> +++ b/tests/shaders/built-in-constants.c
> @@ -463,11 +463,20 @@ piglit_init(int argc, char **argv)
>  		piglit_report_result(PIGLIT_SKIP);
>
>  	/* Tessellation shaders must use the #extension directive. */
> -	if (piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
> -		assert(num_required_extensions < ARRAY_SIZE(required_extensions));
> -		required_extensions[num_required_extensions] =
> -			strdup("GL_ARB_tessellation_shader");
> -		num_required_extensions++;
> +	if (!es_shader) {
> +		if (piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
> +			assert(num_required_extensions < ARRAY_SIZE(required_extensions));
> +			required_extensions[num_required_extensions] =
> +				strdup("GL_ARB_tessellation_shader");
> +			num_required_extensions++;
> +		}
> +	} else {
> +		if (piglit_is_extension_supported("GL_OES_tessellation_shader")) {
> +			assert(num_required_extensions < ARRAY_SIZE(required_extensions));
> +			required_extensions[num_required_extensions] =
> +				strdup("GL_OES_tessellation_shader");
> +			num_required_extensions++;
> +		}

Maybe simpler/shorter would be to have:

const char *const ext_name = es_shader
			? "GL_OES_tessellation_shader"
			: "GL_ARB_tessellation_shader";

if (piglit_is_extension_supported(ext_name)) { ...

in similar manner as patch 2 does when requiring extension?

// Tapani


More information about the Piglit mailing list