[Mesa-dev] [PATCH] glsl: Fail linking if a global is both a uniform and non-uniform.

Chad Versace chad at chad-versace.us
Thu Aug 25 13:30:07 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We weren't catching this? Embarrassing.

Reviewed-by: Chad Versace <chad at chad-versace.us>

We may also want to emit an error when a variable is declared as 'in'
a VS and as 'out' in a FS. But I'm not sure that's actually illegal.

On 08/25/2011 08:26 AM, Kenneth Graunke wrote:
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/linker.cpp |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index f970bce..7337c11 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -366,6 +366,13 @@ cross_validate_globals(struct gl_shader_program *prog,
>  	       }
>  	    }
>  
> +	    if ((var->mode == ir_var_uniform) != (existing->mode == ir_var_uniform)) {
> +	       linker_error_printf(prog, "%s is declared both as %s and %s\n",
> +				   var->name,
> +				   mode_string(var), mode_string(existing));
> +	       return false;
> +	    }
> +
>  	    if (var->explicit_location) {
>  	       if (existing->explicit_location
>  		   && (var->location != existing->location)) {
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVrDPAAoJEAIvNt057x8i7oUP/2YytmNkcK4UVadoKIPGG+vs
5f9tinklD3g4yN+daWa3xpwL9kKQCSu4t5mPtuoKzzUdMyy4V71e1rGgCiYJu5B4
sFhjD5I1MrTpi/HpnRMSET1uRuZUypD0UFzTW7YjKPBnMf7LAvt506eRfEnhraO9
hZyTLHF5wLq75ktuITdflQlCVQBbv+NGlUC0QjbKT4tta+fXobd0kVIx90W0u9KQ
5UJgbCUphjPJ02anh9Dzf3q0Pmw8sCGXtd56aM/7Rq4thGKGb1rCaA4h4FNpJB/p
lzb9XDq4Fzfe2eauf6fQwrEr15oJdROI2ll5TNRPDePQ2qPnNi2ScpfahZXM71+U
FqsjqFjOAAYWuP0Of0yX4rKybb4dVfAeHbUoBVvkp0WdOvE8iLy+Esf8ZGpkn+VO
/66C24//eKJ7+M0ODJ811olmFg3n1ymk2umq314QbuqsqWu0lSe7dvIxtaQHd04o
wh2AjpbuwyC76nBw7oznvRBs5ymhb6kNVJ78/GJr74zZKq1bJuVZUs1sgD77/s8u
8ETHuzsyRUlZ8padCY1OagYp7J8leVTLPvp3UP/D7ZR/3at5vlSKYqFGCTuPdexf
bbixLenx1+LBGQOXzYyw/9OWDn04Sx6kgoN4ldQdzj/TmfeLMtEE3W4nfwSDdKzs
Q+yV76qrGR1jyjXaoc95
=QNXa
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list