void DefaultPrecisionGenerator::apply(Stage &stage)
{
- SetForScope<Stage::Type> set_stage(stage_type, stage.type);
+ stage_type = stage.type;
visit(stage.content);
}
void LegacyConverter::apply(Stage &s)
{
- SetForScope<Stage *> set_stage(stage, &s);
+ stage = &s;
visit(s.content);
}
void InterfaceGenerator::apply(Stage &s)
{
- SetForScope<Stage *> set(stage, &s);
+ stage = &s;
if(stage->previous)
in_prefix = get_out_prefix(stage->previous->type);
out_prefix = get_out_prefix(stage->type);
global_scope(true)
{ }
-const set<Node *> &UnusedVariableLocator::apply(Stage &s)
+const set<Node *> &UnusedVariableRemover::apply(Stage &stage)
{
variables.push_back(BlockVariableMap());
- visit(s.content);
+ visit(stage.content);
BlockVariableMap &global_variables = variables.back();
for(BlockVariableMap::iterator i=global_variables.begin(); i!=global_variables.end(); ++i)
{
- if(i->first->interface=="out" && (s.type==Stage::FRAGMENT || i->first->linked_declaration || !i->first->name.compare(0, 3, "gl_")))
+ if(i->first->interface=="out" && (stage.type==Stage::FRAGMENT || i->first->linked_declaration || !i->first->name.compare(0, 3, "gl_")))
continue;
if(!i->second.referenced)
{
const string &Formatter::apply(Stage &s)
{
- SetForScope<Stage *> set_stage(stage, &s);
+ stage = &s;
GLApi api = get_gl_api();
const Version &ver = s.required_version;
void NodeRemover::apply(Stage &s)
{
- SetForScope<Stage *> set_stage(stage, &s);
+ stage = &s;
visit(s.content);
}
};
template<typename T>
-class NodeGatherer: public TraversingVisitor
+class NodeGatherer: private TraversingVisitor
{
private:
std::vector<T *> nodes;
public:
const std::vector<T *> &apply(Stage &s) { visit(s.content); return nodes; }
+private:
using TraversingVisitor::visit;
virtual void visit(T &n) { nodes.push_back(&n); }
};
-class NodeRemover: public TraversingVisitor
+class NodeRemover: private TraversingVisitor
{
private:
Stage *stage;
void apply(Stage &);
+private:
using TraversingVisitor::visit;
virtual void visit(Block &);
virtual void visit(VariableDeclaration &);