Shader/SpirV: Fix UInt32 support

This commit is contained in:
Lynix 2021-05-16 23:14:39 +02:00
parent f2000f6068
commit ccccbfe0ad
2 changed files with 7 additions and 4 deletions

View File

@ -76,13 +76,13 @@ namespace Nz::ShaderAst
return varIndex; return varIndex;
} }
StatementPtr Sanitize(const StatementPtr& ast, std::string* error) inline StatementPtr Sanitize(const StatementPtr& ast, std::string* error)
{ {
SanitizeVisitor sanitizer; SanitizeVisitor sanitizer;
return sanitizer.Sanitize(ast, error); return sanitizer.Sanitize(ast, error);
} }
StatementPtr Sanitize(const StatementPtr& ast, const SanitizeVisitor::Options& options, std::string* error) inline StatementPtr Sanitize(const StatementPtr& ast, const SanitizeVisitor::Options& options, std::string* error)
{ {
SanitizeVisitor sanitizer; SanitizeVisitor sanitizer;
return sanitizer.Sanitize(ast, options, error); return sanitizer.Sanitize(ast, options, error);

View File

@ -498,7 +498,7 @@ namespace Nz
}, type); }, type);
} }
auto SpirvConstantCache::BuildType(const ShaderAst::IdentifierType& type) const -> TypePtr auto SpirvConstantCache::BuildType(const ShaderAst::IdentifierType& /*type*/) const -> TypePtr
{ {
// No IdentifierType is expected (as they should have been resolved by now) // No IdentifierType is expected (as they should have been resolved by now)
throw std::runtime_error("unexpected identifier"); throw std::runtime_error("unexpected identifier");
@ -518,6 +518,9 @@ namespace Nz
case ShaderAst::PrimitiveType::Int32: case ShaderAst::PrimitiveType::Int32:
return Integer{ 32, true }; return Integer{ 32, true };
case ShaderAst::PrimitiveType::UInt32:
return Integer{ 32, false };
} }
throw std::runtime_error("unexpected type"); throw std::runtime_error("unexpected type");
@ -535,7 +538,7 @@ namespace Nz
}); });
} }
auto SpirvConstantCache::BuildType(const ShaderAst::NoType& type) const -> TypePtr auto SpirvConstantCache::BuildType(const ShaderAst::NoType& /*type*/) const -> TypePtr
{ {
return std::make_shared<Type>(Void{}); return std::make_shared<Type>(Void{});
} }