mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-09-20 14:42:18 +00:00
Return VkResult in vmaInvalidateAllocation and vmaFlushAllocation
Fixes #120
This commit is contained in:
parent
6be35971a2
commit
b52c5a3e84
@ -3344,8 +3344,11 @@ Unmap operation doesn't do that automatically.
|
|||||||
Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
||||||
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
||||||
Do not pass allocation's offset as `offset`!!!
|
Do not pass allocation's offset as `offset`!!!
|
||||||
|
|
||||||
|
This function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is
|
||||||
|
called, otherwise `VK_SUCCESS`.
|
||||||
*/
|
*/
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(
|
VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(
|
||||||
VmaAllocator VMA_NOT_NULL allocator,
|
VmaAllocator VMA_NOT_NULL allocator,
|
||||||
VmaAllocation VMA_NOT_NULL allocation,
|
VmaAllocation VMA_NOT_NULL allocation,
|
||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
@ -3368,8 +3371,11 @@ Map operation doesn't do that automatically.
|
|||||||
Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
||||||
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
||||||
Do not pass allocation's offset as `offset`!!!
|
Do not pass allocation's offset as `offset`!!!
|
||||||
|
|
||||||
|
This function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if
|
||||||
|
it is called, otherwise `VK_SUCCESS`.
|
||||||
*/
|
*/
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(
|
VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(
|
||||||
VmaAllocator VMA_NOT_NULL allocator,
|
VmaAllocator VMA_NOT_NULL allocator,
|
||||||
VmaAllocation VMA_NOT_NULL allocation,
|
VmaAllocation VMA_NOT_NULL allocation,
|
||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
@ -7622,7 +7628,7 @@ public:
|
|||||||
VkImage hImage,
|
VkImage hImage,
|
||||||
const void* pNext);
|
const void* pNext);
|
||||||
|
|
||||||
void FlushOrInvalidateAllocation(
|
VkResult FlushOrInvalidateAllocation(
|
||||||
VmaAllocation hAllocation,
|
VmaAllocation hAllocation,
|
||||||
VkDeviceSize offset, VkDeviceSize size,
|
VkDeviceSize offset, VkDeviceSize size,
|
||||||
VMA_CACHE_OPERATION op);
|
VMA_CACHE_OPERATION op);
|
||||||
@ -16871,12 +16877,13 @@ VkResult VmaAllocator_T::BindImageMemory(
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VmaAllocator_T::FlushOrInvalidateAllocation(
|
VkResult VmaAllocator_T::FlushOrInvalidateAllocation(
|
||||||
VmaAllocation hAllocation,
|
VmaAllocation hAllocation,
|
||||||
VkDeviceSize offset, VkDeviceSize size,
|
VkDeviceSize offset, VkDeviceSize size,
|
||||||
VMA_CACHE_OPERATION op)
|
VMA_CACHE_OPERATION op)
|
||||||
{
|
{
|
||||||
const uint32_t memTypeIndex = hAllocation->GetMemoryTypeIndex();
|
const uint32_t memTypeIndex = hAllocation->GetMemoryTypeIndex();
|
||||||
|
VkResult res = VK_SUCCESS;
|
||||||
if(size > 0 && IsMemoryTypeNonCoherent(memTypeIndex))
|
if(size > 0 && IsMemoryTypeNonCoherent(memTypeIndex))
|
||||||
{
|
{
|
||||||
const VkDeviceSize allocationSize = hAllocation->GetSize();
|
const VkDeviceSize allocationSize = hAllocation->GetSize();
|
||||||
@ -16935,16 +16942,17 @@ void VmaAllocator_T::FlushOrInvalidateAllocation(
|
|||||||
switch(op)
|
switch(op)
|
||||||
{
|
{
|
||||||
case VMA_CACHE_FLUSH:
|
case VMA_CACHE_FLUSH:
|
||||||
(*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &memRange);
|
res = (*GetVulkanFunctions().vkFlushMappedMemoryRanges)(m_hDevice, 1, &memRange);
|
||||||
break;
|
break;
|
||||||
case VMA_CACHE_INVALIDATE:
|
case VMA_CACHE_INVALIDATE:
|
||||||
(*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &memRange);
|
res = (*GetVulkanFunctions().vkInvalidateMappedMemoryRanges)(m_hDevice, 1, &memRange);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
VMA_ASSERT(0);
|
VMA_ASSERT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else: Just ignore this call.
|
// else: Just ignore this call.
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
|
void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
|
||||||
@ -18123,7 +18131,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(
|
|||||||
allocator->Unmap(allocation);
|
allocator->Unmap(allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
|
VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(allocator && allocation);
|
VMA_ASSERT(allocator && allocation);
|
||||||
|
|
||||||
@ -18131,7 +18139,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAl
|
|||||||
|
|
||||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||||
|
|
||||||
allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);
|
VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_FLUSH);
|
||||||
|
|
||||||
#if VMA_RECORDING_ENABLED
|
#if VMA_RECORDING_ENABLED
|
||||||
if(allocator->GetRecorder() != VMA_NULL)
|
if(allocator->GetRecorder() != VMA_NULL)
|
||||||
@ -18141,9 +18149,11 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAl
|
|||||||
allocation, offset, size);
|
allocation, offset, size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
|
VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(allocator && allocation);
|
VMA_ASSERT(allocator && allocation);
|
||||||
|
|
||||||
@ -18151,7 +18161,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator,
|
|||||||
|
|
||||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||||
|
|
||||||
allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);
|
VkResult res = allocator->FlushOrInvalidateAllocation(allocation, offset, size, VMA_CACHE_INVALIDATE);
|
||||||
|
|
||||||
#if VMA_RECORDING_ENABLED
|
#if VMA_RECORDING_ENABLED
|
||||||
if(allocator->GetRecorder() != VMA_NULL)
|
if(allocator->GetRecorder() != VMA_NULL)
|
||||||
@ -18161,6 +18171,8 @@ VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator,
|
|||||||
allocation, offset, size);
|
allocation, offset, size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits)
|
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits)
|
||||||
|
Loading…
Reference in New Issue
Block a user