From b0425876ecfb24d4efd98813ac493293e79f4de0 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 4 Jul 2017 15:47:00 +0200 Subject: [PATCH] Fix for Linux GCC cont'd. Enabled warning level 4 in Visual Studio for compilation of vk_mem_alloc.h. (Cherry pick from v1) --- src/VulkanSample.cpp | 5 ++++- src/vk_mem_alloc.h | 17 +++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/VulkanSample.cpp b/src/VulkanSample.cpp index 4f2fed7..5a2cfe4 100644 --- a/src/VulkanSample.cpp +++ b/src/VulkanSample.cpp @@ -27,8 +27,11 @@ #define VK_USE_PLATFORM_WIN32_KHR #include +#pragma warning(push, 4) +#pragma warning(disable: 4127) // warning C4127: conditional expression is constant #define VMA_IMPLEMENTATION #include "vk_mem_alloc.h" +#pragma warning(pop) #define MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT #include @@ -1714,7 +1717,7 @@ int main() RECT rect = { 0, 0, g_SizeX, g_SizeY }; AdjustWindowRectEx(&rect, style, FALSE, exStyle); - HWND hWnd = CreateWindowEx( + CreateWindowEx( exStyle, WINDOW_CLASS_NAME, APP_TITLE_W, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, g_hAppInstance, NULL); diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 3d23b0a..e230011 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -528,7 +528,7 @@ typedef struct VmaDefragmentationInfo { VkDeviceSize maxBytesToMove; /** \brief Maximum number of allocations that can be moved to different place. - Default is UINT_MAX, which means no limit. + Default is UINT32_MAX, which means no limit. */ uint32_t maxAllocationsToMove; } VmaDefragmentationInfo; @@ -1158,13 +1158,6 @@ public: { } - m_Allocator(allocator), - m_pArray(VMA_NULL), - m_Count(0), - m_Capacity(0) - { - } - VmaVector(size_t count, const AllocatorT& allocator) : m_Allocator(allocator), m_pArray(count ? (T*)VmaAllocateArray(allocator->m_pCallbacks, count) : VMA_NULL), @@ -2653,7 +2646,7 @@ struct VmaSuballocationItemSizeLess }; VmaBlock::VmaBlock(VmaAllocator hAllocator) : - m_MemoryTypeIndex(UINT_MAX), + m_MemoryTypeIndex(UINT32_MAX), m_BlockVectorType(VMA_BLOCK_VECTOR_TYPE_COUNT), m_hMemory(VK_NULL_HANDLE), m_Size(0), @@ -4418,7 +4411,7 @@ VkResult VmaAllocator_T::Defragment( // Main processing. VkDeviceSize maxBytesToMove = SIZE_MAX; - uint32_t maxAllocationsToMove = UINT_MAX; + uint32_t maxAllocationsToMove = UINT32_MAX; if(pDefragmentationInfo != VMA_NULL) { maxBytesToMove = pDefragmentationInfo->maxBytesToMove; @@ -4849,8 +4842,8 @@ VkResult vmaFindMemoryTypeIndex( if((pMemoryRequirements->flags & VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT) != 0) requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; - *pMemoryTypeIndex = UINT_MAX; - uint32_t minCost = UINT_MAX; + *pMemoryTypeIndex = UINT32_MAX; + uint32_t minCost = UINT32_MAX; for(uint32_t memTypeIndex = 0, memTypeBit = 1; memTypeIndex < allocator->GetMemoryTypeCount(); ++memTypeIndex, memTypeBit <<= 1)