summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/link_functions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp
index d40f771e342..acee3271249 100644
--- a/src/glsl/link_functions.cpp
+++ b/src/glsl/link_functions.cpp
@@ -104,10 +104,12 @@ public:
if (f == NULL) {
f = new(linked) ir_function(name);
- /* Add the new function to the linked IR.
+ /* Add the new function to the linked IR. Put it at the end
+ * so that it comes after any global variable declarations
+ * that it refers to.
*/
linked->symbols->add_function(f);
- linked->ir->push_head(f);
+ linked->ir->push_tail(f);
}
ir_function_signature *linked_sig =