Commit Graph

427 Commits

Author SHA1 Message Date
Adam Sawicki
371261505d vmaFindMemoryTypeIndex: don't add HOST_VISIBLE to preferred flags when CREATE_MAPPED flag is used
This behavior was found to cause issues on PC AMD as well as Android ARM.
2019-04-05 17:44:15 +02:00
Adam Sawicki
4a84207d7c Remove unused variables from VmaBlockVector::ApplyDefragmentationMovesGpu Fixes #58 2019-03-25 23:42:04 +01:00
Adam Sawicki
e5aa3c0a1e Clarified that the library doesn't use STL containers by default.
Because responses in the survey indicate that some users think it does.
2019-03-15 12:26:36 +01:00
Adam Sawicki
b25a20a8da Improved documentation for functions vkFlushMappedMemoryRanges, vkInvalidateMappedMemoryRanges. 2019-03-13 15:57:23 +01:00
Adam Sawicki
3fd40ede96 Fixed initialization order in class VmaDefragmentationAlgorithm_Generic constructor. #57 Thanks @manaskulkarni786 ! 2019-03-11 10:07:28 +01:00
Adam Sawicki
6c8b7a2c3e Added flag VMA_ALLOCATION_CREATE_DONT_BIND_BIT. 2019-03-05 13:40:29 +01:00
Adam Sawicki
5a8c6b47d8 Changed syntax used in VmaAllocator_T::ImportVulkanFunctions to please some compiler on Android. #56 Thanks @renelindsay ! 2019-02-25 11:32:48 +01:00
Adam Sawicki
ce7351bb16 Merge branch 'master' of https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator 2019-02-20 14:56:01 +01:00
Adam Sawicki
f43e9cd270 VulkanSample, CreateTexture function: switched from staging image with VK_IMAGE_TILING_LINEAR to staging buffer and vkCmdCopyBufferToImage. 2019-02-20 14:55:31 +01:00
Amer Koleci
65f096555d Remove unused freeSpaceBlockSize variable. 2019-02-05 18:47:08 +01:00
Amer Koleci
e9ae4199c6 Correctly handle VMA_STATS_STRING_ENABLED define and undefine methods not being used. 2019-02-05 18:45:12 +01:00
Adam Sawicki
cac7d7509e Fixed usage of SRWLOCK from WinAPI. #54 Thanks @wumo ! 2019-01-29 12:20:33 +01:00
Cort
a4dbfffa11 Fix for "potentially uninitialized variable" warning 2019-01-24 21:19:42 -08:00
Adam Sawicki
a195308982 Major optimization: Added VmaAllocationObjectAllocator to allocate VmaAllocation objects out of free-list allocator instead of making separate CPU heap allocations. 2019-01-24 18:08:24 +01:00
Adam Sawicki
71f9b140f0 Improved VmaPoolAllocator to use larger and larger block sizes instead of constant size. 2019-01-24 17:43:07 +01:00
Adam Sawicki
5938c0e395 Minor refactoring in function VmaBlockMetadata_Generic::CreateAllocationRequest. 2019-01-24 17:30:36 +01:00
Adam Sawicki
5df580a997 Refactoring/optimization: Decreased size of VmaAllocation object by one pointer (from 72 to 64 bytes in 64-bit configurations) by removing VmaAllocation_T::BlockAllocation::m_hPool. 2019-01-24 17:21:27 +01:00
Adam Sawicki
70556b6754 VmaReplay: Added "device memory statistics" - count and total size of successfully allocated device memory blocks, total and per memory type. 2019-01-24 17:00:36 +01:00
Adam Sawicki
a1f727c9d0 Fixed compilation of Tests.cpp. 2019-01-24 16:25:11 +01:00
Adam Sawicki
4d844e2d29 Minor fixes in both the library and tests. 2019-01-24 16:21:05 +01:00
Adam Sawicki
4d35a5d663 Fixed bugs in VmaBlockMetadata_Linear::MakeAllocationsLost, VmaBlockVector::IsCorruptionDetectionEnabled. 2019-01-24 15:51:59 +01:00
Adam Sawicki
fd366b60b4 Minor fixes in tests. Found a bug. Minor refactoring - added VmaAllocationRequestType. Fixed minor bug in VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress. 2019-01-24 15:26:43 +01:00
Adam Sawicki
e99cb634a4 VmaBlockMetadata_Linear::CreateAllocationRequest: Fixed minor bug, did some refactoring. 2019-01-24 13:43:35 +01:00
Adam Sawicki
796cdc62f6 Updated documentation - added information about VK_AMD_memory_allocation_behavior extension.
Regenerated documentation, using new Doxygen version.
2019-01-15 11:45:58 +01:00
Adam Sawicki
ae5c4661ec Updated copyright headers after New Year. 2019-01-02 10:23:35 +01:00
Adam Sawicki
e5877a525b VmaReplay: Commented out new constants for compatibility with old Vulkan SDK used in CI. 2018-12-27 16:15:30 +01:00
Adam Sawicki
b0d922cfb0 VmaReplay: Extended by detailed statistics for parameters of structures like VmaAllocationCreateInfo, VkImageCreateInfo etc. 2018-12-27 15:48:52 +01:00
Adam Sawicki
8007f24376 Compiler compatibility fix for VMA_USE_STL_SHARED_MUTEX macro. Issue #52 thanks @jamesRumbleh ! 2018-12-21 13:26:55 +01:00
Adam Sawicki
7c09f1a831 Fixed major bug, made few smaller fixes and additions in documentation. 2018-12-14 11:37:02 +01:00
Adam Sawicki
663b0c9567 Minor fixes in documentation. 2018-12-13 12:15:01 +01:00
Adam Sawicki
bdb89a93eb Final fixes before v2.2.0 release. Minor fixes after tests. Rebuilt binaries and documentation again. 2018-12-13 11:56:30 +01:00
Adam Sawicki
1a8424f41a Preparations for v2.0.0 release. Updated version numbers. Rebuilt binaries and documentation. 2018-12-13 11:01:16 +01:00
Adam Sawicki
0f99b56168 Merge branch 'master' into v2.2
# Conflicts:
#	docs/html/vk__mem__alloc_8h_source.html
2018-12-13 10:48:38 +01:00
Adam Sawicki
dd48c3a8c4 Minor update in documentation. Regenerated Doxygen documentation. 2018-12-12 11:56:45 +01:00
Adam Sawicki
1db1f55db3 Fixes in documentation regarding sparse binding. 2018-12-11 14:54:03 +01:00
Adam Sawicki
2951ec1a60 Prepared CHANGELOG.md for version 2.0.0.
Minor fix in VmaReplay.
2018-12-10 15:32:37 +01:00
Adam Sawicki
71db590d7d Merge branch 'sparse_binding_example' into v2.2
# Conflicts:
#	docs/html/vk__mem__alloc_8h_source.html
#	src/Tests.cpp
#	src/VmaReplay/VmaReplay.cpp
#	src/VulkanSample.cpp
#	src/vk_mem_alloc.h
2018-12-10 14:45:56 +01:00
Adam Sawicki
5c8af7b8b2 Rebuilt binary and Doxygen documentation. 2018-12-10 13:34:54 +01:00
Adam Sawicki
58a9e406f1 VmaBlockVector::Defragment: Minor fix for case when VMA_DEBUG_DETECT_CORRUPTION != 0. 2018-12-10 13:32:55 +01:00
Adam Sawicki
e31dd15ff5 Improvement in function vmaDefragmentationBegin. Added validation of input arrays. 2018-12-10 13:15:43 +01:00
Adam Sawicki
a12a7fe43e Added support for functions vmaDefragmentationBegin, vmaDefragmentationEnd to recording file format and VmaReplay. 2018-12-10 12:36:42 +01:00
Adam Sawicki
920bfbe6f3 Bumped recording file format version to 1.5.
(Partial cherry pick from branch sparse_binding_example.)
2018-12-10 10:27:12 +01:00
Adam Sawicki
0d601d8789 Added documentation chapter "Writing custom defragmentation algorithm". 2018-12-07 23:09:46 +01:00
Adam Sawicki
638f42dd67 Rewritten documentation chapter about defragmentation. 2018-12-07 15:24:28 +01:00
Adam Sawicki
ae3970387e Added internal class VmaDefragmentationAlgorithm_Fast::FeeSpaceDatabase.
Defragmentation algorithm is pretty much finished now!
2018-12-06 18:06:08 +01:00
Adam Sawicki
2af57d7f47 Fixed bug in VmaBlockMetadata_Generic::IsBufferImageGranularityConflictPossible. Another minor fix. 2018-12-06 15:35:05 +01:00
Adam Sawicki
0eeed59309 Merge branch 'master' into allocation_defragmentation_strategies
# Conflicts:
#	docs/html/vk__mem__alloc_8h_source.html
2018-12-06 14:52:11 +01:00
Adam Sawicki
e8b01485ce Small change not to #include <vulkan/vulkan.h> if it was already included (possible from a different path) before including VMA. Issue #50 Thanks @baldurk ! 2018-12-06 14:47:59 +01:00
Adam Sawicki
2e900cae54 Added functions vmaAllocateMemoryPages, vmaFreeMemoryPages to VmaRecorder and VmaReplay. Bumped recording file format version to 1.5.
Support for sparse binding is now finished and ready!
2018-12-06 14:26:50 +01:00
Adam Sawicki
1ae513ae5c Sparse binding test: added textures with mip maps. 2018-12-06 12:49:52 +01:00
Adam Sawicki
4a2be4ee40 Minor tweak in sparse binding tests. 2018-12-06 12:44:49 +01:00
Adam Sawicki
da6c19423d Wrote test for sparse image binding with testing actual content - function BaseImage::TestContent. It uses vkCopyBufferToImage and then a compute shader to read back pixels of the image. 2018-12-05 17:34:34 +01:00
Adam Sawicki
978fcf54ab Testing environment: Added class StagingBufferCollection, functions UploadGpuData, ValidateGpuData, TestGpuData, in preparation for testing defragmentation of GPU memory.
# Conflicts:
#	src/Tests.cpp
#	src/VulkanSample.cpp
2018-12-05 14:38:48 +01:00
Adam Sawicki
6a6d8c6ea2 Merge branch 'master' into sparse_binding_example
# Conflicts:
#	docs/html/vk__mem__alloc_8h.html
#	docs/html/vk__mem__alloc_8h_source.html
#	src/Tests.cpp
#	src/VulkanSample.cpp
#	src/vk_mem_alloc.h
2018-12-05 13:20:32 +01:00
Adam Sawicki
647cf24b7f VmaDefragmentationAlgorithm_Fast: Added support for memmove() of overlapping memory regions when defragmenting on CPU. 2018-11-23 17:58:00 +01:00
Adam Sawicki
e168191f3d Added test for defragmentation of empty pool. 2018-11-23 17:50:12 +01:00
Adam Sawicki
9a4f508f88 Added VmaDefragmentationAlgorithm_Fast - fast path for defragmentation, a completely new algorithm. 2018-11-23 17:26:05 +01:00
Adam Sawicki
da85ec36bf Made VmaDefragmentationAlgorithm an abstract class and specific implementation as new class VmaDefragmentationAlgorithm_Generic, so user can easily plug his own defragmentation algorithms. 2018-11-22 17:32:44 +01:00
Adam Sawicki
fb00cc9ea8 Removed VMA_DEFRAGMENTATION_* flags. VmaDefragmentationInfo2::flags is now reserved for future use and should be 0. Research various options and chosen some parameters as default. 2018-11-22 17:10:07 +01:00
Adam Sawicki
434ac86781 Minor improvement in vmaDefragmentationBegin. 2018-11-22 16:20:49 +01:00
Adam Sawicki
52076ebf26 Added VmaDefragmentationInfo2::poolCount, pPools. Added test for it - TestDefragmentationWholePool. Removed VmaDefragmentationStats::allocationsLost. Optimized defragmentation algorithm. 2018-11-22 16:14:50 +01:00
Adam Sawicki
da5d248506 VmaReplay: Minor fix. 2018-11-20 15:10:16 +01:00
Adam Sawicki
3b392258e2 Documentation: Added mention of VK_AMD_memory_overallocation_behavior extension. 2018-11-20 11:33:07 +01:00
Adam Sawicki
df2404b6a5 VmaReplay: Added support for Windows end of lines. 2018-11-20 11:29:17 +01:00
Adam Sawicki
19875989e3 VmaReplay: Added support for Windows end of lines. 2018-11-19 16:27:51 +01:00
Adam Sawicki
8ec2ab69d6 VmaReplay: Added parameter --DefragmentatationFlags <Flags>. 2018-11-16 17:22:20 +01:00
Adam Sawicki
c6ede15fab Written test for various defragmentation algorithms, in TestDefragmentationGpu. 2018-11-16 17:04:14 +01:00
Adam Sawicki
5249980132 Implemeneted VMA_DEFRAGMENTATION_FAST_ALGORITHM_BIT, VMA_DEFRAGMENTATION_OPTIMAL_ALGORITHM_BIT. Not tested yet.
Added VMA_ALLOCATION_INTERNAL_STRATEGY_MIN_OFFSET.
2018-11-16 16:15:18 +01:00
Adam Sawicki
9948ca0ceb Removed VMA_DEFRAGMENTATION_CAN_MAKE_LOST_BIT. Not going to implement it for now... 2018-11-16 14:46:04 +01:00
Adam Sawicki
48a12aa835 Merge branch 'master' into allocation_defragmentation_strategies
# Conflicts:
#	docs/html/vk__mem__alloc_8h_source.html
#	src/Tests.cpp
#	src/vk_mem_alloc.h
2018-11-16 14:36:57 +01:00
Adam Sawicki
99f2d3543c Minor update in documentation. 2018-11-16 13:48:11 +01:00
Adam Sawicki
7f97202add Updated documentation of memory mapping with known bug in MoltenVK, based on #47. Thanks @DiegoAce ! 2018-11-16 13:43:34 +01:00
Adam Sawicki
b0c363693f Added function vmaResizeAllocation.
Added tests: function TestResize. Bumped CSV recording file format version to 1.4.
2018-11-13 16:17:38 +01:00
Adam Sawicki
1146b45c63 Fixed aligned_alloc for Android API < 16. Issue #49. Thanks @zhaijialong ! 2018-11-09 11:21:03 +01:00
Adam Sawicki
7a6e442b66 Fixes in documentation: "Features not supported". 2018-11-08 18:46:04 +01:00
Adam Sawicki
370ab184f8 Changed functions to validate and return VK_ERROR_VALIDATION_FAILED_EXT when trying to allocate memory of size 0, create buffer with size 0, or image with one of the dimensions 0.
That's because vkCreateBuffer returns VK_SUCCESS for buffer with size = 0, so VMA then proceeded to allocation of size 0, which is a critical error, checked by an assert, but apparently some users don't enable asserts in VMA.

Added tests: function TestInvalidAllocations.
2018-11-08 16:31:00 +01:00
Adam Sawicki
057040085c Tests 2018-11-08 16:07:29 +01:00
Adam Sawicki
87e466bad6 VmaReplay: Finished support for --DefragmentAfterLine parameter. Better statistics printed, now supporting defragmentation of GPU memory. Creating VkQueue, VkCommandPool, VkCommandBuffer. 2018-11-06 17:23:16 +01:00
Adam Sawicki
e97495dd73 VmaReplay: Added parameter --DefragmentAfterLine. 2018-11-06 16:42:23 +01:00
Adam Sawicki
dec65ac4eb Small addition to documentation. 2018-11-06 12:06:06 +01:00
Adam Sawicki
fa251ad7c8 Locked right mutexes during defragmentation. GPU memory defragmentation is now finished! 2018-10-18 15:22:40 +02:00
Adam Sawicki
440307e6bc Fixed TestDefragmentationGpu() - it was test that was buggy. Defragmentation of GPU memory is working!!! - a major milestone :D 2018-10-18 15:05:19 +02:00
Adam Sawicki
ff0f7b8254 Added TestDefragmentationGpu. Not passing - apparently there is some bug... 2018-10-18 14:44:05 +02:00
Adam Sawicki
76c5bcabfd Further refactoring of defragmentation, preparing for defragmentation of GPU memory. 2018-10-18 14:14:28 +02:00
Adam Sawicki
29b04041f7 Further refactoring of defragmentation classes. 2018-10-18 13:11:00 +02:00
Adam Sawicki
fc9db8dda7 Minor addition to documentation. #46 2018-10-18 12:03:50 +02:00
Adam Sawicki
2dcfcf8b63 More refactoring in preparation for GPU memory defragmentation. Created classes: VmaBlockDefragmentationContext, VmaBlockVectorDefragmentationContext. Class VmaDefragmentationContext_T is no longer empty. 2018-10-17 17:26:39 +02:00
Adam Sawicki
a9f030d7ba Further refactoring of defragmentation. 2018-10-17 15:20:36 +02:00
Adam Sawicki
a114419b23 Refactored defragmentation code. Removed class VmaDefragmentator. Renamed struct to VmaDefragmentationMove.
Minor fixes in documentation and comments.
2018-10-16 15:30:55 +02:00
Adam Sawicki
ef6cc40b59 Defragmentation: added support for memory that is HOST_VISIBLE but not HOST_COHERENT - calling Invalidate and Flush internally.
Fixed a bug in VmaDefragmentator::Defragment.
2018-10-16 14:20:47 +02:00
Adam Sawicki
f2975346ef Testing environment: Added class StagingBufferCollection, functions UploadGpuData, ValidateGpuData, TestGpuData, in preparation for testing defragmentation of GPU memory. 2018-10-16 13:49:02 +02:00
Adam Sawicki
fa87ae34a6 Small addition to documentation. 2018-10-15 18:15:11 +02:00
Adam Sawicki
6826f2d768 Small refactoring: Removed function VmaBlockVector::DestroyDefragmentator. 2018-10-10 16:49:36 +02:00
Adam Sawicki
f863a1dbd0 Used VMA_RW_MUTEX in 2 other places for optimization. 2018-10-10 16:43:44 +02:00
Adam Sawicki
de9181b2ba Added configuration macro VMA_USE_STL_SHARED_MUTEX.
Added internal class VmaRWMutex, macro VMA_RW_MUTEX, classes VmaMutexLockRead, VmaMutexLockWrite. Used it in VmaAllocator_T::m_PoolsMutex.
2018-10-10 16:26:26 +02:00
Adam Sawicki
b0d4afbeed Refactored defragmentation. Added class VmaDefragmentationAlgorithm, extracted from VmaDefragmentator. 2018-10-09 15:35:46 +02:00
Adam Sawicki
2aad902a66 Minor update in VmaDefragmentationInfo2. 2018-10-09 13:43:34 +02:00
Adam Sawicki
ad0989bfb4 Fixed bug in VmaAllocator_T::Defragment. 2018-10-09 13:26:33 +02:00
Adam Sawicki
012a4ac697 Designed and documented new interface for defragmentation.
Added: VmaDefragmentationContext, VmaDefragmentationFlagBits, VmaDefragmentationFlags, VmaDefragmentationInfo2, vmaDefragmentationBegin(), vmaDefragmentationEnd(). Extended VmaDefragmentationStats by allocationsLost. Deprecated VmaDefragmentationInfo2, vmaDefragment().
2018-10-09 13:25:01 +02:00
Adam Sawicki
b8d34d5e6a Replaced assert() with new macro TEST() in all tests, to check conditions also in Release configuration.
# Conflicts:
#	src/SparseBindingTest.cpp
#	src/Tests.cpp
#	src/VulkanSample.cpp
2018-10-03 17:41:20 +02:00