Use own defines of format specifiers for MinGW (fixes #6187)

This commit is contained in:
Chairn 2022-12-25 20:41:19 +01:00
parent 2a63277aa5
commit 3132c96a80
3 changed files with 18 additions and 12 deletions

View file

@ -14,9 +14,20 @@
#define __USE_GNU #define __USE_GNU
#endif #endif
#include <inttypes.h>
#include <stdint.h> #include <stdint.h>
#include <time.h> #include <time.h>
#ifdef __MINGW32__
#undef PRId64
#undef PRIu64
#define PRId64 "I64d"
#define PRIu64 "I64u"
#define PRIzu "Iu"
#else
#define PRIzu "zu"
#endif
#ifdef CONF_FAMILY_UNIX #ifdef CONF_FAMILY_UNIX
#include <sys/un.h> #include <sys/un.h>
#endif #endif

View file

@ -87,7 +87,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
break; break;
default: break; default: break;
} }
dbg_msg("vulkan", "allocated chunk of memory with size: %zu for frame %zu (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage); dbg_msg("vulkan", "allocated chunk of memory with size: %" PRIzu " for frame %" PRIzu " (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
} }
void VerboseDeallocatedMemory(VkDeviceSize Size, size_t FrameImageIndex, EMemoryBlockUsage MemUsage) void VerboseDeallocatedMemory(VkDeviceSize Size, size_t FrameImageIndex, EMemoryBlockUsage MemUsage)
@ -109,7 +109,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
break; break;
default: break; default: break;
} }
dbg_msg("vulkan", "deallocated chunk of memory with size: %zu for frame %zu (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage); dbg_msg("vulkan", "deallocated chunk of memory with size: %" PRIzu " for frame %" PRIzu " (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
} }
/************************ /************************
@ -2057,7 +2057,7 @@ protected:
m_pStagingMemoryUsage->store(m_pStagingMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed); m_pStagingMemoryUsage->store(m_pStagingMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose()) if(IsVerbose())
{ {
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (staging buffer)", (size_t)FreeedMemory); dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (staging buffer)", (size_t)FreeedMemory);
} }
} }
FreeedMemory = 0; FreeedMemory = 0;
@ -2067,7 +2067,7 @@ protected:
m_pBufferMemoryUsage->store(m_pBufferMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed); m_pBufferMemoryUsage->store(m_pBufferMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose()) if(IsVerbose())
{ {
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (buffer)", (size_t)FreeedMemory); dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (buffer)", (size_t)FreeedMemory);
} }
} }
FreeedMemory = 0; FreeedMemory = 0;
@ -2078,7 +2078,7 @@ protected:
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed); m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose()) if(IsVerbose())
{ {
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (texture)", (size_t)FreeedMemory); dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (texture)", (size_t)FreeedMemory);
} }
} }
} }
@ -3817,7 +3817,7 @@ public:
if(IsVerbose()) if(IsVerbose())
{ {
dbg_msg("vulkan", "device prop: non-coherent align: %zu, optimal image copy align: %zu, max texture size: %u, max sampler anisotropy: %u", (size_t)m_NonCoherentMemAlignment, (size_t)m_OptimalImageCopyMemAlignment, m_MaxTextureSize, m_MaxSamplerAnisotropy); dbg_msg("vulkan", "device prop: non-coherent align: %" PRIzu ", optimal image copy align: %" PRIzu ", max texture size: %u, max sampler anisotropy: %u", (size_t)m_NonCoherentMemAlignment, (size_t)m_OptimalImageCopyMemAlignment, m_MaxTextureSize, m_MaxSamplerAnisotropy);
dbg_msg("vulkan", "device prop: min uniform align: %u, multi sample: %u", m_MinUniformAlign, (uint32_t)m_MaxMultiSample); dbg_msg("vulkan", "device prop: min uniform align: %u, multi sample: %u", m_MinUniformAlign, (uint32_t)m_MaxMultiSample);
} }
} }
@ -7634,7 +7634,7 @@ public:
if(IsVerbose() && s_BenchmarkRenderThreads) if(IsVerbose() && s_BenchmarkRenderThreads)
{ {
dbg_msg("vulkan", "render thread %zu took %d ns to finish", ThreadIndex, (int)(time_get_nanoseconds() - ThreadRenderTime).count()); dbg_msg("vulkan", "render thread %" PRIzu " took %d ns to finish", ThreadIndex, (int)(time_get_nanoseconds() - ThreadRenderTime).count());
} }
pThread->m_IsRendering = false; pThread->m_IsRendering = false;

View file

@ -70,11 +70,6 @@
#include "base/hash.h" #include "base/hash.h"
// for msvc
#ifndef PRIu64
#define PRIu64 "I64u"
#endif
#include <chrono> #include <chrono>
#include <thread> #include <thread>