@@ -3982,7 +3982,7 @@ VmaBufferImageUsage::VmaBufferImageUsage(const VkBufferCreateInfo &createInfo,
3982
3982
// of the VK_KHR_maintenance5 extension.
3983
3983
const VkBufferUsageFlags2CreateInfoKHR* const usageFlags2 =
3984
3984
VmaPnextChainFind<VkBufferUsageFlags2CreateInfoKHR>(&createInfo, VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR);
3985
- if(usageFlags2 != 0 )
3985
+ if(usageFlags2 != VMA_NULL )
3986
3986
{
3987
3987
this->Value = usageFlags2->usage;
3988
3988
return;
@@ -10153,7 +10153,6 @@ struct VmaVirtualBlock_T
10153
10153
explicit VmaVirtualBlock_T(const VmaVirtualBlockCreateInfo& createInfo);
10154
10154
~VmaVirtualBlock_T();
10155
10155
10156
- VkResult Init() { return VK_SUCCESS; }
10157
10156
bool IsEmpty() const { return m_Metadata->IsEmpty(); }
10158
10157
void Free(VmaVirtualAllocation allocation) { m_Metadata->Free((VmaAllocHandle)allocation); }
10159
10158
void SetAllocationUserData(VmaVirtualAllocation allocation, void* userData) { m_Metadata->SetAllocationUserData((VmaAllocHandle)allocation, userData); }
@@ -11412,7 +11411,7 @@ VkResult VmaBlockVector::AllocatePage(
11412
11411
{
11413
11412
const bool isUpperAddress = (createInfo.flags & VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT) != 0;
11414
11413
11415
- VkDeviceSize freeMemory;
11414
+ VkDeviceSize freeMemory = 0 ;
11416
11415
{
11417
11416
const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);
11418
11417
VmaBudget heapBudget = {};
@@ -11993,6 +11992,8 @@ VmaDefragmentationContext_T::VmaDefragmentationContext_T(
11993
11992
m_AlgorithmState = vma_new_array(hAllocator, StateExtensive, m_BlockVectorCount);
11994
11993
}
11995
11994
break;
11995
+ default:
11996
+ ; // Do nothing.
11996
11997
}
11997
11998
}
11998
11999
@@ -12089,11 +12090,10 @@ VkResult VmaDefragmentationContext_T::DefragmentPassEnd(VmaDefragmentationPassMo
12089
12090
size_t currentCount = 0;
12090
12091
VkDeviceSize freedBlockSize = 0;
12091
12092
12092
- uint32_t vectorIndex;
12093
- VmaBlockVector* vector;
12093
+ uint32_t vectorIndex = 0 ;
12094
+ VmaBlockVector* vector = VMA_NULL ;
12094
12095
if (m_PoolBlockVector != VMA_NULL)
12095
12096
{
12096
- vectorIndex = 0;
12097
12097
vector = m_PoolBlockVector;
12098
12098
}
12099
12099
else
@@ -12178,7 +12178,7 @@ VkResult VmaDefragmentationContext_T::DefragmentPassEnd(VmaDefragmentationPassMo
12178
12178
}
12179
12179
freedBlockSize *= prevCount - currentCount;
12180
12180
12181
- VkDeviceSize dstBlockSize;
12181
+ VkDeviceSize dstBlockSize = SIZE_MAX ;
12182
12182
{
12183
12183
VmaMutexLockRead lock(vector->GetMutex(), vector->GetAllocator()->m_UseMutex);
12184
12184
dstBlockSize = move.dstTmpAllocation->GetBlock()->m_pMetadata->GetSize();
@@ -12354,8 +12354,7 @@ VmaDefragmentationContext_T::CounterStatus VmaDefragmentationContext_T::CheckCou
12354
12354
{
12355
12355
if (++m_IgnoredAllocs < MAX_ALLOCS_TO_IGNORE)
12356
12356
return CounterStatus::Ignore;
12357
- else
12358
- return CounterStatus::End;
12357
+ return CounterStatus::End;
12359
12358
}
12360
12359
12361
12360
m_IgnoredAllocs = 0;
@@ -14574,11 +14573,9 @@ VkResult VmaAllocator_T::BindVulkanBuffer(
14574
14573
bindBufferMemoryInfo.memoryOffset = memoryOffset;
14575
14574
return (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);
14576
14575
}
14577
- else
14578
14576
#endif // #if VMA_VULKAN_VERSION >= 1001000 || VMA_BIND_MEMORY2
14579
- {
14580
- return VK_ERROR_EXTENSION_NOT_PRESENT;
14581
- }
14577
+
14578
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
14582
14579
}
14583
14580
else
14584
14581
{
@@ -15543,7 +15540,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(
15543
15540
15544
15541
const VkDevice hDev = allocator->m_hDevice;
15545
15542
const VmaVulkanFunctions* funcs = &allocator->GetVulkanFunctions();
15546
- VkResult res;
15543
+ VkResult res = VK_SUCCESS ;
15547
15544
15548
15545
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
15549
15546
if(funcs->vkGetDeviceBufferMemoryRequirements)
@@ -15595,7 +15592,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(
15595
15592
15596
15593
const VkDevice hDev = allocator->m_hDevice;
15597
15594
const VmaVulkanFunctions* funcs = &allocator->GetVulkanFunctions();
15598
- VkResult res;
15595
+ VkResult res = VK_SUCCESS ;
15599
15596
15600
15597
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
15601
15598
if(funcs->vkGetDeviceImageMemoryRequirements)
@@ -16712,13 +16709,19 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateVirtualBlock(
16712
16709
VMA_DEBUG_LOG("vmaCreateVirtualBlock");
16713
16710
VMA_DEBUG_GLOBAL_MUTEX_LOCK;
16714
16711
*pVirtualBlock = vma_new(pCreateInfo->pAllocationCallbacks, VmaVirtualBlock_T)(*pCreateInfo);
16712
+ return VK_SUCCESS;
16713
+
16714
+ /*
16715
+ Code for the future if we ever need a separate Init() method that could fail:
16716
+
16715
16717
VkResult res = (*pVirtualBlock)->Init();
16716
16718
if(res < 0)
16717
16719
{
16718
16720
vma_delete(pCreateInfo->pAllocationCallbacks, *pVirtualBlock);
16719
16721
*pVirtualBlock = VK_NULL_HANDLE;
16720
16722
}
16721
16723
return res;
16724
+ */
16722
16725
}
16723
16726
16724
16727
VMA_CALL_PRE void VMA_CALL_POST vmaDestroyVirtualBlock(VmaVirtualBlock VMA_NULLABLE virtualBlock)
0 commit comments