Replace const ShaderAst::StatementPtr& by ShaderAst::Statement& in input
This commit is contained in:
@@ -23,8 +23,8 @@ namespace Nz::ShaderAst
|
||||
AstCloner(AstCloner&&) = delete;
|
||||
~AstCloner() = default;
|
||||
|
||||
ExpressionPtr Clone(const ExpressionPtr& statement);
|
||||
StatementPtr Clone(const StatementPtr& statement);
|
||||
ExpressionPtr Clone(Expression& statement);
|
||||
StatementPtr Clone(Statement& statement);
|
||||
|
||||
AstCloner& operator=(const AstCloner&) = delete;
|
||||
AstCloner& operator=(AstCloner&&) = delete;
|
||||
@@ -79,8 +79,8 @@ namespace Nz::ShaderAst
|
||||
std::vector<StatementPtr> m_statementStack;
|
||||
};
|
||||
|
||||
inline ExpressionPtr Clone(ExpressionPtr& node);
|
||||
inline StatementPtr Clone(StatementPtr& node);
|
||||
inline ExpressionPtr Clone(Expression& node);
|
||||
inline StatementPtr Clone(Statement& node);
|
||||
}
|
||||
|
||||
#include <Nazara/Shader/Ast/AstCloner.inl>
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace Nz::ShaderAst
|
||||
return CloneStatement(*statement);
|
||||
}
|
||||
|
||||
inline ExpressionPtr Clone(ExpressionPtr& node)
|
||||
inline ExpressionPtr Clone(Expression& node)
|
||||
{
|
||||
AstCloner cloner;
|
||||
return cloner.Clone(node);
|
||||
}
|
||||
|
||||
inline StatementPtr Clone(StatementPtr& node)
|
||||
inline StatementPtr Clone(Statement& node)
|
||||
{
|
||||
AstCloner cloner;
|
||||
return cloner.Clone(node);
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Nz::ShaderAst
|
||||
AstOptimizer(AstOptimizer&&) = delete;
|
||||
~AstOptimizer() = default;
|
||||
|
||||
StatementPtr Optimise(const StatementPtr& statement);
|
||||
StatementPtr Optimise(const StatementPtr& statement, UInt64 enabledConditions);
|
||||
StatementPtr Optimise(Statement& statement);
|
||||
StatementPtr Optimise(Statement& statement, UInt64 enabledConditions);
|
||||
|
||||
AstOptimizer& operator=(const AstOptimizer&) = delete;
|
||||
AstOptimizer& operator=(AstOptimizer&&) = delete;
|
||||
@@ -48,8 +48,8 @@ namespace Nz::ShaderAst
|
||||
std::optional<UInt64> m_enabledOptions;
|
||||
};
|
||||
|
||||
inline StatementPtr Optimize(const StatementPtr& ast);
|
||||
inline StatementPtr Optimize(const StatementPtr& ast, UInt64 enabledConditions);
|
||||
inline StatementPtr Optimize(Statement& ast);
|
||||
inline StatementPtr Optimize(Statement& ast, UInt64 enabledConditions);
|
||||
}
|
||||
|
||||
#include <Nazara/Shader/Ast/AstOptimizer.inl>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
namespace Nz::ShaderAst
|
||||
{
|
||||
inline StatementPtr Optimize(const StatementPtr& ast)
|
||||
inline StatementPtr Optimize(Statement& ast)
|
||||
{
|
||||
AstOptimizer optimize;
|
||||
return optimize.Optimise(ast);
|
||||
}
|
||||
|
||||
inline StatementPtr Optimize(const StatementPtr& ast, UInt64 enabledConditions)
|
||||
inline StatementPtr Optimize(Statement& ast, UInt64 enabledConditions)
|
||||
{
|
||||
AstOptimizer optimize;
|
||||
return optimize.Optimise(ast, enabledConditions);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nz::ShaderAst
|
||||
AstReflect(AstReflect&&) = delete;
|
||||
~AstReflect() = default;
|
||||
|
||||
void Reflect(const StatementPtr& statement, const Callbacks& callbacks);
|
||||
void Reflect(Statement& statement, const Callbacks& callbacks);
|
||||
|
||||
AstReflect& operator=(const AstReflect&) = delete;
|
||||
AstReflect& operator=(AstReflect&&) = delete;
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace Nz::ShaderAst
|
||||
SanitizeVisitor(SanitizeVisitor&&) = delete;
|
||||
~SanitizeVisitor() = default;
|
||||
|
||||
inline StatementPtr Sanitize(const StatementPtr& statement, std::string* error = nullptr);
|
||||
StatementPtr Sanitize(const StatementPtr& statement, const Options& options, std::string* error = nullptr);
|
||||
inline StatementPtr Sanitize(Statement& statement, std::string* error = nullptr);
|
||||
StatementPtr Sanitize(Statement& statement, const Options& options, std::string* error = nullptr);
|
||||
|
||||
SanitizeVisitor& operator=(const SanitizeVisitor&) = delete;
|
||||
SanitizeVisitor& operator=(SanitizeVisitor&&) = delete;
|
||||
@@ -80,7 +80,7 @@ namespace Nz::ShaderAst
|
||||
void PushScope();
|
||||
void PopScope();
|
||||
|
||||
std::size_t DeclareFunction(DeclareFunctionStatement* funcDecl);
|
||||
std::size_t DeclareFunction(DeclareFunctionStatement& funcDecl);
|
||||
|
||||
void PropagateFunctionFlags(std::size_t funcIndex, FunctionFlags flags, Bitset<>& seen);
|
||||
|
||||
@@ -141,8 +141,8 @@ namespace Nz::ShaderAst
|
||||
Context* m_context;
|
||||
};
|
||||
|
||||
inline StatementPtr Sanitize(const StatementPtr& ast, std::string* error = nullptr);
|
||||
inline StatementPtr Sanitize(const StatementPtr& ast, const SanitizeVisitor::Options& options, std::string* error = nullptr);
|
||||
inline StatementPtr Sanitize(Statement& ast, std::string* error = nullptr);
|
||||
inline StatementPtr Sanitize(Statement& ast, const SanitizeVisitor::Options& options, std::string* error = nullptr);
|
||||
}
|
||||
|
||||
#include <Nazara/Shader/Ast/SanitizeVisitor.inl>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace Nz::ShaderAst
|
||||
{
|
||||
inline StatementPtr SanitizeVisitor::Sanitize(const StatementPtr& statement, std::string* error)
|
||||
inline StatementPtr SanitizeVisitor::Sanitize(Statement& statement, std::string* error)
|
||||
{
|
||||
return Sanitize(statement, {}, error);
|
||||
}
|
||||
@@ -21,13 +21,13 @@ namespace Nz::ShaderAst
|
||||
return &*it;
|
||||
}
|
||||
|
||||
inline StatementPtr Sanitize(const StatementPtr& ast, std::string* error)
|
||||
inline StatementPtr Sanitize(Statement& ast, std::string* error)
|
||||
{
|
||||
SanitizeVisitor sanitizer;
|
||||
return sanitizer.Sanitize(ast, error);
|
||||
}
|
||||
|
||||
inline StatementPtr Sanitize(const StatementPtr& ast, const SanitizeVisitor::Options& options, std::string* error)
|
||||
inline StatementPtr Sanitize(Statement& ast, const SanitizeVisitor::Options& options, std::string* error)
|
||||
{
|
||||
SanitizeVisitor sanitizer;
|
||||
return sanitizer.Sanitize(ast, options, error);
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace Nz
|
||||
GlslWriter(GlslWriter&&) = delete;
|
||||
~GlslWriter() = default;
|
||||
|
||||
inline std::string Generate(ShaderAst::StatementPtr& shader, const States& states = {});
|
||||
std::string Generate(std::optional<ShaderStageType> shaderStage, ShaderAst::StatementPtr& shader, const States& states = {});
|
||||
inline std::string Generate(ShaderAst::Statement& shader, const States& states = {});
|
||||
std::string Generate(std::optional<ShaderStageType> shaderStage, ShaderAst::Statement& shader, const States& states = {});
|
||||
|
||||
void SetEnv(Environment environment);
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Nz
|
||||
};
|
||||
|
||||
static const char* GetFlipYUniformName();
|
||||
static ShaderAst::StatementPtr Sanitize(ShaderAst::Statement& ast, std::string* error = nullptr);
|
||||
|
||||
private:
|
||||
void Append(const ShaderAst::ExpressionType& type);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
inline std::string GlslWriter::Generate(ShaderAst::StatementPtr& shader, const States& states)
|
||||
inline std::string GlslWriter::Generate(ShaderAst::Statement& shader, const States& states)
|
||||
{
|
||||
return Generate(std::nullopt, shader, states);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Nz
|
||||
LangWriter(LangWriter&&) = delete;
|
||||
~LangWriter() = default;
|
||||
|
||||
std::string Generate(ShaderAst::StatementPtr& shader, const States& conditions = {});
|
||||
std::string Generate(ShaderAst::Statement& shader, const States& conditions = {});
|
||||
|
||||
void SetEnv(Environment environment);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Nz
|
||||
SpirvWriter(SpirvWriter&&) = delete;
|
||||
~SpirvWriter() = default;
|
||||
|
||||
std::vector<UInt32> Generate(ShaderAst::StatementPtr& shader, const States& states = {});
|
||||
std::vector<UInt32> Generate(ShaderAst::Statement& shader, const States& states = {});
|
||||
|
||||
void SetEnv(Environment environment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user