Shader: Add constant cast optimization

This commit is contained in:
Jérôme Leclercq
2021-05-18 17:25:37 +02:00
parent e716b44aa3
commit a002d5c210
11 changed files with 342 additions and 62 deletions

View File

@@ -58,6 +58,15 @@ namespace Nz::ShaderBuilder
return branchNode;
}
inline std::unique_ptr<ShaderAst::CastExpression> Impl::Cast::operator()(ShaderAst::ExpressionType targetType, std::array<ShaderAst::ExpressionPtr, 4> expressions) const
{
auto castNode = std::make_unique<ShaderAst::CastExpression>();
castNode->expressions = std::move(expressions);
castNode->targetType = std::move(targetType);
return castNode;
}
inline std::unique_ptr<ShaderAst::CastExpression> Impl::Cast::operator()(ShaderAst::ExpressionType targetType, std::vector<ShaderAst::ExpressionPtr> expressions) const
{
auto castNode = std::make_unique<ShaderAst::CastExpression>();