[Piglit] [PATCH] shader_runner: Support "matN" notation for loading uniforms.

Ian Romanick idr at freedesktop.org
Wed Jan 18 15:28:32 PST 2012


On 01/17/2012 10:42 PM, Kenneth Graunke wrote:
> Prior to this patch, shader_runner only accepted the "matMxN" notation,
> rejecting the simpler "matN" form.  Since "matN" is by far more common,
> it makes sense to support "mat4" rather than requiring "mat4x4".

When I added matMxN support I intentionally left out matN.  It just adds 
extra crap to shader_runner, which is already out of control.  You can 
use matMxN with a shader code that uses matN, so I don't see the point. 
  Maybe you can convince me otherwise?

> Signed-off-by: Kenneth Graunke<kenneth at whitecape.org>
> ---
>   tests/shaders/shader_runner.c |   14 +++++++-------
>   1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index b9d0974..c666677 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -807,12 +807,12 @@ set_uniform(const char *line)
>   			piglit_Uniform4uiv(loc, 1, uints);
>   			return;
>   		}
> -	} else if ((string_match("mat", type))
> -		&&  (type[3] != '\0')
> -		&&  (type[4] == 'x')) {
> -		switch (type[3]) {
> +	} else if (string_match("mat", type)&&  type[3] != '\0') {
> +		char cols = type[3];
> +		char rows = type[4] == 'x' ? type[5] : cols;
> +		switch (cols) {
>   		case '2':
> -			switch (type[5]) {
> +			switch (rows) {
>   			case '2':
>   				get_floats(line, f, 4);
>   				piglit_UniformMatrix2fv(loc, 1, GL_FALSE, f);
> @@ -827,7 +827,7 @@ set_uniform(const char *line)
>   				return;
>   			}
>   		case '3':
> -			switch (type[5]) {
> +			switch (rows) {
>   			case '2':
>   				get_floats(line, f, 6);
>   				piglit_UniformMatrix3x2fv(loc, 1, GL_FALSE, f);
> @@ -842,7 +842,7 @@ set_uniform(const char *line)
>   				return;
>   			}
>   		case '4':
> -			switch (type[5]) {
> +			switch (rows) {
>   			case '2':
>   				get_floats(line, f, 8);
>   				piglit_UniformMatrix4x2fv(loc, 1, GL_FALSE, f);


More information about the Piglit mailing list