X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foptimize.cpp;h=57182019012b731ba330e7fc38a1e86f1f2eeeaf;hb=0ded10909240623e33712be80855827d440f3caf;hp=475e8b646de280261b0b1347bf1339a84de578b8;hpb=dfcf8ebc329b79c369b88bdbeb982480aa5fc12a;p=libs%2Fgl.git diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 475e8b64..57182019 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -123,7 +123,7 @@ InlineContentInjector::InlineContentInjector(): pass(REFERENCED) { } -const string &InlineContentInjector::apply(Stage &stage, FunctionDeclaration &target_func, Block &tgt_blk, const NodeList::iterator &ins_pt, FunctionCall &call) +string InlineContentInjector::apply(Stage &stage, FunctionDeclaration &target_func, Block &tgt_blk, const NodeList::iterator &ins_pt, FunctionCall &call) { source_func = call.declaration->definition; @@ -914,33 +914,10 @@ bool UnusedTypeRemover::apply(Stage &stage) return !unused_nodes.empty(); } -void UnusedTypeRemover::visit(Literal &literal) +void UnusedTypeRemover::visit(RefPtr &expr) { - unused_nodes.erase(literal.type); -} - -void UnusedTypeRemover::visit(UnaryExpression &unary) -{ - unused_nodes.erase(unary.type); - TraversingVisitor::visit(unary); -} - -void UnusedTypeRemover::visit(BinaryExpression &binary) -{ - unused_nodes.erase(binary.type); - TraversingVisitor::visit(binary); -} - -void UnusedTypeRemover::visit(TernaryExpression &ternary) -{ - unused_nodes.erase(ternary.type); - TraversingVisitor::visit(ternary); -} - -void UnusedTypeRemover::visit(FunctionCall &call) -{ - unused_nodes.erase(call.type); - TraversingVisitor::visit(call); + unused_nodes.erase(expr->type); + TraversingVisitor::visit(expr); } void UnusedTypeRemover::visit(BasicTypeDeclaration &type) @@ -966,6 +943,7 @@ void UnusedTypeRemover::visit(StructDeclaration &strct) void UnusedTypeRemover::visit(VariableDeclaration &var) { unused_nodes.erase(var.type_declaration); + TraversingVisitor::visit(var); } void UnusedTypeRemover::visit(InterfaceBlock &iface)