// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Shader generator" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_SHADER_BUILDER_HPP #define NAZARA_SHADER_BUILDER_HPP #include #include #include namespace Nz::ShaderBuilder { namespace Impl { struct Binary { inline std::unique_ptr operator()(ShaderAst::BinaryType op, ShaderAst::ExpressionPtr left, ShaderAst::ExpressionPtr right) const; }; struct Branch { inline std::unique_ptr operator()(ShaderAst::ExpressionPtr condition, ShaderAst::StatementPtr truePath, ShaderAst::StatementPtr falsePath = nullptr) const; inline std::unique_ptr operator()(std::vector condStatements, ShaderAst::StatementPtr elseStatement = nullptr) const; }; struct Constant { inline std::unique_ptr operator()(ShaderConstantValue value) const; }; struct DeclareFunction { inline std::unique_ptr operator()(std::string name, std::vector parameters, std::vector statements, ShaderAst::ShaderExpressionType returnType = ShaderAst::BasicType::Void) const; inline std::unique_ptr operator()(std::vector attributes, std::string name, std::vector parameters, std::vector statements, ShaderAst::ShaderExpressionType returnType = ShaderAst::BasicType::Void) const; }; struct DeclareVariable { inline std::unique_ptr operator()(std::string name, ShaderAst::ShaderExpressionType type, ShaderAst::ExpressionPtr initialValue = nullptr) const; }; struct Identifier { inline std::unique_ptr operator()(std::string name) const; }; struct Return { inline std::unique_ptr operator()(ShaderAst::ExpressionPtr expr = nullptr) const; }; template struct NoParam { std::unique_ptr operator()() const; }; } constexpr Impl::Binary Binary; constexpr Impl::Branch Branch; constexpr Impl::Constant Constant; constexpr Impl::DeclareFunction DeclareFunction; constexpr Impl::DeclareVariable DeclareVariable; constexpr Impl::NoParam Discard; constexpr Impl::Identifier Identifier; constexpr Impl::NoParam NoOp; constexpr Impl::Return Return; } #include #endif // NAZARA_SHADER_BUILDER_HPP