mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 04:10:06 +00:00
Fixed potential integer overflow in VmaAllocator_T::AllocateMemoryOfType when maxMemoryAllocationCount Vulkan limit has high value
Fixes #300
This commit is contained in:
parent
14469a5eea
commit
2606c0039f
@ -14475,7 +14475,8 @@ VkResult VmaAllocator_T::AllocateMemoryOfType(
|
|||||||
// Protection against creating each allocation as dedicated when we reach or exceed heap size/budget,
|
// Protection against creating each allocation as dedicated when we reach or exceed heap size/budget,
|
||||||
// which can quickly deplete maxMemoryAllocationCount: Don't prefer dedicated allocations when above
|
// which can quickly deplete maxMemoryAllocationCount: Don't prefer dedicated allocations when above
|
||||||
// 3/4 of the maximum allocation count.
|
// 3/4 of the maximum allocation count.
|
||||||
if(m_DeviceMemoryCount.load() > m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount * 3 / 4)
|
if(m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount < UINT32_MAX / 4 &&
|
||||||
|
m_DeviceMemoryCount.load() > m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount * 3 / 4)
|
||||||
{
|
{
|
||||||
dedicatedPreferred = false;
|
dedicatedPreferred = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user