Update ShaderNode
This commit is contained in:
@@ -89,10 +89,15 @@ namespace Nz::ShaderBuilder
|
||||
inline std::unique_ptr<ShaderAst::IntrinsicExpression> operator()(ShaderAst::IntrinsicType intrinsicType, std::vector<ShaderAst::ExpressionPtr> parameters) const;
|
||||
};
|
||||
|
||||
struct Multi
|
||||
{
|
||||
inline std::unique_ptr<ShaderAst::MultiStatement> operator()(std::vector<ShaderAst::StatementPtr> statements) const;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct NoParam
|
||||
{
|
||||
std::unique_ptr<T> operator()() const;
|
||||
inline std::unique_ptr<T> operator()() const;
|
||||
};
|
||||
|
||||
struct Return
|
||||
@@ -121,6 +126,7 @@ namespace Nz::ShaderBuilder
|
||||
constexpr Impl::NoParam<ShaderAst::DiscardStatement> Discard;
|
||||
constexpr Impl::Identifier Identifier;
|
||||
constexpr Impl::Intrinsic Intrinsic;
|
||||
constexpr Impl::Multi MultiStatement;
|
||||
constexpr Impl::NoParam<ShaderAst::NoOpStatement> NoOp;
|
||||
constexpr Impl::Return Return;
|
||||
constexpr Impl::Swizzle Swizzle;
|
||||
|
||||
@@ -172,12 +172,12 @@ namespace Nz::ShaderBuilder
|
||||
return intrinsicExpression;
|
||||
}
|
||||
|
||||
inline std::unique_ptr<ShaderAst::ReturnStatement> Impl::Return::operator()(ShaderAst::ExpressionPtr expr) const
|
||||
inline std::unique_ptr<ShaderAst::MultiStatement> Impl::Multi::operator()(std::vector<ShaderAst::StatementPtr> statements) const
|
||||
{
|
||||
auto returnNode = std::make_unique<ShaderAst::ReturnStatement>();
|
||||
returnNode->returnExpr = std::move(expr);
|
||||
auto multiStatement = std::make_unique<ShaderAst::MultiStatement>();
|
||||
multiStatement->statements = std::move(statements);
|
||||
|
||||
return returnNode;
|
||||
return multiStatement;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -186,6 +186,14 @@ namespace Nz::ShaderBuilder
|
||||
return std::make_unique<T>();
|
||||
}
|
||||
|
||||
inline std::unique_ptr<ShaderAst::ReturnStatement> Impl::Return::operator()(ShaderAst::ExpressionPtr expr) const
|
||||
{
|
||||
auto returnNode = std::make_unique<ShaderAst::ReturnStatement>();
|
||||
returnNode->returnExpr = std::move(expr);
|
||||
|
||||
return returnNode;
|
||||
}
|
||||
|
||||
inline std::unique_ptr<ShaderAst::SwizzleExpression> Impl::Swizzle::operator()(ShaderAst::ExpressionPtr expression, std::vector<ShaderAst::SwizzleComponent> swizzleComponents) const
|
||||
{
|
||||
auto swizzleNode = std::make_unique<ShaderAst::SwizzleExpression>();
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace Nz::ShaderAst
|
||||
class AstExpressionVisitor;
|
||||
class AstStatementVisitor;
|
||||
|
||||
struct Node;
|
||||
|
||||
using NodePtr = std::unique_ptr<Node>;
|
||||
|
||||
struct NAZARA_SHADER_API Node
|
||||
{
|
||||
Node() = default;
|
||||
|
||||
Reference in New Issue
Block a user