From 5afe7845a1571ae2ceb46583e103d14d6492d2ec Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Fri, 26 Jul 2019 15:09:07 +0200 Subject: [PATCH] Fix alignment of VmaPoolAllocator::Item::Value Disable Visual Studio warning C4324. See #71 --- src/VmaUsage.h | 1 + src/vk_mem_alloc.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VmaUsage.h b/src/VmaUsage.h index 06a080d..833ba14 100644 --- a/src/VmaUsage.h +++ b/src/VmaUsage.h @@ -60,6 +60,7 @@ include all public interface declarations. Example: #pragma warning(disable: 4127) // conditional expression is constant #pragma warning(disable: 4100) // unreferenced formal parameter #pragma warning(disable: 4189) // local variable is initialized but not referenced +#pragma warning(disable: 4324) // structure was padded due to alignment specifier #include "vk_mem_alloc.h" diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 91f5b47..0238038 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -4344,7 +4344,7 @@ private: union Item { uint32_t NextFreeIndex; - char Value[sizeof(T)]; + alignas(T) char Value[sizeof(T)]; }; struct ItemBlock