(*i)->resolve_space(space);
}
-void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &features, unsigned size_hint)
+void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &feat, unsigned size_hint)
{
if(array_size)
return;
if(variable && variable->scope==UNIFORM)
{
if(array_subscript=="MAX_LIGHTS")
- array_size = features.max_lights;
+ array_size = feat.max_lights;
else if(array_subscript=="MAX_CLIP_PLANES")
- array_size = features.max_clip_planes;
+ array_size = feat.max_clip_planes;
else if(isnumrc(array_subscript))
array_size = lexical_cast<unsigned>(array_subscript);
else
{
for(list<ShaderVariable *>::const_iterator i=referenced_vars.begin(); i!=referenced_vars.end(); ++i)
if(!(*i)->array_subscript.empty() && !(*i)->array_size)
- (*i)->resolve_array(features, array_size);
+ (*i)->resolve_array(feat, array_size);
}
}
return format("%s %s%s", variable->type, resolved_name, array);
}
-string ProgramBuilder::ShaderVariable::create_replacement(VariableScope from_scope, unsigned enabled_scopes, const char *loop) const
+string ProgramBuilder::ShaderVariable::create_replacement(VariableScope from_scope, unsigned scopes, const char *loop) const
{
string replacement = resolved_name;
InterfaceFlags iface = NO_INTERFACE;
if(variable)
{
iface = get_interface_flags(from_scope);
- VariableScope prev_scope = previous_scope(from_scope, enabled_scopes);
+ VariableScope prev_scope = previous_scope(from_scope, scopes);
if((iface&INPUT) && interfaces[prev_scope])
replacement = format("%c_%s", interfaces[prev_scope], replacement);
else if(inlined)
{
- replacement = create_expression(enabled_scopes, loop);
+ replacement = create_expression(scopes, loop);
if(inline_parens)
replacement = "("+replacement+")";
return replacement;
return replacement;
}
-string ProgramBuilder::ShaderVariable::create_expression(unsigned enabled_scopes, const char *loop) const
+string ProgramBuilder::ShaderVariable::create_expression(unsigned scopes, const char *loop) const
{
map<string, string> replace_map;
for(list<ShaderVariable *>::const_iterator i=referenced_vars.begin(); i!=referenced_vars.end(); ++i)
{
- string replacement = (*i)->create_replacement(variable->scope, enabled_scopes, loop);
+ string replacement = (*i)->create_replacement(variable->scope, scopes, loop);
if(replacement!=(*i)->name)
replace_map[(*i)->name] = replacement;
}
virtual void apply(ProgramSyntax::Stage &);
const std::string &get_result() const { return formatted; }
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::Literal &);
virtual void visit(ProgramSyntax::ParenthesizedExpression &);
std::list<T *> nodes;
const ResultType &get_result() const { return nodes; }
+ using Visitor::visit;
virtual void visit(T &n) { nodes.push_back(&n); }
};
DeclarationCombiner();
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::FunctionDeclaration &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
VariableResolver();
virtual void apply(ProgramSyntax::Stage &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::VariableReference &);
virtual void visit(ProgramSyntax::MemberAccess &);
{
std::map<std::string, std::vector<ProgramSyntax::FunctionDeclaration *> > functions;
+ using Visitor::visit;
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::FunctionDeclaration &);
};
void flatten_block(ProgramSyntax::Block &);
void apply_and_increment(ProgramSyntax::Block &, std::list<RefPtr<ProgramSyntax::Node> >::iterator &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
};
static std::string get_out_prefix(ProgramSyntax::StageType);
virtual void apply(ProgramSyntax::Stage &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
std::string change_prefix(const std::string &, const std::string &) const;
bool generate_interface(ProgramSyntax::VariableDeclaration &, const std::string &, const std::string &);
struct VariableRenamer: Visitor
{
+ using Visitor::visit;
virtual void visit(ProgramSyntax::VariableReference &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
};
DeclarationReorderer();
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::InterfaceLayout &) { kind = LAYOUT; }
virtual void visit(ProgramSyntax::StructDeclaration &) { kind = STRUCT; }
InlineableFunctionLocator();
const ResultType &get_result() const { return inlineable; }
+ using Visitor::visit;
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::FunctionDeclaration &);
};
FunctionInliner(const std::set<ProgramSyntax::FunctionDeclaration *> &);
void visit_and_inline(RefPtr<ProgramSyntax::Expression> &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::UnaryExpression &);
virtual void visit(ProgramSyntax::BinaryExpression &);
ExpressionEvaluator();
ExpressionEvaluator(const ValueMap &);
+ using ProgramSyntax::NodeVisitor::visit;
virtual void visit(ProgramSyntax::Literal &);
virtual void visit(ProgramSyntax::ParenthesizedExpression &);
virtual void visit(ProgramSyntax::VariableReference &);
ConstantConditionEliminator();
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::Assignment &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
virtual void apply(ProgramSyntax::Stage &);
const ResultType &get_result() const { return unused_nodes; }
+ using Visitor::visit;
virtual void visit(ProgramSyntax::VariableReference &);
virtual void visit(ProgramSyntax::MemberAccess &);
virtual void visit(ProgramSyntax::BinaryExpression &);
std::set<ProgramSyntax::FunctionDeclaration *> used_definitions;
const ResultType &get_result() const { return unused_nodes; }
+ using Visitor::visit;
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::FunctionDeclaration &);
};
NodeRemover() { }
NodeRemover(const std::set<ProgramSyntax::Node *> &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::Block &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
};
LegacyConverter(const Version &);
bool check_version(const Version &);
+ using Visitor::visit;
virtual void visit(ProgramSyntax::VariableReference &);
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::VariableDeclaration &);