Quality of life improvements
This commit is contained in:
parent
63f259b907
commit
9b313dac2e
|
|
@ -34,10 +34,10 @@ namespace Nz
|
||||||
~ShaderAst() = default;
|
~ShaderAst() = default;
|
||||||
|
|
||||||
void AddFunction(std::string name, ShaderNodes::StatementPtr statement, std::vector<FunctionParameter> parameters = {}, ShaderNodes::BasicType returnType = ShaderNodes::BasicType::Void);
|
void AddFunction(std::string name, ShaderNodes::StatementPtr statement, std::vector<FunctionParameter> parameters = {}, ShaderNodes::BasicType returnType = ShaderNodes::BasicType::Void);
|
||||||
void AddInput(std::string name, ShaderExpressionType type, std::optional<std::size_t> locationIndex);
|
void AddInput(std::string name, ShaderExpressionType type, std::optional<std::size_t> locationIndex = {});
|
||||||
void AddOutput(std::string name, ShaderExpressionType type, std::optional<std::size_t> locationIndex);
|
void AddOutput(std::string name, ShaderExpressionType type, std::optional<std::size_t> locationIndex = {});
|
||||||
void AddStruct(std::string name, std::vector<StructMember> members);
|
void AddStruct(std::string name, std::vector<StructMember> members);
|
||||||
void AddUniform(std::string name, ShaderExpressionType type, std::optional<std::size_t> bindingIndex, std::optional<ShaderNodes::MemoryLayout> memoryLayout);
|
void AddUniform(std::string name, ShaderExpressionType type, std::optional<std::size_t> bindingIndex = {}, std::optional<ShaderNodes::MemoryLayout> memoryLayout = {});
|
||||||
|
|
||||||
inline const Function& GetFunction(std::size_t i) const;
|
inline const Function& GetFunction(std::size_t i) const;
|
||||||
inline std::size_t GetFunctionCount() const;
|
inline std::size_t GetFunctionCount() const;
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,7 @@ namespace Nz
|
||||||
std::size_t componentCount;
|
std::size_t componentCount;
|
||||||
ExpressionPtr expression;
|
ExpressionPtr expression;
|
||||||
|
|
||||||
|
static inline std::shared_ptr<SwizzleOp> Build(ExpressionPtr expressionPtr, SwizzleComponent swizzleComponent);
|
||||||
static inline std::shared_ptr<SwizzleOp> Build(ExpressionPtr expressionPtr, std::initializer_list<SwizzleComponent> swizzleComponents);
|
static inline std::shared_ptr<SwizzleOp> Build(ExpressionPtr expressionPtr, std::initializer_list<SwizzleComponent> swizzleComponents);
|
||||||
static inline std::shared_ptr<SwizzleOp> Build(ExpressionPtr expressionPtr, const SwizzleComponent* components, std::size_t componentCount);
|
static inline std::shared_ptr<SwizzleOp> Build(ExpressionPtr expressionPtr, const SwizzleComponent* components, std::size_t componentCount);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,11 @@ namespace Nz::ShaderNodes
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::shared_ptr<SwizzleOp> SwizzleOp::Build(ExpressionPtr expressionPtr, SwizzleComponent swizzleComponent)
|
||||||
|
{
|
||||||
|
return Build(std::move(expressionPtr), { swizzleComponent });
|
||||||
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<SwizzleOp> SwizzleOp::Build(ExpressionPtr expressionPtr, std::initializer_list<SwizzleComponent> swizzleComponents)
|
inline std::shared_ptr<SwizzleOp> SwizzleOp::Build(ExpressionPtr expressionPtr, std::initializer_list<SwizzleComponent> swizzleComponents)
|
||||||
{
|
{
|
||||||
auto node = std::make_shared<SwizzleOp>();
|
auto node = std::make_shared<SwizzleOp>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue