void DefaultPrecisionGenerator::apply(Stage &s)
{
stage = &s;
- visit(s.content);
+ s.content.visit(*this);
}
void DefaultPrecisionGenerator::visit(Block &block)
void PrecisionRemover::apply(Stage &stage)
{
- visit(stage.content);
+ stage.content.visit(*this);
NodeRemover().apply(stage, nodes_to_remove);
}
features = feat;
if(!supports_stage(s.type))
throw unsupported_shader(format("Stage %s is not supported", Stage::get_stage_name(s.type)));
- visit(s.content);
+ s.content.visit(*this);
}
void LegacyConverter::visit(Block &block)
virtual void visit(Block &);
virtual void visit(Precision &);
virtual void visit(VariableDeclaration &);
- using TraversingVisitor::visit;
};
class PrecisionRemover: private TraversingVisitor
private:
virtual void visit(Precision &);
virtual void visit(VariableDeclaration &);
- using TraversingVisitor::visit;
};
class LegacyConverter: private TraversingVisitor
virtual void visit(VariableDeclaration &);
bool supports_interface_blocks(const std::string &) const;
virtual void visit(InterfaceBlock &);
- using TraversingVisitor::visit;
};
} // namespace SL
for(map<string, VariableDeclaration *>::const_iterator i=stage.out_variables.begin(); i!=stage.out_variables.end(); ++i)
append(format("Output: %%%d %s %s", get_label(*i->second), i->second->type, i->first));
last_branch();
- visit(stage.content);
+ stage.content.visit(*this);
return formatted;
}
virtual void visit(Passthrough &);
virtual void visit(Return &);
virtual void visit(Jump &);
- using TraversingVisitor::visit;
};
} // namespace SL
void DeclarationCombiner::apply(Stage &stage)
{
- visit(stage.content);
+ stage.content.visit(*this);
NodeRemover().apply(stage, nodes_to_remove);
}
{
Stage *builtin_stage = get_builtins(stage.type);
builtins = (builtin_stage ? &builtin_stage->content : 0);
- visit(stage.content);
+ stage.content.visit(*this);
}
Block *VariableResolver::next_block(Block &block)
if(stage->previous)
in_prefix = get_out_prefix(stage->previous->type);
out_prefix = get_out_prefix(stage->type);
- visit(s.content);
+ s.content.visit(*this);
NodeRemover().apply(s, nodes_to_remove);
}
virtual void visit(Block &);
virtual void visit(FunctionDeclaration &);
virtual void visit(VariableDeclaration &);
- using TraversingVisitor::visit;
};
class BlockResolver: private TraversingVisitor
{
public:
- void apply(Stage &s) { visit(s.content); }
+ void apply(Stage &s) { s.content.visit(*this); }
private:
virtual void visit(Block &);
virtual void visit(InterfaceBlock &);
- using TraversingVisitor::visit;
};
class VariableResolver: private TraversingVisitor
virtual void visit(InterfaceBlock &);
virtual void visit(FunctionDeclaration &);
virtual void visit(Iteration &);
- using TraversingVisitor::visit;
};
class FunctionResolver: private TraversingVisitor
std::map<std::string, std::vector<FunctionDeclaration *> > functions;
public:
- void apply(Stage &s) { visit(s.content); }
+ void apply(Stage &s) { s.content.visit(*this); }
private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
- using TraversingVisitor::visit;
};
class InterfaceGenerator: private TraversingVisitor
virtual void visit(VariableReference &);
virtual void visit(VariableDeclaration &);
virtual void visit(Passthrough &);
- using TraversingVisitor::visit;
};
class DeclarationReorderer: private TraversingVisitor
public:
DeclarationReorderer();
- void apply(Stage &s) { visit(s.content); }
+ void apply(Stage &s) { s.content.visit(*this); }
private:
virtual void visit(Block &);
virtual void visit(VariableDeclaration &);
virtual void visit(InterfaceBlock &) { kind = VARIABLE; }
virtual void visit(FunctionDeclaration &);
- using TraversingVisitor::visit;
};
} // namespace SL
void FunctionInliner::apply(Stage &stage)
{
inlineable = InlineableFunctionLocator().apply(stage);
- visit(stage.content);
+ stage.content.visit(*this);
}
void FunctionInliner::visit_and_inline(RefPtr<Expression> &ptr)
void ConstantConditionEliminator::apply(Stage &stage)
{
- visit(stage.content);
+ stage.content.visit(*this);
NodeRemover().apply(stage, nodes_to_remove);
}
bool UnusedVariableRemover::apply(Stage &stage)
{
variables.push_back(BlockVariableMap());
- visit(stage.content);
+ stage.content.visit(*this);
BlockVariableMap &global_variables = variables.back();
for(BlockVariableMap::iterator i=global_variables.begin(); i!=global_variables.end(); ++i)
{
bool UnusedFunctionRemover::apply(Stage &stage)
{
- visit(stage.content);
+ stage.content.visit(*this);
NodeRemover().apply(stage, unused_nodes);
return !unused_nodes.empty();
}
public:
InlineableFunctionLocator();
- const std::set<FunctionDeclaration *> &apply(Stage &s) { visit(s.content); return inlineable; }
+ const std::set<FunctionDeclaration *> &apply(Stage &s) { s.content.visit(*this); return inlineable; }
private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
- using TraversingVisitor::visit;
};
class FunctionInliner: private TraversingVisitor
virtual void visit(FunctionCall &);
virtual void visit(VariableDeclaration &);
virtual void visit(Return &);
- using TraversingVisitor::visit;
};
class ConstantConditionEliminator: private TraversingVisitor
virtual void visit(VariableDeclaration &);
virtual void visit(Conditional &);
virtual void visit(Iteration &);
- using TraversingVisitor::visit;
};
class UnusedVariableRemover: private TraversingVisitor
void merge_down_variables();
virtual void visit(Conditional &);
virtual void visit(Iteration &);
- using TraversingVisitor::visit;
};
class UnusedFunctionRemover: private TraversingVisitor
private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
- using TraversingVisitor::visit;
};
} // namespace SL
append("#extension ext_texture_array: require\n");
formatted += '\n';
- visit(s.content);
+ s.content.visit(*this);
return formatted;
}
virtual void visit(Passthrough &);
virtual void visit(Return &);
virtual void visit(Jump &);
- using TraversingVisitor::visit;
};
} // namespace SL
{
stage = &s;
to_remove = &tr;
- visit(s.content);
+ s.content.visit(*this);
}
void NodeRemover::remove_variable(map<string, VariableDeclaration *> &vars, VariableDeclaration &decl)
TraversingVisitor(): current_block(0) { }
public:
- using NodeVisitor::visit;
virtual void visit(Block &);
virtual void visit(ParenthesizedExpression &);
virtual void visit(MemberAccess &);
std::vector<T *> nodes;
public:
- const std::vector<T *> &apply(Stage &s) { nodes.clear(); visit(s.content); return nodes; }
+ const std::vector<T *> &apply(Stage &s) { s.content.visit(*this); return nodes; }
private:
- using TraversingVisitor::visit;
virtual void visit(T &n) { nodes.push_back(&n); }
};
private:
void remove_variable(std::map<std::string, VariableDeclaration *> &, VariableDeclaration &);
- using TraversingVisitor::visit;
virtual void visit(Block &);
virtual void visit(StructDeclaration &);
virtual void visit(VariableDeclaration &);