Shader: Fix shader serialization
This commit is contained in:
@@ -69,7 +69,12 @@ namespace Nz
|
||||
optVal.emplace();
|
||||
|
||||
if (optVal.has_value())
|
||||
Value(optVal.value());
|
||||
{
|
||||
if constexpr (std::is_same_v<T, std::size_t>)
|
||||
SizeT(optVal.value());
|
||||
else
|
||||
Value(optVal.value());
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -86,6 +91,20 @@ namespace Nz
|
||||
node = std::static_pointer_cast<T>(value);
|
||||
}
|
||||
|
||||
inline void ShaderAstSerializerBase::SizeT(std::size_t& val)
|
||||
{
|
||||
bool isWriting = IsWriting();
|
||||
|
||||
UInt32 fixedVal;
|
||||
if (isWriting)
|
||||
fixedVal = static_cast<UInt32>(val);
|
||||
|
||||
Value(fixedVal);
|
||||
|
||||
if (!isWriting)
|
||||
val = static_cast<std::size_t>(fixedVal);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void ShaderAstSerializerBase::Variable(std::shared_ptr<T>& var)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user