[Piglit] [PATCH 1/4] shader_runner: Re-use struct string_to_enum for enable_table.

Ian Romanick idr at freedesktop.org
Tue Oct 1 12:55:56 PDT 2013


Patches 1, 2, and 4 are, as-is,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

Patch 3 is with the change suggested.

On 10/01/2013 12:32 PM, Paul Berry wrote:
> ---
>  tests/shaders/shader_runner.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 463eddc..51358b4 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -76,6 +76,11 @@ struct component_version {
>  	char _string[100];
>  };
>  
> +struct string_to_enum {
> +	const char *name;
> +	GLenum token;
> +};
> +
>  extern float piglit_tolerance[4];
>  
>  static struct component_version gl_version;
> @@ -1377,10 +1382,7 @@ set_parameter(const char *line)
>  	}
>  }
>  
> -struct enable_table {
> -	const char *name;
> -	GLenum value;
> -} enable_table[] = {
> +struct string_to_enum enable_table[] = {
>  	{ "GL_CLIP_PLANE0", GL_CLIP_PLANE0 },
>  	{ "GL_CLIP_PLANE1", GL_CLIP_PLANE1 },
>  	{ "GL_CLIP_PLANE2", GL_CLIP_PLANE2 },
> @@ -1404,9 +1406,9 @@ do_enable_disable(const char *line, bool enable_flag)
>  	for (i = 0; enable_table[i].name; ++i) {
>  		if (0 == strcmp(name, enable_table[i].name)) {
>  			if (enable_flag) {
> -				glEnable(enable_table[i].value);
> +				glEnable(enable_table[i].token);
>  			} else {
> -				glDisable(enable_table[i].value);
> +				glDisable(enable_table[i].token);
>  			}
>  			return;
>  		}
> @@ -1449,11 +1451,6 @@ draw_instanced_rect(int primcount, float x, float y, float w, float h)
>  }
>  
>  
> -struct string_to_enum {
> -	const char *name;
> -	GLenum token;
> -};
> -
>  GLenum
>  decode_drawing_mode(const char *mode_str)
>  {
> 



More information about the Piglit mailing list