Mesa (glsl2): glsl2: Fix builtin prototypes defined in multiple glsl/ builtins/* files
Eric Anholt
anholt at kemper.freedesktop.org
Thu Jul 22 22:04:11 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 1bef4c8c4bc11e7f4150500def6e6a4291ceb587
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1bef4c8c4bc11e7f4150500def6e6a4291ceb587
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jul 22 14:57:55 2010 -0700
glsl2: Fix builtin prototypes defined in multiple glsl/builtins/* files
If we put the protos in separate ir_functions, they wouldn't be found
at lookup time for linking.
Fixes:
glsl-fs-texture2d-bias
glsl-fs-texture2dproj-bias
glsl-fs-texture2dproj-bias-2
glsl-lod-bias
glsl1-texture2D(), computed coordinate
---
src/glsl/ir_import_prototypes.cpp | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp
index 20aa8a6..5c5dc00 100644
--- a/src/glsl/ir_import_prototypes.cpp
+++ b/src/glsl/ir_import_prototypes.cpp
@@ -55,7 +55,17 @@ public:
virtual ir_visitor_status visit_enter(ir_function *ir)
{
assert(this->function == NULL);
- this->function = new(this->mem_ctx) ir_function(ir->name);
+
+ this->function = this->symbols->get_function(ir->name);
+ if (!this->function) {
+ this->function = new(this->mem_ctx) ir_function(ir->name);
+
+ list->push_tail(this->function);
+
+ /* Add the new function to the symbol table.
+ */
+ this->symbols->add_function(this->function->name, this->function);
+ }
return visit_continue;
}
@@ -64,15 +74,6 @@ public:
(void) ir;
assert(this->function != NULL);
- /* Add the new function (and all its signatures) to the end of the
- * instruction stream.
- */
- list->push_tail(this->function);
-
- /* Add the new function to the symbol table.
- */
- this->symbols->add_function(this->function->name, this->function);
-
this->function = NULL;
return visit_continue;
}
More information about the mesa-commit
mailing list