Shader: Add type functions

This commit is contained in:
Lynix
2020-09-22 21:50:07 +02:00
parent 9c2c62b063
commit 79c53061e0
8 changed files with 143 additions and 29 deletions

View File

@@ -100,10 +100,10 @@ namespace Nz::ShaderNodes
case BinaryType::Multiply:
{
const ShaderExpressionType& leftExprType = left->GetExpressionType();
assert(std::holds_alternative<BasicType>(leftExprType));
assert(IsBasicType(leftExprType));
const ShaderExpressionType& rightExprType = right->GetExpressionType();
assert(std::holds_alternative<BasicType>(rightExprType));
assert(IsBasicType(rightExprType));
switch (std::get<BasicType>(leftExprType))
{
@@ -212,7 +212,7 @@ namespace Nz::ShaderNodes
ShaderExpressionType SwizzleOp::GetExpressionType() const
{
const ShaderExpressionType& exprType = expression->GetExpressionType();
assert(std::holds_alternative<BasicType>(exprType));
assert(IsBasicType(exprType));
return static_cast<BasicType>(UnderlyingCast(GetComponentType(std::get<BasicType>(exprType))) + componentCount - 1);
}