[Piglit] [PATCH] fp-indirections: limit to 1024 indirections

Brian Paul brianp at vmware.com
Thu Sep 18 07:16:39 PDT 2014


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

Just a minor suggestion below (in 2 places).


On 09/18/2014 08:09 AM, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> The test takes ages (somewhere in the order of an hour) on llvmpipe, because
> the driver announces support for one million indirections (some drivers
> actually say billions even). It never gets compiled even, that hour is fully
> spent on string concatenation when constructing the shader in the test itself,
> which seems rather silly.
> Thus, follow fp-indirections2, which limits it to 1024 indirections. If you've
> got that many indirections the hw is pretty much guaranteed to not have a limit
> on that anyway.
> ---
>   tests/shaders/fp-indirections.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/tests/shaders/fp-indirections.c b/tests/shaders/fp-indirections.c
> index a25432f..927e3dc 100644
> --- a/tests/shaders/fp-indirections.c
> +++ b/tests/shaders/fp-indirections.c
> @@ -187,12 +187,14 @@ GLboolean test_temporary_dest_indirections(void)
>   	GLboolean pass = GL_TRUE;
>   	GLuint progname;
>   	char *prog;
> -	GLint indirections_limit;
> +	GLint indirections_limit, use_limit;
>   	GLint count;
>
>   	indirections_limit = get_program_i(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
>
> -	count = indirections_limit - 1;
> +	use_limit = indirections_limit > 1024 ? 1024 : indirections_limit;

use_limit = MIN2(indirections_limit, 1024);


> +
> +	count = use_limit - 1;
>   	printf("testing program with %d indirections from temporary dests\n",
>   	       count);
>   	prog = gen_temporary_dest_indirections(count, &progname);
> @@ -206,11 +208,11 @@ GLboolean test_temporary_dest_indirections(void)
>   		free(prog);
>   	}
>
> -	count = indirections_limit + 1;
> +	count = use_limit + 1;
>   	printf("testing program with %d indirections from temporary dests\n",
>   	       count);
>   	prog = gen_temporary_dest_indirections(count, &progname);
> -	if (prog != NULL) {
> +	if (prog != NULL && count > indirections_limit) {
>   		if (get_program_i(GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB)) {
>   			printf("Program with %d indirections unexpectedly "
>   			       "met native limits.\n", count);
> @@ -231,12 +233,14 @@ GLboolean test_temporary_source_indirections(void)
>   	GLboolean pass = GL_TRUE;
>   	GLuint progname;
>   	char *prog;
> -	GLint indirections_limit;
> +	GLint indirections_limit, use_limit;
>   	GLint count;
>
>   	indirections_limit = get_program_i(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB);
>
> -	count = indirections_limit - 1;
> +	use_limit = indirections_limit > 1024 ? 1024 : indirections_limit;

MIN2()


> +
> +	count = use_limit - 1;
>   	printf("testing program with %d indirections from temporary sources\n",
>   	       count);
>   	prog = gen_temporary_source_indirections(count, &progname);
> @@ -250,11 +254,11 @@ GLboolean test_temporary_source_indirections(void)
>   		free(prog);
>   	}
>
> -	count = indirections_limit + 1;
> +	count = use_limit + 1;
>   	printf("testing program with %d indirections from temporary sources\n",
>   	       count);
>   	prog = gen_temporary_source_indirections(count, &progname);
> -	if (prog != NULL) {
> +	if (prog != NULL && count > indirections_limit) {
>   		if (get_program_i(GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB)) {
>   			printf("Program with %d indirections unexpectedly "
>   			       "met native limits.\n", count);
>



More information about the Piglit mailing list