Skip to content
Snippets Groups Projects
Commit 704072af authored by Kenneth Graunke's avatar Kenneth Graunke Committed by Emil Velikov
Browse files

glsl: Use ir_var_temporary when generating inline functions.

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=99154


Reported-by: default avatarNiels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Reviewed-by: default avatarIlia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: default avatarIago Toral Quiroga <itoral@igalia.com>
(cherry picked from commit 62b8bcda)
parent d88fee9d
No related branches found
No related tags found
Loading
......@@ -128,7 +128,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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment