[Mesa-dev] [PATCH] glsl: Use ir_var_temporary when generating inline functions.

Kenneth Graunke kenneth at whitecape.org
Mon Dec 19 23:33:13 UTC 2016


On Monday, December 19, 2016 3:29:13 PM PST Kenneth Graunke wrote:
> We were using ir_var_auto for the inlined function parameter variables,
> which is wrong, as it suggests that those are real variables declared
> by the program.
> 
> Normally this doesn't matter.  However, if you called built-ins at
> global scope, it would pollute the global variable namespace with
> these new parameter temporaries.  If the shader already had variables
> with those names, the linker might see contradictory global variable
> declarations and raise an error.
> 
> Making them temporaries indicates that these are just things generated
> by the compiler internally.  This avoids confusing the linker.
> 
> Fixes a new Piglit test: glsl-fs-multiple-builtins.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99097

That should be
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99154

(fixed locally)

> Reported-by: Niels Ole Salscheider <niels_ole at salscheider-online.de>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/compiler/glsl/opt_function_inlining.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/opt_function_inlining.cpp b/src/compiler/glsl/opt_function_inlining.cpp
> index 62c1f4b..78a726b 100644
> --- a/src/compiler/glsl/opt_function_inlining.cpp
> +++ b/src/compiler/glsl/opt_function_inlining.cpp
> @@ -164,7 +164,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
>  	 parameters[i] = NULL;
>        } else {
>  	 parameters[i] = sig_param->clone(ctx, ht);
> -	 parameters[i]->data.mode = ir_var_auto;
> +	 parameters[i]->data.mode = ir_var_temporary;
>  
>  	 /* Remove the read-only decoration because we're going to write
>  	  * directly to this variable.  If the cloned variable is left
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161219/f02b4916/attachment.sig>


More information about the mesa-dev mailing list