Fix some compilation errors
This commit is contained in:
parent
91291fd91c
commit
df51526841
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace Nz
|
||||
{
|
||||
static_assert(std::is_same_v<std::size_t, UInt32> || std::is_same_v<std::size_t, UInt64>);
|
||||
|
||||
class NAZARA_SHADER_API ShaderAstSerializerBase
|
||||
{
|
||||
public:
|
||||
|
|
@ -67,7 +69,7 @@ namespace Nz
|
|||
virtual void Value(UInt8& val) = 0;
|
||||
virtual void Value(UInt16& val) = 0;
|
||||
virtual void Value(UInt32& val) = 0;
|
||||
inline void Value(std::size_t& val);
|
||||
virtual void Value(UInt64& val) = 0;
|
||||
|
||||
virtual void Variable(ShaderNodes::VariablePtr& var) = 0;
|
||||
template<typename T> void Variable(std::shared_ptr<T>& var);
|
||||
|
|
@ -99,6 +101,7 @@ namespace Nz
|
|||
void Value(UInt8& val) override;
|
||||
void Value(UInt16& val) override;
|
||||
void Value(UInt32& val) override;
|
||||
void Value(UInt64& val) override;
|
||||
void Variable(ShaderNodes::VariablePtr& var) override;
|
||||
|
||||
ByteStream& m_stream;
|
||||
|
|
@ -129,6 +132,7 @@ namespace Nz
|
|||
void Value(UInt8& val) override;
|
||||
void Value(UInt16& val) override;
|
||||
void Value(UInt32& val) override;
|
||||
void Value(UInt64& val) override;
|
||||
void Variable(ShaderNodes::VariablePtr& var) override;
|
||||
|
||||
ByteStream& m_stream;
|
||||
|
|
|
|||
|
|
@ -100,19 +100,6 @@ namespace Nz
|
|||
var = std::static_pointer_cast<T>(value);
|
||||
}
|
||||
|
||||
inline void ShaderAstSerializerBase::Value(std::size_t& val)
|
||||
{
|
||||
bool isWriting = IsWriting();
|
||||
|
||||
UInt32 value;
|
||||
if (isWriting)
|
||||
value = static_cast<UInt32>(val);
|
||||
|
||||
Value(value);
|
||||
if (!isWriting)
|
||||
val = static_cast<std::size_t>(value);
|
||||
}
|
||||
|
||||
inline ShaderAstSerializer::ShaderAstSerializer(ByteStream& stream) :
|
||||
m_stream(stream)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Nz
|
|||
bool Initialize(UInt64 size, BufferUsageFlags usage) override;
|
||||
|
||||
const UInt8* GetData() const;
|
||||
UInt64 GetSize() const;
|
||||
UInt64 GetSize() const override;
|
||||
DataStorage GetStorage() const override;
|
||||
|
||||
void* Map(BufferAccess access, UInt64 offset = 0, UInt64 size = 0) override;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Nz
|
|||
|
||||
VertexDeclaration(VertexInputRate inputRate, std::initializer_list<ComponentEntry> components);
|
||||
VertexDeclaration(const VertexDeclaration&) = delete;
|
||||
VertexDeclaration(VertexDeclaration&&) noexcept = default;
|
||||
VertexDeclaration(VertexDeclaration&&) = default;
|
||||
~VertexDeclaration() = default;
|
||||
|
||||
inline const Component* FindComponent(VertexComponent vertexComponent, std::size_t componentIndex) const;
|
||||
|
|
@ -51,7 +51,7 @@ namespace Nz
|
|||
template<typename T> bool HasComponentOfType(VertexComponent vertexComponent, std::size_t componentIndex = 0) const;
|
||||
|
||||
VertexDeclaration& operator=(const VertexDeclaration&) = delete;
|
||||
VertexDeclaration& operator=(VertexDeclaration&&) noexcept = default;
|
||||
VertexDeclaration& operator=(VertexDeclaration&&) = default;
|
||||
|
||||
static inline const VertexDeclarationRef& Get(VertexLayout layout);
|
||||
static bool IsTypeSupported(ComponentType type);
|
||||
|
|
|
|||
|
|
@ -461,6 +461,11 @@ namespace Nz
|
|||
m_stream << val;
|
||||
}
|
||||
|
||||
void ShaderAstSerializer::Value(UInt64& val)
|
||||
{
|
||||
m_stream << val;
|
||||
}
|
||||
|
||||
void ShaderAstSerializer::Variable(ShaderNodes::VariablePtr& var)
|
||||
{
|
||||
ShaderNodes::VariableType nodeType = (var) ? var->GetType() : ShaderNodes::VariableType::None;
|
||||
|
|
@ -722,6 +727,11 @@ namespace Nz
|
|||
m_stream >> val;
|
||||
}
|
||||
|
||||
void ShaderAstUnserializer::Value(UInt64& val)
|
||||
{
|
||||
m_stream >> val;
|
||||
}
|
||||
|
||||
void ShaderAstUnserializer::Variable(ShaderNodes::VariablePtr& var)
|
||||
{
|
||||
Int32 nodeTypeInt;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ namespace Nz
|
|||
{
|
||||
struct SpirvPrinter::State
|
||||
{
|
||||
State(const Settings& Settings) :
|
||||
settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
const UInt32* codepoints;
|
||||
std::size_t index = 0;
|
||||
std::size_t count;
|
||||
|
|
@ -24,13 +29,9 @@ namespace Nz
|
|||
|
||||
std::string SpirvPrinter::Print(const UInt32* codepoints, std::size_t count, const Settings& settings)
|
||||
{
|
||||
State state = {
|
||||
codepoints,
|
||||
0,
|
||||
count,
|
||||
{},
|
||||
settings
|
||||
};
|
||||
State state(settings);
|
||||
state.codepoints = codepoints;
|
||||
state.count = count;
|
||||
|
||||
m_currentState = &state;
|
||||
CallOnExit resetOnExit([&] { m_currentState = nullptr; });
|
||||
|
|
|
|||
Loading…
Reference in New Issue