Update vkmemalloc to 2.3.0
Task-number: QTBUG-90219 Change-Id: I382f59edbc869fd4f3557411264f290e9fd5dee5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
3f3d5e6716
commit
77350b7a71
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved.
|
Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
26
src/3rdparty/VulkanMemoryAllocator/patches/0001-Disable-SRWLOCK-for-MinGW.patch
vendored
Normal file
26
src/3rdparty/VulkanMemoryAllocator/patches/0001-Disable-SRWLOCK-for-MinGW.patch
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From 1e4a10230381acc79768fd577987dde4255d6148 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||||
|
Date: Thu, 14 Jan 2021 11:22:09 +0100
|
||||||
|
Subject: [PATCH 1/4] Disable SRWLOCK for MinGW
|
||||||
|
|
||||||
|
Change-Id: Ie671e7bcf88ef28eb177a6fba17964a5e8ae30c0
|
||||||
|
---
|
||||||
|
src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
index 0dfb66efc6..8e579967d9 100644
|
||||||
|
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
@@ -3691,7 +3691,7 @@ void *aligned_alloc(size_t alignment, size_t size)
|
||||||
|
std::shared_mutex m_Mutex;
|
||||||
|
};
|
||||||
|
#define VMA_RW_MUTEX VmaRWMutex
|
||||||
|
- #elif defined(_WIN32) && defined(WINVER) && WINVER >= 0x0600
|
||||||
|
+ #elif defined(_WIN32) && defined(WINVER) && WINVER >= 0x0600 && !defined(__MINGW32__)
|
||||||
|
// Use SRWLOCK from WinAPI.
|
||||||
|
// Minimum supported client = Windows Vista, server = Windows Server 2008.
|
||||||
|
class VmaRWMutex
|
||||||
|
--
|
||||||
|
2.23.0.windows.1
|
||||||
|
|
@ -1,20 +1,22 @@
|
|||||||
|
From 8dedd23c769e5b8b76bea9d322fc46a46a2bf76e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||||
|
Date: Thu, 14 Jan 2021 11:25:27 +0100
|
||||||
|
Subject: [PATCH 2/4] Make it compile on macOS 10.15
|
||||||
|
|
||||||
|
Change-Id: I0c26c16ed65668fa90330571d3b741e730b439da
|
||||||
|
---
|
||||||
|
.../VulkanMemoryAllocator/vk_mem_alloc.h | 21 ++++++++++++++++++-
|
||||||
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
index 2355de091f..5d311b750d 100644
|
index 8e579967d9..10369475c7 100644
|
||||||
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
@@ -3167,7 +3167,7 @@ void *aligned_alloc(size_t alignment, size_t size)
|
@@ -3560,7 +3560,24 @@ void *aligned_alloc(size_t alignment, size_t size)
|
||||||
|
|
||||||
return memalign(alignment, size);
|
return memalign(alignment, size);
|
||||||
}
|
}
|
||||||
-#elif defined(__APPLE__) || defined(__ANDROID__)
|
-#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
||||||
+#elif defined(__ANDROID__)
|
|
||||||
#include <cstdlib>
|
|
||||||
void *aligned_alloc(size_t alignment, size_t size)
|
|
||||||
{
|
|
||||||
@@ -3182,6 +3182,23 @@ void *aligned_alloc(size_t alignment, size_t size)
|
|
||||||
return pointer;
|
|
||||||
return VMA_NULL;
|
|
||||||
}
|
|
||||||
+#elif defined(__APPLE__)
|
+#elif defined(__APPLE__)
|
||||||
+#include <cstdlib>
|
+#include <cstdlib>
|
||||||
+// aligned_alloc() is marked as macOS 10.15 only in the 10.15 SDK,
|
+// aligned_alloc() is marked as macOS 10.15 only in the 10.15 SDK,
|
||||||
@ -32,10 +34,11 @@ index 2355de091f..5d311b750d 100644
|
|||||||
+ return pointer;
|
+ return pointer;
|
||||||
+ return VMA_NULL;
|
+ return VMA_NULL;
|
||||||
+}
|
+}
|
||||||
#endif
|
+#elif defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
||||||
|
#include <cstdlib>
|
||||||
// If your compiler is not compatible with C++11 and definition of
|
void *aligned_alloc(size_t alignment, size_t size)
|
||||||
@@ -3215,6 +3232,8 @@ void *aligned_alloc(size_t alignment, size_t size)
|
{
|
||||||
|
@@ -3608,6 +3625,8 @@ void *aligned_alloc(size_t alignment, size_t size)
|
||||||
#ifndef VMA_SYSTEM_ALIGNED_MALLOC
|
#ifndef VMA_SYSTEM_ALIGNED_MALLOC
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (_aligned_malloc((size), (alignment)))
|
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (_aligned_malloc((size), (alignment)))
|
||||||
@ -44,3 +47,6 @@ index 2355de091f..5d311b750d 100644
|
|||||||
#else
|
#else
|
||||||
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size) ))
|
#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size) ))
|
||||||
#endif
|
#endif
|
||||||
|
--
|
||||||
|
2.23.0.windows.1
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
|
||||||
index f043bdc289..2355de091f 100644
|
|
||||||
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
|
||||||
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
|
||||||
@@ -3298,7 +3298,7 @@ void *aligned_alloc(size_t alignment, size_t size)
|
|
||||||
std::shared_mutex m_Mutex;
|
|
||||||
};
|
|
||||||
#define VMA_RW_MUTEX VmaRWMutex
|
|
||||||
- #elif defined(_WIN32)
|
|
||||||
+ #elif defined(_WIN32) && !defined(__MINGW32__)
|
|
||||||
// Use SRWLOCK from WinAPI.
|
|
||||||
class VmaRWMutex
|
|
||||||
{
|
|
@ -1,8 +1,18 @@
|
|||||||
|
From 2c51f161e9730482b6ebcc4a73b525d5aa4e539a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||||
|
Date: Thu, 14 Jan 2021 11:26:48 +0100
|
||||||
|
Subject: [PATCH 3/4] Fix gcc 8 warning
|
||||||
|
|
||||||
|
Change-Id: I150223178ecc1e177f669f7415b147f9779f019c
|
||||||
|
---
|
||||||
|
src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
index fbe6f9e3e8..f043bdc289 100644
|
index 10369475c7..79efc1f0da 100644
|
||||||
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
@@ -12074,7 +12074,8 @@ void VmaBlockVector::ApplyDefragmentationMovesGpu(
|
@@ -12640,7 +12640,8 @@ void VmaBlockVector::ApplyDefragmentationMovesGpu(
|
||||||
const size_t blockCount = m_Blocks.size();
|
const size_t blockCount = m_Blocks.size();
|
||||||
|
|
||||||
pDefragCtx->blockContexts.resize(blockCount);
|
pDefragCtx->blockContexts.resize(blockCount);
|
||||||
@ -12,3 +22,6 @@ index fbe6f9e3e8..f043bdc289 100644
|
|||||||
|
|
||||||
// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.
|
// Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.
|
||||||
const size_t moveCount = moves.size();
|
const size_t moveCount = moves.size();
|
||||||
|
--
|
||||||
|
2.23.0.windows.1
|
||||||
|
|
@ -1,9 +1,19 @@
|
|||||||
|
From 6b27f49d0a2d2391654cd89f9a9ef77fad934f66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||||
|
Date: Thu, 14 Jan 2021 11:57:18 +0100
|
||||||
|
Subject: [PATCH 4/4] Avoid compiler warnings
|
||||||
|
|
||||||
|
Change-Id: I3c9bc051229b02efeae60e27a53c3c4d17c7f995
|
||||||
|
---
|
||||||
|
.../VulkanMemoryAllocator/vk_mem_alloc.h | 84 ++++++++++++-------
|
||||||
|
1 file changed, 56 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
index a2f7a1b..fbe6f9e 100644
|
index 79efc1f0da..ebaeb4bcff 100644
|
||||||
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
@@ -3661,7 +3661,7 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
|
@@ -4080,7 +4080,7 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
|
||||||
{
|
#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
|
||||||
uint32_t* pDst = (uint32_t*)((char*)pData + offset);
|
uint32_t* pDst = (uint32_t*)((char*)pData + offset);
|
||||||
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
||||||
- for(size_t i = 0; i < numberCount; ++i, ++pDst)
|
- for(size_t i = 0; i < numberCount; ++i, ++pDst)
|
||||||
@ -11,8 +21,8 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
{
|
{
|
||||||
*pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
|
*pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
|
||||||
}
|
}
|
||||||
@@ -3671,7 +3671,7 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
|
@@ -4094,7 +4094,7 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
|
||||||
{
|
#if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
|
||||||
const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);
|
const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);
|
||||||
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
||||||
- for(size_t i = 0; i < numberCount; ++i, ++pSrc)
|
- for(size_t i = 0; i < numberCount; ++i, ++pSrc)
|
||||||
@ -20,7 +30,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
{
|
{
|
||||||
if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
|
if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
|
||||||
{
|
{
|
||||||
@@ -3866,7 +3866,7 @@ public:
|
@@ -4339,7 +4339,7 @@ public:
|
||||||
template<typename U> VmaStlAllocator(const VmaStlAllocator<U>& src) : m_pCallbacks(src.m_pCallbacks) { }
|
template<typename U> VmaStlAllocator(const VmaStlAllocator<U>& src) : m_pCallbacks(src.m_pCallbacks) { }
|
||||||
|
|
||||||
T* allocate(size_t n) { return VmaAllocateArray<T>(m_pCallbacks, n); }
|
T* allocate(size_t n) { return VmaAllocateArray<T>(m_pCallbacks, n); }
|
||||||
@ -29,16 +39,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
bool operator==(const VmaStlAllocator<U>& rhs) const
|
bool operator==(const VmaStlAllocator<U>& rhs) const
|
||||||
@@ -5214,7 +5214,7 @@ public:
|
@@ -6067,7 +6067,7 @@ public:
|
||||||
virtual void FreeAtOffset(VkDeviceSize offset) = 0;
|
|
||||||
|
|
||||||
// Tries to resize (grow or shrink) space for given allocation, in place.
|
|
||||||
- virtual bool ResizeAllocation(const VmaAllocation alloc, VkDeviceSize newSize) { return false; }
|
|
||||||
+ virtual bool ResizeAllocation(const VmaAllocation /*alloc*/, VkDeviceSize /*newSize*/) { return false; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const VkAllocationCallbacks* GetAllocationCallbacks() const { return m_pAllocationCallbacks; }
|
|
||||||
@@ -5574,7 +5574,7 @@ public:
|
|
||||||
|
|
||||||
virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
|
virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
|
|
||||||
virtual void Alloc(
|
virtual void Alloc(
|
||||||
const VmaAllocationRequest& request,
|
const VmaAllocationRequest& request,
|
||||||
@@ -6133,7 +6133,7 @@ public:
|
@@ -6637,7 +6637,7 @@ public:
|
||||||
bool overlappingMoveSupported);
|
bool overlappingMoveSupported);
|
||||||
virtual ~VmaDefragmentationAlgorithm_Fast();
|
virtual ~VmaDefragmentationAlgorithm_Fast();
|
||||||
|
|
||||||
@ -56,16 +57,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
virtual void AddAll() { m_AllAllocations = true; }
|
virtual void AddAll() { m_AllAllocations = true; }
|
||||||
|
|
||||||
virtual VkResult Defragment(
|
virtual VkResult Defragment(
|
||||||
@@ -6318,7 +6318,7 @@ private:
|
@@ -7699,6 +7699,7 @@ void VmaJsonWriter::BeginValue(bool isString)
|
||||||
// Redundant, for convenience not to fetch from m_hCustomPool->m_BlockVector or m_hAllocator->m_pBlockVectors.
|
|
||||||
VmaBlockVector* const m_pBlockVector;
|
|
||||||
const uint32_t m_CurrFrameIndex;
|
|
||||||
- const uint32_t m_AlgorithmFlags;
|
|
||||||
+ /*const uint32_t m_AlgorithmFlags;*/
|
|
||||||
// Owner of this object.
|
|
||||||
VmaDefragmentationAlgorithm* m_pAlgorithm;
|
|
||||||
|
|
||||||
@@ -7073,6 +7073,7 @@ void VmaJsonWriter::BeginValue(bool isString)
|
|
||||||
if(currItem.type == COLLECTION_TYPE_OBJECT &&
|
if(currItem.type == COLLECTION_TYPE_OBJECT &&
|
||||||
currItem.valueCount % 2 == 0)
|
currItem.valueCount % 2 == 0)
|
||||||
{
|
{
|
||||||
@ -73,7 +65,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(isString);
|
VMA_ASSERT(isString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7660,7 +7661,9 @@ bool VmaBlockMetadata_Generic::Validate() const
|
@@ -8251,7 +8252,9 @@ bool VmaBlockMetadata_Generic::Validate() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Margin required between allocations - every free space must be at least that large.
|
// Margin required between allocations - every free space must be at least that large.
|
||||||
@ -83,7 +75,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -7806,6 +7809,7 @@ bool VmaBlockMetadata_Generic::CreateAllocationRequest(
|
@@ -8397,6 +8400,7 @@ bool VmaBlockMetadata_Generic::CreateAllocationRequest(
|
||||||
{
|
{
|
||||||
VMA_ASSERT(allocSize > 0);
|
VMA_ASSERT(allocSize > 0);
|
||||||
VMA_ASSERT(!upperAddress);
|
VMA_ASSERT(!upperAddress);
|
||||||
@ -91,37 +83,20 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
|
VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
|
||||||
VMA_ASSERT(pAllocationRequest != VMA_NULL);
|
VMA_ASSERT(pAllocationRequest != VMA_NULL);
|
||||||
VMA_HEAVY_ASSERT(Validate());
|
VMA_HEAVY_ASSERT(Validate());
|
||||||
@@ -8033,6 +8037,7 @@ void VmaBlockMetadata_Generic::Alloc(
|
@@ -10136,10 +10140,12 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(
|
||||||
VmaAllocation hAllocation)
|
// Apply VMA_DEBUG_MARGIN at the end.
|
||||||
{
|
if(VMA_DEBUG_MARGIN > 0)
|
||||||
VMA_ASSERT(!upperAddress);
|
{
|
||||||
+ (void) upperAddress;
|
|
||||||
VMA_ASSERT(request.item != m_Suballocations.end());
|
|
||||||
VmaSuballocation& suballoc = *request.item;
|
|
||||||
// Given suballocation is a free block.
|
|
||||||
@@ -9609,7 +9614,7 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
|
|
||||||
bool upperAddress,
|
|
||||||
VmaSuballocationType allocType,
|
|
||||||
bool canMakeOtherLost,
|
|
||||||
- uint32_t strategy,
|
|
||||||
+ uint32_t /*strategy*/,
|
|
||||||
VmaAllocationRequest* pAllocationRequest)
|
|
||||||
{
|
|
||||||
VMA_ASSERT(allocSize > 0);
|
|
||||||
@@ -9651,10 +9656,12 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
|
|
||||||
// Apply VMA_DEBUG_MARGIN at the end.
|
|
||||||
if(VMA_DEBUG_MARGIN > 0)
|
|
||||||
{
|
|
||||||
+#if VMA_DEBUG_MARGIN
|
+#if VMA_DEBUG_MARGIN
|
||||||
if(resultOffset < VMA_DEBUG_MARGIN)
|
if(resultOffset < VMA_DEBUG_MARGIN)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
resultOffset -= VMA_DEBUG_MARGIN;
|
|
||||||
}
|
}
|
||||||
|
+#endif
|
||||||
|
resultOffset -= VMA_DEBUG_MARGIN;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10542,18 +10549,19 @@ void VmaBlockMetadata_Buddy::PrintDetailedMap(class VmaJsonWriter& json) const
|
@@ -11079,18 +11085,19 @@ void VmaBlockMetadata_Buddy::PrintDetailedMap(class VmaJsonWriter& json) const
|
||||||
#endif // #if VMA_STATS_STRING_ENABLED
|
#endif // #if VMA_STATS_STRING_ENABLED
|
||||||
|
|
||||||
bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
|
bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
|
||||||
@ -145,7 +120,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
|
|
||||||
// Simple way to respect bufferImageGranularity. May be optimized some day.
|
// Simple way to respect bufferImageGranularity. May be optimized some day.
|
||||||
// Whenever it might be an OPTIMAL image...
|
// Whenever it might be an OPTIMAL image...
|
||||||
@@ -10593,8 +10601,8 @@ bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
|
@@ -11131,8 +11138,8 @@ bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
|
bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
|
||||||
@ -156,7 +131,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VmaAllocationRequest* pAllocationRequest)
|
VmaAllocationRequest* pAllocationRequest)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -10604,7 +10612,7 @@ bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
|
@@ -11142,7 +11149,7 @@ bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
|
||||||
return pAllocationRequest->itemsToMakeLostCount == 0;
|
return pAllocationRequest->itemsToMakeLostCount == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,19 +140,16 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Lost allocations are not supported in buddy allocator at the moment.
|
Lost allocations are not supported in buddy allocator at the moment.
|
||||||
@@ -10615,9 +10623,9 @@ uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex,
|
@@ -11153,7 +11160,7 @@ uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex,
|
||||||
|
|
||||||
void VmaBlockMetadata_Buddy::Alloc(
|
void VmaBlockMetadata_Buddy::Alloc(
|
||||||
const VmaAllocationRequest& request,
|
const VmaAllocationRequest& request,
|
||||||
- VmaSuballocationType type,
|
- VmaSuballocationType type,
|
||||||
+ VmaSuballocationType /*type*/,
|
+ VmaSuballocationType /*type*/,
|
||||||
VkDeviceSize allocSize,
|
VkDeviceSize allocSize,
|
||||||
- bool upperAddress,
|
|
||||||
+ bool /*upperAddress*/,
|
|
||||||
VmaAllocation hAllocation)
|
VmaAllocation hAllocation)
|
||||||
{
|
{
|
||||||
const uint32_t targetLevel = AllocSizeToLevel(allocSize);
|
@@ -11480,7 +11487,7 @@ void VmaBlockMetadata_Buddy::PrintDetailedMapNode(class VmaJsonWriter& json, con
|
||||||
@@ -10941,7 +10949,7 @@ void VmaBlockMetadata_Buddy::PrintDetailedMapNode(class VmaJsonWriter& json, con
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// class VmaDeviceMemoryBlock
|
// class VmaDeviceMemoryBlock
|
||||||
|
|
||||||
@ -186,7 +158,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
m_pMetadata(VMA_NULL),
|
m_pMetadata(VMA_NULL),
|
||||||
m_MemoryTypeIndex(UINT32_MAX),
|
m_MemoryTypeIndex(UINT32_MAX),
|
||||||
m_Id(0),
|
m_Id(0),
|
||||||
@@ -11691,6 +11699,7 @@ VkResult VmaBlockVector::AllocatePage(
|
@@ -12268,6 +12275,7 @@ VkResult VmaBlockVector::AllocatePage(
|
||||||
if(IsCorruptionDetectionEnabled())
|
if(IsCorruptionDetectionEnabled())
|
||||||
{
|
{
|
||||||
VkResult res = pBestRequestBlock->WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);
|
VkResult res = pBestRequestBlock->WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);
|
||||||
@ -194,7 +166,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
|
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
|
||||||
}
|
}
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
@@ -11729,6 +11738,7 @@ void VmaBlockVector::Free(
|
@@ -12314,6 +12322,7 @@ void VmaBlockVector::Free(
|
||||||
if(IsCorruptionDetectionEnabled())
|
if(IsCorruptionDetectionEnabled())
|
||||||
{
|
{
|
||||||
VkResult res = pBlock->ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation->GetOffset(), hAllocation->GetSize());
|
VkResult res = pBlock->ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation->GetOffset(), hAllocation->GetSize());
|
||||||
@ -202,7 +174,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to validate magic value.");
|
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to validate magic value.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11894,6 +11904,7 @@ VkResult VmaBlockVector::AllocateFromBlock(
|
@@ -12472,6 +12481,7 @@ VkResult VmaBlockVector::AllocateFromBlock(
|
||||||
if(IsCorruptionDetectionEnabled())
|
if(IsCorruptionDetectionEnabled())
|
||||||
{
|
{
|
||||||
VkResult res = pBlock->WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);
|
VkResult res = pBlock->WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);
|
||||||
@ -210,7 +182,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
|
VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
|
||||||
}
|
}
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
@@ -11903,7 +11914,8 @@ VkResult VmaBlockVector::AllocateFromBlock(
|
@@ -12481,7 +12491,8 @@ VkResult VmaBlockVector::AllocateFromBlock(
|
||||||
|
|
||||||
VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)
|
VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)
|
||||||
{
|
{
|
||||||
@ -220,7 +192,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
allocInfo.memoryTypeIndex = m_MemoryTypeIndex;
|
allocInfo.memoryTypeIndex = m_MemoryTypeIndex;
|
||||||
allocInfo.allocationSize = blockSize;
|
allocInfo.allocationSize = blockSize;
|
||||||
VkDeviceMemory mem = VK_NULL_HANDLE;
|
VkDeviceMemory mem = VK_NULL_HANDLE;
|
||||||
@@ -11991,7 +12003,8 @@ void VmaBlockVector::ApplyDefragmentationMovesCpu(
|
@@ -12570,7 +12581,8 @@ void VmaBlockVector::ApplyDefragmentationMovesCpu(
|
||||||
if(pDefragCtx->res == VK_SUCCESS)
|
if(pDefragCtx->res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
||||||
@ -230,80 +202,32 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
|
|
||||||
for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
|
for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
|
||||||
{
|
{
|
||||||
@@ -12076,7 +12089,8 @@ void VmaBlockVector::ApplyDefragmentationMovesGpu(
|
@@ -13032,7 +13044,7 @@ VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(
|
||||||
|
|
||||||
// Go over all blocks. Create and bind buffer for whole block if necessary.
|
|
||||||
{
|
|
||||||
- VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
|
||||||
+ VkBufferCreateInfo bufCreateInfo = {};
|
|
||||||
+ bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
||||||
bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT |
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
|
||||||
|
|
||||||
@@ -12101,8 +12115,9 @@ void VmaBlockVector::ApplyDefragmentationMovesGpu(
|
|
||||||
// Go over all moves. Post data transfer commands to command buffer.
|
|
||||||
if(pDefragCtx->res == VK_SUCCESS)
|
|
||||||
{
|
|
||||||
- const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
|
||||||
- VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
|
|
||||||
+ /*const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
|
||||||
+ VkMappedMemoryRange memRange = {};
|
|
||||||
+ memRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;*/
|
|
||||||
|
|
||||||
for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
|
|
||||||
{
|
|
||||||
@@ -12435,10 +12450,10 @@ VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(
|
|
||||||
VmaAllocator hAllocator,
|
VmaAllocator hAllocator,
|
||||||
VmaBlockVector* pBlockVector,
|
VmaBlockVector* pBlockVector,
|
||||||
uint32_t currentFrameIndex,
|
uint32_t currentFrameIndex,
|
||||||
- bool overlappingMoveSupported) :
|
- bool overlappingMoveSupported) :
|
||||||
+ bool /*overlappingMoveSupported*/) :
|
+ bool /*overlappingMoveSupported*/) :
|
||||||
VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),
|
VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),
|
||||||
- m_AllAllocations(false),
|
|
||||||
m_AllocationCount(0),
|
m_AllocationCount(0),
|
||||||
+ m_AllAllocations(false),
|
m_AllAllocations(false),
|
||||||
m_BytesMoved(0),
|
@@ -15032,8 +15044,13 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
|
||||||
m_AllocationsMoved(0),
|
|
||||||
m_Blocks(VmaStlAllocator<BlockInfo*>(hAllocator->GetAllocationCallbacks()))
|
|
||||||
@@ -12813,7 +12828,7 @@ VkResult VmaDefragmentationAlgorithm_Fast::Defragment(
|
|
||||||
size_t freeSpaceOrigBlockIndex = m_BlockInfos[freeSpaceInfoIndex].origBlockIndex;
|
|
||||||
VmaDeviceMemoryBlock* pFreeSpaceBlock = m_pBlockVector->GetBlock(freeSpaceOrigBlockIndex);
|
|
||||||
VmaBlockMetadata_Generic* pFreeSpaceMetadata = (VmaBlockMetadata_Generic*)pFreeSpaceBlock->m_pMetadata;
|
|
||||||
- VkDeviceSize freeSpaceBlockSize = pFreeSpaceMetadata->GetSize();
|
|
||||||
+ /*VkDeviceSize freeSpaceBlockSize = pFreeSpaceMetadata->GetSize();*/
|
|
||||||
|
|
||||||
// Same block
|
|
||||||
if(freeSpaceInfoIndex == srcBlockInfoIndex)
|
|
||||||
@@ -13098,7 +13113,7 @@ VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(
|
|
||||||
VmaPool hCustomPool,
|
|
||||||
VmaBlockVector* pBlockVector,
|
|
||||||
uint32_t currFrameIndex,
|
|
||||||
- uint32_t algorithmFlags) :
|
|
||||||
+ uint32_t /*algorithmFlags*/) :
|
|
||||||
res(VK_SUCCESS),
|
|
||||||
mutexLocked(false),
|
|
||||||
blockContexts(VmaStlAllocator<VmaBlockDefragmentationContext>(hAllocator->GetAllocationCallbacks())),
|
|
||||||
@@ -13106,7 +13121,7 @@ VmaBlockVectorDefragmentationContext::VmaBlockVectorDefragmentationContext(
|
|
||||||
m_hCustomPool(hCustomPool),
|
|
||||||
m_pBlockVector(pBlockVector),
|
|
||||||
m_CurrFrameIndex(currFrameIndex),
|
|
||||||
- m_AlgorithmFlags(algorithmFlags),
|
|
||||||
+ /*m_AlgorithmFlags(algorithmFlags),*/
|
|
||||||
m_pAlgorithm(VMA_NULL),
|
|
||||||
m_Allocations(VmaStlAllocator<AllocInfo>(hAllocator->GetAllocationCallbacks())),
|
|
||||||
m_AllAllocations(false)
|
|
||||||
@@ -14311,19 +14326,21 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
|
|
||||||
bool map,
|
bool map,
|
||||||
bool isUserDataString,
|
bool isUserDataString,
|
||||||
void* pUserData,
|
void* pUserData,
|
||||||
- VkBuffer dedicatedBuffer,
|
+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
|
||||||
- VkImage dedicatedImage,
|
VkBuffer dedicatedBuffer,
|
||||||
|
VkImage dedicatedImage,
|
||||||
|
+#else
|
||||||
+ VkBuffer /*dedicatedBuffer*/,
|
+ VkBuffer /*dedicatedBuffer*/,
|
||||||
+ VkImage /*dedicatedImage*/,
|
+ VkImage /*dedicatedImage*/,
|
||||||
|
+#endif
|
||||||
size_t allocationCount,
|
size_t allocationCount,
|
||||||
VmaAllocation* pAllocations)
|
VmaAllocation* pAllocations)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(allocationCount > 0 && pAllocations);
|
@@ -15050,12 +15067,14 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
|
- VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
|
||||||
+ VkMemoryAllocateInfo allocInfo = {};
|
+ VkMemoryAllocateInfo allocInfo = {};
|
||||||
@ -311,25 +235,16 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
allocInfo.memoryTypeIndex = memTypeIndex;
|
allocInfo.memoryTypeIndex = memTypeIndex;
|
||||||
allocInfo.allocationSize = size;
|
allocInfo.allocationSize = size;
|
||||||
|
|
||||||
#if VMA_DEDICATED_ALLOCATION
|
#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
|
||||||
- VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };
|
- VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };
|
||||||
+ VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = {};
|
+ VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = {};
|
||||||
+ dedicatedAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR;
|
+ dedicatedAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR;
|
||||||
if(m_UseKhrDedicatedAllocation)
|
if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||||
{
|
{
|
||||||
if(dedicatedBuffer != VK_NULL_HANDLE)
|
if(dedicatedBuffer != VK_NULL_HANDLE)
|
||||||
@@ -14341,7 +14358,7 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
|
@@ -15195,12 +15214,15 @@ void VmaAllocator_T::GetBufferMemoryRequirements(
|
||||||
#endif // #if VMA_DEDICATED_ALLOCATION
|
#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
|
||||||
|
if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||||
size_t allocIndex;
|
|
||||||
- VkResult res;
|
|
||||||
+ VkResult res = VK_SUCCESS;
|
|
||||||
for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
|
|
||||||
{
|
|
||||||
res = AllocateDedicatedMemoryPage(
|
|
||||||
@@ -14460,12 +14477,15 @@ void VmaAllocator_T::GetBufferMemoryRequirements(
|
|
||||||
#if VMA_DEDICATED_ALLOCATION
|
|
||||||
if(m_UseKhrDedicatedAllocation)
|
|
||||||
{
|
{
|
||||||
- VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };
|
- VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };
|
||||||
+ VkBufferMemoryRequirementsInfo2KHR memReqInfo = {};
|
+ VkBufferMemoryRequirementsInfo2KHR memReqInfo = {};
|
||||||
@ -346,9 +261,9 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
memReq2.pNext = &memDedicatedReq;
|
memReq2.pNext = &memDedicatedReq;
|
||||||
|
|
||||||
(*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
|
(*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
|
||||||
@@ -14492,12 +14512,15 @@ void VmaAllocator_T::GetImageMemoryRequirements(
|
@@ -15227,12 +15249,15 @@ void VmaAllocator_T::GetImageMemoryRequirements(
|
||||||
#if VMA_DEDICATED_ALLOCATION
|
#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
|
||||||
if(m_UseKhrDedicatedAllocation)
|
if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||||
{
|
{
|
||||||
- VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };
|
- VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };
|
||||||
+ VkImageMemoryRequirementsInfo2KHR memReqInfo = {};
|
+ VkImageMemoryRequirementsInfo2KHR memReqInfo = {};
|
||||||
@ -365,16 +280,23 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
memReq2.pNext = &memDedicatedReq;
|
memReq2.pNext = &memDedicatedReq;
|
||||||
|
|
||||||
(*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
|
(*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
|
||||||
@@ -14734,7 +14757,7 @@ VkResult VmaAllocator_T::ResizeAllocation(
|
@@ -15461,13 +15486,13 @@ VkResult VmaAllocator_T::ResizeAllocation(
|
||||||
}
|
// This function is deprecated and so it does nothing. It's left for backward compatibility.
|
||||||
else
|
if(newSize == 0 || alloc->GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)
|
||||||
{
|
{
|
||||||
- return VK_ERROR_OUT_OF_POOL_MEMORY;
|
- return VK_ERROR_VALIDATION_FAILED_EXT;
|
||||||
+ return VkResult(-1000069000); // VK_ERROR_OUT_OF_POOL_MEMORY
|
+ return VkResult(-1000011001); // VK_ERROR_VALIDATION_FAILED_EXT
|
||||||
}
|
}
|
||||||
default:
|
if(newSize == alloc->GetSize())
|
||||||
VMA_ASSERT(0);
|
{
|
||||||
@@ -15000,6 +15023,7 @@ void VmaAllocator_T::DestroyPool(VmaPool pool)
|
return VK_SUCCESS;
|
||||||
|
}
|
||||||
|
- return VK_ERROR_OUT_OF_POOL_MEMORY;
|
||||||
|
+ return VkResult(-1000069000); // VK_ERROR_OUT_OF_POOL_MEMORY
|
||||||
|
}
|
||||||
|
|
||||||
|
void VmaAllocator_T::CalculateStats(VmaStats* pStats)
|
||||||
|
@@ -15780,6 +15805,7 @@ void VmaAllocator_T::DestroyPool(VmaPool pool)
|
||||||
{
|
{
|
||||||
VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);
|
VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);
|
||||||
bool success = VmaVectorRemoveSorted<VmaPointerLess>(m_Pools, pool);
|
bool success = VmaVectorRemoveSorted<VmaPointerLess>(m_Pools, pool);
|
||||||
@ -382,7 +304,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(success && "Pool not found in Allocator.");
|
VMA_ASSERT(success && "Pool not found in Allocator.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15248,7 +15272,8 @@ void VmaAllocator_T::FlushOrInvalidateAllocation(
|
@@ -16111,7 +16137,8 @@ void VmaAllocator_T::FlushOrInvalidateAllocation(
|
||||||
|
|
||||||
const VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
const VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
|
||||||
|
|
||||||
@ -392,7 +314,7 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
memRange.memory = hAllocation->GetMemory();
|
memRange.memory = hAllocation->GetMemory();
|
||||||
|
|
||||||
switch(hAllocation->GetType())
|
switch(hAllocation->GetType())
|
||||||
@@ -15321,6 +15346,7 @@ void VmaAllocator_T::FreeDedicatedMemory(VmaAllocation allocation)
|
@@ -16184,6 +16211,7 @@ void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
|
||||||
AllocationVectorType* const pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];
|
AllocationVectorType* const pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];
|
||||||
VMA_ASSERT(pDedicatedAllocations);
|
VMA_ASSERT(pDedicatedAllocations);
|
||||||
bool success = VmaVectorRemoveSorted<VmaPointerLess>(*pDedicatedAllocations, allocation);
|
bool success = VmaVectorRemoveSorted<VmaPointerLess>(*pDedicatedAllocations, allocation);
|
||||||
@ -400,3 +322,6 @@ index a2f7a1b..fbe6f9e 100644
|
|||||||
VMA_ASSERT(success);
|
VMA_ASSERT(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0.windows.1
|
||||||
|
|
150
src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch
vendored
Normal file
150
src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
From e4cf9a73270f586ed15fcd899f3b8f7c0a3253b8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||||
|
Date: Thu, 14 Jan 2021 13:31:15 +0100
|
||||||
|
Subject: [PATCH] More MingW 8.1 warning workarounds
|
||||||
|
|
||||||
|
Change-Id: Ib1df65672c312abce4489f5175d9a69af157c206
|
||||||
|
---
|
||||||
|
.../VulkanMemoryAllocator/vk_mem_alloc.h | 37 +++++++++++++------
|
||||||
|
1 file changed, 25 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
index ebaeb4bcff..6b10e1eb94 100644
|
||||||
|
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
|
||||||
|
@@ -4086,6 +4086,8 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// no-op
|
||||||
|
+ (void) pData;
|
||||||
|
+ (void) offset;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -4101,6 +4103,9 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#else
|
||||||
|
+ (void) pData;
|
||||||
|
+ (void) offset;
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -4400,7 +4405,7 @@ public:
|
||||||
|
|
||||||
|
// This version of the constructor is here for compatibility with pre-C++14 std::vector.
|
||||||
|
// value is unused.
|
||||||
|
- VmaVector(size_t count, const T& value, const AllocatorT& allocator)
|
||||||
|
+ VmaVector(size_t count, const T& /*value*/, const AllocatorT& allocator)
|
||||||
|
: VmaVector(count, allocator) {}
|
||||||
|
|
||||||
|
VmaVector(const VmaVector<T, AllocatorT>& src) :
|
||||||
|
@@ -6002,7 +6007,7 @@ private:
|
||||||
|
VkDeviceSize allocAlignment,
|
||||||
|
VmaSuballocationType allocType,
|
||||||
|
bool canMakeOtherLost,
|
||||||
|
- uint32_t strategy,
|
||||||
|
+ uint32_t /*strategy*/,
|
||||||
|
VmaAllocationRequest* pAllocationRequest);
|
||||||
|
bool CreateAllocationRequest_UpperAddress(
|
||||||
|
uint32_t currentFrameIndex,
|
||||||
|
@@ -10098,14 +10103,14 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(
|
||||||
|
- uint32_t currentFrameIndex,
|
||||||
|
- uint32_t frameInUseCount,
|
||||||
|
+ uint32_t /*currentFrameIndex*/,
|
||||||
|
+ uint32_t /*frameInUseCount*/,
|
||||||
|
VkDeviceSize bufferImageGranularity,
|
||||||
|
VkDeviceSize allocSize,
|
||||||
|
VkDeviceSize allocAlignment,
|
||||||
|
VmaSuballocationType allocType,
|
||||||
|
- bool canMakeOtherLost,
|
||||||
|
- uint32_t strategy,
|
||||||
|
+ bool /*canMakeOtherLost*/,
|
||||||
|
+ uint32_t /*strategy*/,
|
||||||
|
VmaAllocationRequest* pAllocationRequest)
|
||||||
|
{
|
||||||
|
const VkDeviceSize size = GetSize();
|
||||||
|
@@ -10227,7 +10232,7 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(
|
||||||
|
VkDeviceSize allocAlignment,
|
||||||
|
VmaSuballocationType allocType,
|
||||||
|
bool canMakeOtherLost,
|
||||||
|
- uint32_t strategy,
|
||||||
|
+ uint32_t /*strategy*/,
|
||||||
|
VmaAllocationRequest* pAllocationRequest)
|
||||||
|
{
|
||||||
|
const VkDeviceSize size = GetSize();
|
||||||
|
@@ -10678,6 +10683,7 @@ void VmaBlockMetadata_Linear::Alloc(
|
||||||
|
// New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.
|
||||||
|
VMA_ASSERT(!suballocations1st.empty() &&
|
||||||
|
request.offset + allocSize <= suballocations1st[m_1stNullItemsBeginCount].offset);
|
||||||
|
+ (void) suballocations1st;
|
||||||
|
SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
|
||||||
|
|
||||||
|
switch(m_2ndVectorMode)
|
||||||
|
@@ -11932,7 +11938,7 @@ VkResult VmaBlockVector::AllocatePage(
|
||||||
|
const bool mapped = (createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
|
||||||
|
const bool isUserDataString = (createInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;
|
||||||
|
|
||||||
|
- const bool withinBudget = (createInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0;
|
||||||
|
+ //const bool withinBudget = (createInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0;
|
||||||
|
VkDeviceSize freeMemory;
|
||||||
|
{
|
||||||
|
const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);
|
||||||
|
@@ -15976,7 +15982,8 @@ VkResult VmaAllocator_T::BindVulkanBuffer(
|
||||||
|
if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
|
||||||
|
m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)
|
||||||
|
{
|
||||||
|
- VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };
|
||||||
|
+ VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = {};
|
||||||
|
+ bindBufferMemoryInfo.sType = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR;
|
||||||
|
bindBufferMemoryInfo.pNext = pNext;
|
||||||
|
bindBufferMemoryInfo.buffer = buffer;
|
||||||
|
bindBufferMemoryInfo.memory = memory;
|
||||||
|
@@ -16007,7 +16014,8 @@ VkResult VmaAllocator_T::BindVulkanImage(
|
||||||
|
if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
|
||||||
|
m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)
|
||||||
|
{
|
||||||
|
- VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };
|
||||||
|
+ VkBindImageMemoryInfoKHR bindBufferMemoryInfo = {};
|
||||||
|
+ bindBufferMemoryInfo.sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR;
|
||||||
|
bindBufferMemoryInfo.pNext = pNext;
|
||||||
|
bindBufferMemoryInfo.image = image;
|
||||||
|
bindBufferMemoryInfo.memory = memory;
|
||||||
|
@@ -16263,9 +16271,11 @@ void VmaAllocator_T::UpdateVulkanBudget()
|
||||||
|
{
|
||||||
|
VMA_ASSERT(m_UseExtMemoryBudget);
|
||||||
|
|
||||||
|
- VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };
|
||||||
|
+ VkPhysicalDeviceMemoryProperties2KHR memProps = {};
|
||||||
|
+ memProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR;
|
||||||
|
|
||||||
|
- VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };
|
||||||
|
+ VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = {};
|
||||||
|
+ budgetProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
|
||||||
|
memProps.pNext = &budgetProps;
|
||||||
|
|
||||||
|
GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &memProps);
|
||||||
|
@@ -16883,6 +16893,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
|
||||||
|
const char** ppName)
|
||||||
|
{
|
||||||
|
VMA_ASSERT(allocator && pool);
|
||||||
|
+ (void) allocator;
|
||||||
|
|
||||||
|
VMA_DEBUG_LOG("vmaGetPoolName");
|
||||||
|
|
||||||
|
@@ -16909,6 +16920,8 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
|
||||||
|
{
|
||||||
|
allocator->GetRecorder()->RecordSetPoolName(allocator->GetCurrentFrameIndex(), pool, pName);
|
||||||
|
}
|
||||||
|
+#else
|
||||||
|
+ (void) allocator;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0.windows.1
|
||||||
|
|
@ -7,10 +7,10 @@
|
|||||||
"QtUsage": "Memory management for the Vulkan backend of QRhi.",
|
"QtUsage": "Memory management for the Vulkan backend of QRhi.",
|
||||||
|
|
||||||
"Homepage": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator",
|
"Homepage": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator",
|
||||||
"Version": "2.2.0",
|
"Version": "2.3.0",
|
||||||
"License": "MIT License",
|
"License": "MIT License",
|
||||||
"LicenseId": "MIT",
|
"LicenseId": "MIT",
|
||||||
"LicenseFile": "LICENSE.txt",
|
"LicenseFile": "LICENSE.txt",
|
||||||
"Copyright": "Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved."
|
"Copyright": "Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
3078
src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
vendored
3078
src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user