]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/optimize.cpp
Count EmitVertex as referencing all active outputs
[libs/gl.git] / source / glsl / optimize.cpp
index 080bfd7c2705001a40fdf8b97abeb9401c4821bd..441a73a072e8df7740c27b62f9d3c5cc1f9596b2 100644 (file)
@@ -728,6 +728,13 @@ void UnusedVariableRemover::visit(FunctionCall &call)
        /* Treat function calls as having side effects so expression statements
        consisting of nothing but a function call won't be optimized away. */
        r_side_effects = true;
+
+       if(stage->type==Stage::GEOMETRY && call.name=="EmitVertex")
+       {
+               for(map<Statement *, VariableInfo>::const_iterator i=variables.begin(); i!=variables.end(); ++i)
+                       if(i->second.output)
+                               referenced(i->first, call);
+       }
 }
 
 void UnusedVariableRemover::record_assignment(const Assignment::Target &target, Node &node)