Internal refactoring for compatibility with 32-bit

Removed VmaJsonWriter::WriteSize, ContinueString_Size.

See #293
This commit is contained in:
Adam Sawicki 2022-11-09 16:42:33 +01:00
parent 800acede8d
commit 936bc4b57e

View File

@ -5487,7 +5487,6 @@ public:
// Posts next part of an open string. The number is converted to decimal characters.
void ContinueString(uint32_t n);
void ContinueString(uint64_t n);
void ContinueString_Size(size_t n);
// Posts next part of an open string. Pointer value is converted to characters
// using "%p" formatting - shown as hexadecimal number, e.g.: 000000081276Ad00
void ContinueString_Pointer(const void* ptr);
@ -5497,7 +5496,6 @@ public:
// Writes a number value.
void WriteNumber(uint32_t n);
void WriteNumber(uint64_t n);
void WriteSize(size_t n);
// Writes a boolean value - false or true.
void WriteBool(bool b);
// Writes a null value.
@ -5522,11 +5520,6 @@ private:
VmaVector< StackItem, VmaStlAllocator<StackItem> > m_Stack;
bool m_InsideString;
// Write size_t for less than 64bits
void WriteSize(size_t n, std::integral_constant<bool, false>) { m_SB.AddNumber(static_cast<uint32_t>(n)); }
// Write size_t for 64bits
void WriteSize(size_t n, std::integral_constant<bool, true>) { m_SB.AddNumber(static_cast<uint64_t>(n)); }
void BeginValue(bool isString);
void WriteIndent(bool oneLess = false);
};
@ -5669,14 +5662,6 @@ void VmaJsonWriter::ContinueString(uint64_t n)
m_SB.AddNumber(n);
}
void VmaJsonWriter::ContinueString_Size(size_t n)
{
VMA_ASSERT(m_InsideString);
// Fix for AppleClang incorrect type casting
// TODO: Change to if constexpr when C++17 used as minimal standard
WriteSize(n, std::is_same<size_t, uint64_t>{});
}
void VmaJsonWriter::ContinueString_Pointer(const void* ptr)
{
VMA_ASSERT(m_InsideString);
@ -5708,15 +5693,6 @@ void VmaJsonWriter::WriteNumber(uint64_t n)
m_SB.AddNumber(n);
}
void VmaJsonWriter::WriteSize(size_t n)
{
VMA_ASSERT(!m_InsideString);
BeginValue(false);
// Fix for AppleClang incorrect type casting
// TODO: Change to if constexpr when C++17 used as minimal standard
WriteSize(n, std::is_same<size_t, uint64_t>{});
}
void VmaJsonWriter::WriteBool(bool b)
{
VMA_ASSERT(!m_InsideString);
@ -6465,13 +6441,13 @@ void VmaBlockMetadata::PrintDetailedMap_Begin(class VmaJsonWriter& json,
json.WriteNumber(GetSize());
json.WriteString("UnusedBytes");
json.WriteSize(unusedBytes);
json.WriteNumber(unusedBytes);
json.WriteString("Allocations");
json.WriteSize((uint64_t)allocationCount);
json.WriteNumber((uint64_t)allocationCount);
json.WriteString("UnusedRanges");
json.WriteSize((uint64_t)unusedRangeCount);
json.WriteNumber((uint64_t)unusedRangeCount);
json.WriteString("Suballocations");
json.BeginArray();
@ -16012,7 +15988,7 @@ void VmaAllocator_T::PrintDetailedMap(VmaJsonWriter& json)
{
json.WriteString("Name");
json.BeginString();
json.ContinueString_Size((uint64_t)index++);
json.ContinueString((uint64_t)index++);
if (pool->GetName())
{
json.ContinueString(" - ");