]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/optimize.cpp
Adjust GLSL builtins
[libs/gl.git] / source / glsl / optimize.cpp
index 927047cc7c1e387890bf4a3d1a4a784e2039c7ac..0f765c2a4aa6ce23edd99f2dd0fed35e4041bd3c 100644 (file)
@@ -75,7 +75,7 @@ void InlineableFunctionLocator::visit(FunctionCall &call)
                ++count;
                /* Don't inline functions which are called more than once or are called
                recursively. */
-               if(count>1 || def==current_function)
+               if((count>1 && def->source!=BUILTIN_SOURCE) || def==current_function)
                        inlineable.erase(def);
        }
 
@@ -89,7 +89,7 @@ void InlineableFunctionLocator::visit(FunctionDeclaration &func)
                has_out_params = ((*i)->interface=="out");
 
        unsigned &count = refcounts[func.definition];
-       if(count<=1 && !has_out_params)
+       if((count<=1 || func.source==BUILTIN_SOURCE) && !has_out_params)
                inlineable.insert(func.definition);
 
        SetForScope<FunctionDeclaration *> set(current_function, &func);