Fix for Linux GCC cont'd. Enabled warning level 4 in Visual Studio for compilation of vk_mem_alloc.h. (Cherry pick from v1)

This commit is contained in:
Adam Sawicki 2017-07-04 15:47:00 +02:00
parent 7ec64121d8
commit b0425876ec
2 changed files with 9 additions and 13 deletions

View File

@ -27,8 +27,11 @@
#define VK_USE_PLATFORM_WIN32_KHR #define VK_USE_PLATFORM_WIN32_KHR
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#pragma warning(push, 4)
#pragma warning(disable: 4127) // warning C4127: conditional expression is constant
#define VMA_IMPLEMENTATION #define VMA_IMPLEMENTATION
#include "vk_mem_alloc.h" #include "vk_mem_alloc.h"
#pragma warning(pop)
#define MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT #define MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT
#include <mathfu/glsl_mappings.h> #include <mathfu/glsl_mappings.h>
@ -1714,7 +1717,7 @@ int main()
RECT rect = { 0, 0, g_SizeX, g_SizeY }; RECT rect = { 0, 0, g_SizeX, g_SizeY };
AdjustWindowRectEx(&rect, style, FALSE, exStyle); AdjustWindowRectEx(&rect, style, FALSE, exStyle);
HWND hWnd = CreateWindowEx( CreateWindowEx(
exStyle, WINDOW_CLASS_NAME, APP_TITLE_W, style, exStyle, WINDOW_CLASS_NAME, APP_TITLE_W, style,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, g_hAppInstance, NULL); NULL, NULL, g_hAppInstance, NULL);

View File

@ -528,7 +528,7 @@ typedef struct VmaDefragmentationInfo {
VkDeviceSize maxBytesToMove; VkDeviceSize maxBytesToMove;
/** \brief Maximum number of allocations that can be moved to different place. /** \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; uint32_t maxAllocationsToMove;
} VmaDefragmentationInfo; } 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) : VmaVector(size_t count, const AllocatorT& allocator) :
m_Allocator(allocator), m_Allocator(allocator),
m_pArray(count ? (T*)VmaAllocateArray<T>(allocator->m_pCallbacks, count) : VMA_NULL), m_pArray(count ? (T*)VmaAllocateArray<T>(allocator->m_pCallbacks, count) : VMA_NULL),
@ -2653,7 +2646,7 @@ struct VmaSuballocationItemSizeLess
}; };
VmaBlock::VmaBlock(VmaAllocator hAllocator) : VmaBlock::VmaBlock(VmaAllocator hAllocator) :
m_MemoryTypeIndex(UINT_MAX), m_MemoryTypeIndex(UINT32_MAX),
m_BlockVectorType(VMA_BLOCK_VECTOR_TYPE_COUNT), m_BlockVectorType(VMA_BLOCK_VECTOR_TYPE_COUNT),
m_hMemory(VK_NULL_HANDLE), m_hMemory(VK_NULL_HANDLE),
m_Size(0), m_Size(0),
@ -4418,7 +4411,7 @@ VkResult VmaAllocator_T::Defragment(
// Main processing. // Main processing.
VkDeviceSize maxBytesToMove = SIZE_MAX; VkDeviceSize maxBytesToMove = SIZE_MAX;
uint32_t maxAllocationsToMove = UINT_MAX; uint32_t maxAllocationsToMove = UINT32_MAX;
if(pDefragmentationInfo != VMA_NULL) if(pDefragmentationInfo != VMA_NULL)
{ {
maxBytesToMove = pDefragmentationInfo->maxBytesToMove; maxBytesToMove = pDefragmentationInfo->maxBytesToMove;
@ -4849,8 +4842,8 @@ VkResult vmaFindMemoryTypeIndex(
if((pMemoryRequirements->flags & VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT) != 0) if((pMemoryRequirements->flags & VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT) != 0)
requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
*pMemoryTypeIndex = UINT_MAX; *pMemoryTypeIndex = UINT32_MAX;
uint32_t minCost = UINT_MAX; uint32_t minCost = UINT32_MAX;
for(uint32_t memTypeIndex = 0, memTypeBit = 1; for(uint32_t memTypeIndex = 0, memTypeBit = 1;
memTypeIndex < allocator->GetMemoryTypeCount(); memTypeIndex < allocator->GetMemoryTypeCount();
++memTypeIndex, memTypeBit <<= 1) ++memTypeIndex, memTypeBit <<= 1)