From 936bc4b57e7ffa5906a786735537c5493224e7d6 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Wed, 9 Nov 2022 16:42:33 +0100 Subject: [PATCH] Internal refactoring for compatibility with 32-bit Removed VmaJsonWriter::WriteSize, ContinueString_Size. See #293 --- include/vk_mem_alloc.h | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 5d6b295..4d35f45 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -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 > m_Stack; bool m_InsideString; - // Write size_t for less than 64bits - void WriteSize(size_t n, std::integral_constant) { m_SB.AddNumber(static_cast(n)); } - // Write size_t for 64bits - void WriteSize(size_t n, std::integral_constant) { m_SB.AddNumber(static_cast(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{}); -} - 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{}); -} - 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(" - ");