Most of them don't work properly if given some random node to start with.
frag_out(0)
{ }
+void LegacyConverter::apply(Stage &s)
+{
+ SetForScope<Stage *> set_stage(stage, &s);
+ visit(s.content);
+}
+
bool LegacyConverter::check_version(const Version &feature_version) const
{
if(target_version<feature_version)
return true;
}
-void LegacyConverter::apply(Stage &s)
-{
- SetForScope<Stage *> set_stage(stage, &s);
- visit(s.content);
-}
-
bool LegacyConverter::supports_unified_interface_syntax() const
{
if(target_api==OPENGL_ES2)
namespace GL {
namespace SL {
-class DefaultPrecisionGenerator: public BlockModifier
+class DefaultPrecisionGenerator: private BlockModifier
{
private:
Stage::Type stage_type;
void apply(Stage &);
- using BlockModifier::visit;
+private:
virtual void visit(Block &);
virtual void visit(Precision &);
virtual void visit(VariableDeclaration &);
+ using BlockModifier::visit;
};
-class PrecisionRemover: public BlockModifier
+class PrecisionRemover: private BlockModifier
{
public:
void apply(Stage &s) { visit(s.content); }
- using BlockModifier::visit;
+private:
virtual void visit(Precision &);
virtual void visit(VariableDeclaration &);
+ using BlockModifier::visit;
};
-class LegacyConverter: public BlockModifier
+class LegacyConverter: private BlockModifier
{
private:
Stage *stage;
LegacyConverter();
LegacyConverter(const Version &);
+ virtual void apply(Stage &);
+
private:
bool check_version(const Version &) const;
bool check_extension(const Extension &) const;
-public:
- using BlockModifier::visit;
- virtual void apply(Stage &);
-private:
bool supports_unified_interface_syntax() const;
virtual void visit(VariableReference &);
virtual void visit(Assignment &);
virtual void visit(VariableDeclaration &);
bool supports_interface_blocks(const std::string &) const;
virtual void visit(InterfaceBlock &);
+ using BlockModifier::visit;
};
} // namespace SL
namespace GL {
namespace SL {
-class DeclarationCombiner: public BlockModifier
+class DeclarationCombiner: private BlockModifier
{
private:
bool toplevel;
void apply(Stage &s) { visit(s.content); }
- using BlockModifier::visit;
+private:
virtual void visit(Block &);
virtual void visit(FunctionDeclaration &);
virtual void visit(VariableDeclaration &);
+ using BlockModifier::visit;
};
-class VariableResolver: public TraversingVisitor
+class VariableResolver: private TraversingVisitor
{
private:
std::vector<Block *> blocks;
void apply(Stage &);
- using TraversingVisitor::visit;
+private:
virtual void visit(Block &);
virtual void visit(VariableReference &);
virtual void visit(MemberAccess &);
virtual void visit(StructDeclaration &);
virtual void visit(VariableDeclaration &);
virtual void visit(InterfaceBlock &);
+ using TraversingVisitor::visit;
};
-class FunctionResolver: public TraversingVisitor
+class FunctionResolver: private TraversingVisitor
{
private:
std::map<std::string, std::vector<FunctionDeclaration *> > functions;
public:
void apply(Stage &s) { visit(s.content); }
- using TraversingVisitor::visit;
+private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
+ using TraversingVisitor::visit;
};
-class InterfaceGenerator: public BlockModifier
+class InterfaceGenerator: private BlockModifier
{
private:
Stage *stage;
void apply(Stage &);
+private:
static std::string get_out_prefix(Stage::Type);
- using BlockModifier::visit;
- virtual void visit(Block &);
std::string change_prefix(const std::string &, const std::string &) const;
+ virtual void visit(Block &);
bool generate_interface(VariableDeclaration &, const std::string &, const std::string &);
ExpressionStatement &insert_assignment(const std::string &, Expression *);
virtual void visit(VariableReference &);
virtual void visit(VariableDeclaration &);
virtual void visit(Passthrough &);
+ using BlockModifier::visit;
};
-class DeclarationReorderer: public TraversingVisitor
+class DeclarationReorderer: private TraversingVisitor
{
private:
enum DeclarationKind
void apply(Stage &s) { visit(s.content); }
- using TraversingVisitor::visit;
+private:
virtual void visit(Block &);
virtual void visit(FunctionCall &);
virtual void visit(InterfaceLayout &) { kind = LAYOUT; }
virtual void visit(VariableDeclaration &);
virtual void visit(InterfaceBlock &) { kind = VARIABLE; }
virtual void visit(FunctionDeclaration &);
+ using TraversingVisitor::visit;
};
} // namespace SL
namespace GL {
namespace SL {
-class InlineableFunctionLocator: public TraversingVisitor
+class InlineableFunctionLocator: private TraversingVisitor
{
private:
std::map<FunctionDeclaration *, unsigned> refcounts;
const std::set<FunctionDeclaration *> &apply(Stage &s) { visit(s.content); return inlineable; }
- using TraversingVisitor::visit;
+private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
+ using TraversingVisitor::visit;
};
-class FunctionInliner: public TraversingVisitor
+class FunctionInliner: private TraversingVisitor
{
private:
std::set<FunctionDeclaration *> inlineable;
private:
void visit_and_inline(RefPtr<Expression> &);
-public:
- using TraversingVisitor::visit;
+
virtual void visit(Block &);
virtual void visit(UnaryExpression &);
virtual void visit(BinaryExpression &);
virtual void visit(FunctionCall &);
virtual void visit(VariableDeclaration &);
virtual void visit(Return &);
+ using TraversingVisitor::visit;
};
-class ConstantConditionEliminator: public BlockModifier
+class ConstantConditionEliminator: private BlockModifier
{
private:
unsigned scope_level;
void apply(Stage &s) { visit(s.content); }
- using BlockModifier::visit;
+private:
virtual void visit(Block &);
virtual void visit(UnaryExpression &);
virtual void visit(Assignment &);
virtual void visit(VariableDeclaration &);
virtual void visit(Conditional &);
virtual void visit(Iteration &);
+ using BlockModifier::visit;
};
-class UnusedVariableLocator: public TraversingVisitor
+class UnusedVariableLocator: private TraversingVisitor
{
private:
struct VariableInfo
const std::set<Node *> &apply(Stage &);
- using TraversingVisitor::visit;
+private:
virtual void visit(VariableReference &);
virtual void visit(MemberAccess &);
virtual void visit(BinaryExpression &);
virtual void visit(Assignment &);
-private:
void record_assignment(VariableDeclaration &, Node &, bool);
void clear_assignments(VariableInfo &, bool);
-public:
virtual void visit(ExpressionStatement &);
virtual void visit(StructDeclaration &);
virtual void visit(VariableDeclaration &);
virtual void visit(InterfaceBlock &);
virtual void visit(FunctionDeclaration &);
-private:
void merge_down_variables();
-public:
virtual void visit(Conditional &);
virtual void visit(Iteration &);
+ using TraversingVisitor::visit;
};
-class UnusedFunctionLocator: public TraversingVisitor
+class UnusedFunctionLocator: private TraversingVisitor
{
private:
std::set<Node *> unused_nodes;
public:
const std::set<Node *> &apply(Stage &s) { visit(s.content); return unused_nodes; }
- using TraversingVisitor::visit;
+private:
virtual void visit(FunctionCall &);
virtual void visit(FunctionDeclaration &);
+ using TraversingVisitor::visit;
};
} // namespace SL
namespace GL {
namespace SL {
-class Formatter: public TraversingVisitor
+class Formatter: private TraversingVisitor
{
private:
Stage *stage;
void append(const std::string &);
void append(char);
void set_source(unsigned, unsigned);
-public:
- using TraversingVisitor::visit;
+
virtual void visit(Block &);
virtual void visit(Literal &);
virtual void visit(ParenthesizedExpression &);
virtual void visit(Iteration &);
virtual void visit(Return &);
virtual void visit(Jump &);
+ using TraversingVisitor::visit;
};
} // namespace SL