[Piglit] [PATCH] glsl-max-varyings: Allow up to 256 varyings.

Jose Fonseca jfonseca at vmware.com
Mon Apr 22 04:00:41 PDT 2013



----- Original Message -----
> Increase the supported number of varyings from 32 to 256.
> Shrink test rectangles from 10x10 pixels to 2x2 pixels.
> ---
>  tests/shaders/glsl-max-varyings.c |   20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/shaders/glsl-max-varyings.c
> b/tests/shaders/glsl-max-varyings.c
> index 323f4c0..0baed21 100644
> --- a/tests/shaders/glsl-max-varyings.c
> +++ b/tests/shaders/glsl-max-varyings.c
> @@ -33,16 +33,16 @@
>  
>  #include "piglit-util-gl-common.h"
>  
> -#define MAX_VARYING 32
> +#define MAX_VARYING 256
>  
> -/* 10x10 rectangles with 2 pixels of pad.  Deal with up to 32 varyings. */
> +/* 2x2 rectangles with 2 pixels of pad.  Deal with up to 256 varyings. */
>  
>  PIGLIT_GL_TEST_CONFIG_BEGIN
>  
>  	config.supports_gl_compat_version = 10;
>  
> -	config.window_width = (2+MAX_VARYING*12);
> -	config.window_height = (2+MAX_VARYING*12);
> +	config.window_width = (2+MAX_VARYING*4);
> +	config.window_height = (2+MAX_VARYING*4);
>  	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>  
>  PIGLIT_GL_TEST_CONFIG_END
> @@ -57,7 +57,7 @@ static GLint get_vs(int num_varyings, int data_varying)
>  {
>  	GLuint shader;
>  	unsigned i;
> -	char code[2048], temp[2048];
> +	char code[4096], temp[2048];
>  
>  	code[0] = 0;
>  	for (i = 0; i < num_varyings; i++) {
> @@ -107,7 +107,7 @@ static GLint get_fs(int num_varyings, int data_varying)
>  {
>  	GLuint shader;
>  	unsigned i;
> -	char code[2048], temp[2048];
> +	char code[8192], temp[2048];

Please use mallocs for such large arrays, to prevent stack overflows on Windows or other platforms with smaller stacks.

Jose

>  
>  	code[0] = 0;
>  	for (i = 0; i < num_varyings; i++) {
> @@ -147,7 +147,7 @@ static GLint get_fs(int num_varyings, int data_varying)
>  static int
>  coord_from_index(int index)
>  {
> -	return 2 + 12 * index;
> +	return 2 + 4 * index;
>  }
>  
>  static bool
> @@ -208,8 +208,8 @@ draw(int num_varyings)
>  
>  		piglit_draw_rect(coord_from_index(data_varying),
>  				 coord_from_index(num_varyings - 1),
> -				 10,
> -				 10);
> +				 2,
> +				 2);
>  
>  		glDeleteShader(vs);
>  		glDeleteShader(fs);
> @@ -262,7 +262,7 @@ piglit_display(void)
>  
>  			ok = piglit_probe_rect_rgb(coord_from_index(col),
>  						   coord_from_index(row),
> -						   10, 10,
> +						   2, 2,
>  						   green);
>  			if (!ok) {
>  				printf("  Failure with %d vec4 varyings used "
> --
> 1.7.10.4
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 


More information about the Piglit mailing list