Shader: Handle type as expressions
This commit is contained in:
@@ -184,8 +184,8 @@ namespace Nz
|
||||
if (!uberShader->HasOption(optionName, &optionPtr))
|
||||
return InvalidOption;
|
||||
|
||||
if (optionPtr->type != ShaderAst::ExpressionType{ ShaderAst::PrimitiveType::Int32 })
|
||||
throw std::runtime_error("Location options must be of type i32");
|
||||
//if (optionPtr->type != ShaderAst::ExpressionType{ ShaderAst::PrimitiveType::Int32 })
|
||||
// throw std::runtime_error("Location options must be of type i32");
|
||||
|
||||
return optionPtr->index;
|
||||
};
|
||||
|
||||
@@ -251,8 +251,8 @@ namespace Nz
|
||||
if (!uberShader->HasOption(optionName, &optionPtr))
|
||||
return InvalidOption;
|
||||
|
||||
if (optionPtr->type != ShaderAst::ExpressionType{ ShaderAst::PrimitiveType::Int32 })
|
||||
throw std::runtime_error("Location options must be of type i32");
|
||||
//if (optionPtr->type != ShaderAst::ExpressionType{ ShaderAst::PrimitiveType::Int32 })
|
||||
// throw std::runtime_error("Location options must be of type i32");
|
||||
|
||||
return optionPtr->index;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ option BillboardSizeRotLocation: i32 = -1;
|
||||
|
||||
// Vertex declaration related options
|
||||
option ColorLocation: i32 = -1;
|
||||
option PosLocation: i32 = -1;
|
||||
option PosLocation: i32;
|
||||
option UvLocation: i32 = -1;
|
||||
|
||||
const HasVertexColor = (ColorLocation >= 0);
|
||||
|
||||
@@ -20,7 +20,7 @@ option BillboardSizeRotLocation: i32 = -1;
|
||||
// Vertex declaration related options
|
||||
option ColorLocation: i32 = -1;
|
||||
option NormalLocation: i32 = -1;
|
||||
option PosLocation: i32 = -1;
|
||||
option PosLocation: i32;
|
||||
option TangentLocation: i32 = -1;
|
||||
option UvLocation: i32 = -1;
|
||||
|
||||
|
||||
@@ -31,11 +31,10 @@ namespace Nz
|
||||
supportedStageType |= stageType;
|
||||
};
|
||||
|
||||
callbacks.onOptionDeclaration = [&](const std::string& optionName, const ShaderAst::ExpressionType& optionType)
|
||||
callbacks.onOptionDeclaration = [&](const std::string& optionName, const ShaderAst::ExpressionValue<ShaderAst::ExpressionType>& optionType)
|
||||
{
|
||||
m_optionIndexByName[optionName] = Option{
|
||||
optionCount,
|
||||
optionType
|
||||
optionCount
|
||||
};
|
||||
|
||||
optionCount++;
|
||||
|
||||
Reference in New Issue
Block a user