Commit Graph

665 Commits

Author SHA1 Message Date
Adam Sawicki
a1d992f5d1 Add function vmaGetAllocatorInfo, structure VmaAllocatorInfo
Closes #99

Also rebuilt Doxygen documentation.
2020-03-02 15:32:10 +01:00
Adam Sawicki
76004205fd Add documentation chapter about VK_AMD_device_coherent_memory extension usage
Regenerated Doxygen documentation.
2020-02-07 17:18:35 +01:00
Adam Sawicki
508825012c Add support for VK_AMD_device_coherent_memory extension
- Added VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT.
- Fixed bug generating validation layers error when the extension is not enabled.
- Updated date in copyright header comments to year 2020.
2020-02-07 16:51:31 +01:00
Adam Sawicki
82ec4439c7 Minor fix: Use std::forward with parameter pack 2020-01-31 11:32:51 +01:00
Adam Sawicki
aaba2109f9 Refactoring: Use constructor and destructor in VmaAllocation_T
VmaPoolAllocator supports that. Needed to only use parameter pack to pass arguments to constructor.
2020-01-31 11:19:32 +01:00
Adam Sawicki
cdd30bb46d Prepare to support Vulkan 1.2
No way to test for now because no Vulkan SDK available.
2020-01-20 17:19:41 +01:00
Sidney Just
f91dd04a1e Fixed incorrect for loop in ProcessDefragmetnations() that would lead to partial defragmentation passes being broken 2020-01-12 15:51:33 -08:00
Lava Block
361fcfcae4
Fix C++17 shared_mutex compile error
In C++17 the method is called: https://en.cppreference.com/w/cpp/thread/shared_mutex/try_lock_shared
2019-12-29 17:12:36 +01:00
Adam Sawicki
c467e28f2f Renames in the library and fixes in tests for the new defragmentation 2019-12-23 16:38:31 +01:00
Adam Sawicki
a52012de37 Prototype of a defragmentation interface that supports tiling optimal images
Merged #90 thanks @JustSid !
2019-12-23 15:28:51 +01:00
Adam Sawicki
c8eec757fd Minor addition to the documentation regarding allocation string names 2019-12-18 13:37:38 +01:00
Adam Sawicki
7f708dbd44 Use NDEBUG instead of _DEBUG macro to detect debug build
Closes #92 thanks @daemyung !
2019-12-18 10:54:28 +01:00
Adam Sawicki
e9bfb539d8 Publish version 2.3.0 final
Updated version number. Regenerated Release binaries and Doxygen documentation.
2019-12-04 14:26:59 +01:00
Adam Sawicki
7d6544dc73 Merge branch 'master' of https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator 2019-12-02 13:42:35 +01:00
Adam Sawicki
cd7bc20429 Clarify documentation in regards to cache flush/invalidate in few places
See #91, thanks @ROTARTSI82 !
2019-12-02 13:42:25 +01:00
Adam Sawicki
5f94eae63d Fix bug in VmaAllocator_T::AllocateVulkanMemory for case when HeapSizeLimit is used
Closes #89 - thanks @JustSid !
2019-11-28 11:52:30 +01:00
Adam Sawicki
023976ad24 Minor fix: Add missing mutex lock to VmaBlockVector::IsEmpty 2019-11-26 11:48:06 +01:00
Adam Sawicki
4670506a22 Announce version 2.3.0-alpha.1 2019-11-25 12:46:57 +01:00
Adam Sawicki
1296e2db4d VmaReplay: Switch to Vulkan 1.1
Recording file format version bumped to 1.8 to support "VulkanApiVersion".
VmaReplay now uses Vulkan 1.1 by default and so it removes parameter --VK_KHR_dedicated_allocation.
2019-11-25 11:13:53 +01:00
Adam Sawicki
10f68cb139 Vulkan 1.1 suport - prototype 2019-11-22 17:41:59 +01:00
Adam Sawicki
4d700c5e4e Sample app: remove outdated comment
https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/579 is now fixed so RenderDoc works with the sample app also when it uses VK_KHR_dedicated_allocation when latest Vulkan SDK is used.
2019-11-22 15:35:27 +01:00
Adam Sawicki
7ba02ec56e Minor improvement 2019-11-22 15:28:06 +01:00
Adam Sawicki
ddcbf8cdba Fix management of m_HasEmptyBlock by adding VmaBlockVector::UpdateHasEmptyBlock().
Also added TestPool_MinBlockCount().
2019-11-22 15:22:42 +01:00
Adam Sawicki
69185555f4 Add VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED
Closes #84
2019-11-18 17:03:34 +01:00
Adam Sawicki
efa88c4de0 Add VMA_MEMORY_USAGE_CPU_COPY for memory that is preferably not DEVICE_LOCAL but not guaranteed to be HOST_VISIBLE
Also added test for memory types and usages.
2019-11-18 16:33:56 +01:00
Adam Sawicki
a900b56aed
Merge pull request #87 from Nyufu/clang_cl_support
Added clang compile support on windows
2019-11-18 15:18:45 +01:00
Andras Nyiscsak
641a16cc9c Added clang compile support on windows 2019-11-18 15:09:34 +01:00
Adam Sawicki
4ac8ff89c2 Multiple fixes in budget management
Including correct handling of lost allocation.
2019-11-18 14:47:33 +01:00
Adam Sawicki
a63e37c656 Add support for memory budget to record&replay system 2019-11-18 13:40:03 +01:00
Adam Sawicki
b68b368c67 Merge branch 'master' into MemoryBudget 2019-11-18 13:15:18 +01:00
Adam Sawicki
8317ba9d5e Sample/testing app: enable custom CPU allocation callbacks by default
Added allocation counting to make sure there are no memory leaks at the end.
2019-11-18 13:14:11 +01:00
Adam Sawicki
b3f5110987 Fix TestHeapSizeLimit to work on Radeon R7 APU with 256 MB of DEVICE_LOCAL memory 2019-11-18 13:05:56 +01:00
Adam Sawicki
ba2bdea58e Remove redundant variable VmaBlockVector::m_IsCustomPool 2019-11-18 12:42:32 +01:00
Adam Sawicki
bc266d6f09 Update Doxyfile to latest Doxygen version 2019-11-18 12:38:51 +01:00
Adam Sawicki
aeb9836f4c Finish implementation of vmaSetPoolName, vmaGetPoolName
vmaSetPoolName was added to recording format. Recording format version was bumped to 1.7. #82
2019-11-18 12:34:54 +01:00
Adam Sawicki
49defd6056 Further development of custom pool names 2019-11-18 11:45:30 +01:00
Adam Sawicki
b85ff83bf3 Add budget information to JSON dump
Doesn't require detailedMap=VK_TRUE.
2019-11-15 17:47:16 +01:00
Adam Sawicki
4f900cd1b3 Delete empty block unconditionally if budget is exceeded.
Also fixed crash when freeing lost allocation.
2019-11-13 15:20:31 +01:00
Adam Sawicki
e6e3329a58 Doxyfile: expand VMA_CALL_PRE and VMA_CALL_POST macros to remove them from documentation 2019-11-13 14:51:01 +01:00
Adam Sawicki
48b8a33869 Fixes and adjustments for budget, regenerate documentation 2019-11-02 15:24:33 +01:00
Adam Sawicki
27c84e2464 Merge remote-tracking branch 'origin/MemoryBudget' into MemoryBudget
# Conflicts:
#	src/vk_mem_alloc.h
2019-11-02 15:16:00 +01:00
Adam Sawicki
a020fb81cb Add prototype function vmaGetName, vmaSetName, change JSON format and VmaDumpVis.py to use that 2019-11-02 14:43:06 +01:00
Adam Sawicki
353e3675d3 Further development of budget management 2019-11-02 14:12:05 +01:00
Adam Sawicki
bc95d25c7f Add draft of general documentation chapter about memory budget
Work in progress...
2019-10-31 16:03:25 +01:00
Adam Sawicki
5f573f588a Minor addition 2019-10-11 15:59:58 +02:00
Adam Sawicki
40ffe988a0 Add struct VmaBudget, function vmaGetBudget
Changed the way HeapSizeLimit is handled to better one.
Added VMA_ATOMIC_UINT64.
2019-10-11 15:56:02 +02:00
Adam Sawicki
6ac1d3a4b7 Improve implementation of function VmaStringBuilder::AddNumber 2019-10-11 12:23:51 +02:00
Adam Sawicki
909f36b714 Fix for aligned_alloc for Windows GCC
As discussed in ff9ac65fe2
2019-09-16 11:28:24 +02:00
Adam Sawicki
bbdcdae100
Merge pull request #75 from dreamer/steam-runtime-compilation-error
Use fallback aligned_alloc for pre-C++17 glibc++
2019-09-06 14:52:30 +02:00
Adam Sawicki
5c2c7f3e7a Add macros VMA_CALL_PRE, VMA_CALL_POST to easily declare public functions as exported
Fixes #76
2019-09-06 14:46:48 +02:00
Patryk Obara
ff9ac65fe2 Use fallback aligned_alloc for older glibc++
This function was introduced in C++17, then backported to older versions
of glibc++ library, but is not available in older releases (it's missing
from Ubuntu 12.04 derived SteamRT for example).
2019-08-15 13:23:13 +02:00
Adam Sawicki
188a365ed4 Fix ignore warning C4324 also in VmaReplay project
See #71
2019-07-26 15:22:51 +02:00
Adam Sawicki
91d019523f Add comment to the new VmaVector constructor
See #74
2019-07-26 15:16:04 +02:00
Adam Sawicki
b3687caab2
Merge pull request #74 from benvanik/patch-1
Adding a VmaVector constructor for C++11 compatibility
2019-07-26 15:14:27 +02:00
Adam Sawicki
5afe7845a1 Fix alignment of VmaPoolAllocator::Item::Value
Disable Visual Studio warning C4324.

See #71
2019-07-26 15:09:07 +02:00
Ben Vanik
fd5077cd36
Adding a VmaVector constructor for C++11 compatibility
The std::vector constructor used (count + allocator) is only available in C++14 (see: https://en.cppreference.com/w/cpp/container/vector/vector) and compiling with C++11 and `VMA_USE_STL_VECTOR` will result in compile errors. This adds a new constructor and switches to using that for compatibility.
2019-07-25 09:32:16 -07:00
Adam Sawicki
c7e5f2e44a Change VmaPoolAllocator to allow not-POD T type, explicitly call its constructor and destructor
See #71
2019-07-25 17:23:51 +02:00
Adam Sawicki
692ccba14d Initialize structure VmaAllocator_T::m_VulkanFunctions to zeros in constructor to avoid garbage pointers
Fixes #73
2019-07-25 17:14:02 +02:00
Adam Sawicki
195016b034 Improve the way sizes like "32 MiB" are printed in VmaDumpVis
Also bumped some version numbers and dates.
2019-07-02 15:49:12 +02:00
Adam Sawicki
2024cc570a Change default value of macro VMA_RECORDING_ENABLED to 0
...so that Windows.h is not included by default on Windows.
2019-07-02 15:19:05 +02:00
Adam Sawicki
4abe30c1ae Add functions vmaBindBufferMemory2, vmaBindImageMemory2, flag VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT
This change adds usage of VK_KHR_bind_memory2 extension.
Also add structure members VmaVulkanFunctions::vkBindBufferMemory2KHR, vkBindImageMemory2KHR.
2019-07-02 14:37:21 +02:00
Adam Sawicki
1f84f62a85 Fix sample application to also pass VkAllocationCallbacks to Vulkan, not only to VMA
Also remove function TestResize, no longer working or needed.
2019-07-02 13:40:01 +02:00
Adam Sawicki
17c4aba057 vmaFindMemoryTypeIndex: Change VMA_MEMORY_USAGE_GPU_TO_CPU to only have HOST_CACHED among preferred flags, not HOST_COHERENT
Be careful now! It's still compliant to the documentation, but  selected memory type may become not HOST_COHERENT after this change. No difference is expected on PC. It's mostly for Mali GPU.
2019-07-02 13:03:55 +02:00
Adam Sawicki
4a4cfad2eb Make vmaResizeAllocation deprecated, always return failure unless newSize == current size
Bump CSV file format version to 1,6.
2019-07-02 12:54:35 +02:00
Adam Sawicki
543ba5baec Minor fix in documentation regarding CSV recording 2019-07-02 12:37:36 +02:00
Adam Sawicki
af88c1bde1 Fix tests and documentation to use vmaBind* instead of vkBind* functions after defragmentation 2019-07-02 12:34:26 +02:00
Adam Sawicki
87cea36670 Add "Common mistakes" documentation chapter 2019-07-02 12:24:48 +02:00
Adam Sawicki
938b19a8c1 Minor addition in documentation, "Configuration” section
See #67
2019-07-01 12:12:51 +02:00
Adam Sawicki
c238be5070 Additional fix as suggested in #69 2019-06-28 17:31:21 +02:00
Adam Sawicki
77fa9dc840
Merge pull request #69 from past-due/Wtautological_compare
Guard VmaWriteMagicValue / VmaValidateMagicValue on VMA_DEBUG_MARGIN > 0
2019-06-28 17:29:50 +02:00
Adam Sawicki
f8d10218ff Fix structure VmaBlockDefragmentationContext
Fixes #70
2019-06-28 17:12:36 +02:00
Adam Sawicki
9b1e702e0b Remove unused variable
Fixes #67
2019-06-28 17:01:50 +02:00
Adam Sawicki
294a0ad239 Remove unused variable VmaBlockVectorDefragmentationContext::m_AlgorithmFlags
Fixes #65
2019-06-28 16:53:32 +02:00
Adam Sawicki
34045555a6 Minor fix in documentation 2019-06-26 14:46:53 +02:00
past-due
0021c38ac8 Guard VmaWriteMagicValue / VmaValidateMagicValue on VMA_DEBUG_MARGIN > 0
Avoids some compiler warnings in the default case (VMA_DEBUG_MARGIN == 0)
2019-06-25 12:59:24 -04:00
Adam Sawicki
daa6a551f8 Fix VmaAllocator_T::AllocateMemory for case when VMA_ALLOCATION_CREATE_MAPPED_BIT is used with custom memory pool created in memory type that is not VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
Also add test for it - function TestDeviceLocalMapped.
2019-06-25 15:26:37 +02:00
Adam Sawicki
6da74efe0d Merge remote-tracking branch 'origin/master' 2019-06-03 10:58:38 +02:00
Adam Sawicki
8d6e6dea2d Minor refactoring 2019-06-03 10:57:56 +02:00
Zachary Michaels
12f110c96b Use VK_NULL_HANDLE for VkBuffer init (not VMA_NULL) 2019-05-31 19:35:59 -07:00
Chris de Jong-Pobedinskiy
a2eadcf82d Fixed an issue with STL_CONTAINER compilation.
Fixed an issue where defining the VMA_USE_STL_CONTAINERS
macro would prevent VMA from compiling. This was caused by calling a
VMA-container-specific function instead of the macro meant for
abstracting away the differences.
2019-05-05 19:30:39 +02:00
Adam Sawicki
ca9f16d517 Minor addition in documentation 2019-04-23 14:00:28 +02:00
Adam Sawicki
4fb254e362 Clarify comment about compatibility with RenderDoc 2019-04-23 11:29:57 +02:00
Adam Sawicki
d53dc4b211 Revert "change documentation to allow defragmentation of only buffers not images"
This reverts commit c9f948243c.
Fixes #59
2019-04-18 13:27:43 +02:00
Adam Sawicki
94ce3d7da2 Update premake5 to latest version; rebuild binaries using Visual Studio 2019
Fix missing include in Tests.cpp.
2019-04-17 14:59:25 +02:00
Adam Sawicki
c9f948243c change documentation to allow defragmentation of only buffers not images
#59
2019-04-17 13:33:27 +02:00
Adam Sawicki
bb18b299dc fix GPU memory defragmentation to restrict supported memory types
Defragmentation of GPU memory is restricted to those memory types that support creating buffer used for transfers. #59
2019-04-17 12:31:40 +02:00
Adam Sawicki
672f7c8e94 clarify documentation regarding limitations of defragmentation
#59
2019-04-17 11:53:02 +02:00
Adam Sawicki
f48896d164 add a comment explaining how to make the sample app not crashing with RenderDoc 2019-04-16 12:55:35 +02:00
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
Adam Sawicki
1f7f8afdd7 Fixed tests for NVIDIA, where it asserted with OUT_OF_MEMORY, probably due to higher alignment requirements. 2018-10-03 17:37:55 +02:00
Adam Sawicki
a7d7769959 Replaced assert() with new macro TEST() in all tests, to check conditions also in Release configuration. 2018-10-03 16:15:27 +02:00
Adam Sawicki
4868c1f523 Fixed tests for NVIDIA, where it asserted with OUT_OF_MEMORY, probably due to higher alignment requirements. 2018-10-03 15:57:11 +02:00
Adam Sawicki
2e4d3eff98 Added BasicTestAllocatePages() - test for vmaAllocateMemoryPages, vmaFreeMemoryPages. 2018-10-03 15:48:17 +02:00
Adam Sawicki
d062b784d3 Added functions: vmaAllocateMemoryPages, vmaFreeMemoryPages to create and destroy multiple allocations at once. 2018-10-03 15:26:22 +02:00
Adam Sawicki
51fa96660e Wrote basic test for sparse binding. 2018-10-03 13:44:29 +02:00
Adam Sawicki
7ce9630bbf Improved documentation chapters: Defragmentation, vmaDefragment(), Features not supported. 2018-09-28 14:51:09 +02:00
Adam Sawicki
6aa6255741 Fixing macro VMA_VALIDATE for Linux compilation. 2018-09-24 15:16:47 +02:00
Adam Sawicki
02246f3eb8 CHANGING BRANCHING STRATEGY! No more "development" branch, now in-progress development will happen on "master".
Bumped version number to "development".
2018-09-24 15:10:06 +02:00
Adam Sawicki
3951aa5bc3 Merge branch 'allocation_defragmentation_strategies' into development
# Conflicts:
#	docs/html/search/all_f.js
#	docs/html/vk__mem__alloc_8h.html
#	docs/html/vk__mem__alloc_8h_source.html
#	src/vk_mem_alloc.h
2018-09-21 16:48:42 +02:00
Adam Sawicki
c6432d1d45 Buddy allocation algorithm finished and documented! 2018-09-21 16:44:16 +02:00
Adam Sawicki
0591535eb1 VmaBlockMetadata_Buddy: Fixed allocation of Node objects to use provided CPU allocation callbacks. 2018-09-21 15:23:32 +02:00
Adam Sawicki
1e8cf94558 VmaBlockMetadata_Buddy: Added (simple way of) respecting bufferImageGranularity.
Minor fixes in documentation.
2018-09-21 15:10:04 +02:00
Adam Sawicki
9933c5cadf VmaBlockMetadata_Buddy: Added respecting of allocation alignment. 2018-09-21 14:57:24 +02:00
Adam Sawicki
a01d4587df VmaBlockMetadata_Buddy: Introduced m_LevelCount to limit number of levels in use by particular memory block, considering new constant MIN_NODE_SIZE. 2018-09-21 14:22:35 +02:00
Adam Sawicki
d6e6d6bdf2 VmaBlockMetadata_Buddy: Introduced concept of m_UsableSize to always use powers of two even when memory block size is not. 2018-09-21 14:07:02 +02:00
Adam Sawicki
a79d2746f1 Added dummy implementation of VmaBlockMetadata_Buddy methods related to lost allocations. Lost allocations are not supported in buddy algorithm for now. 2018-09-21 13:26:12 +02:00
Adam Sawicki
14d9e1a938 Minor optimization: Skip call to vkUnmapMemory before vkFreeMemory for dedicated allocations, which is allowed by the spec. 2018-09-17 17:06:42 +02:00
Adam Sawicki
1e425dda03 Added #ifdef NOMINMAX. Thanks Krzysztof Kondrak ! 2018-09-10 16:52:13 +02:00
Adam Sawicki
c77a123a89 Fixed #include <windows.h> for compilation under Windows mingw64. Issue #41 thanks @turol ! 2018-09-10 14:43:04 +02:00
Adam Sawicki
df1b88d387 Fixed formatting string in call to fprintf in VmaRecorder::RecordCreatePool. Issue #40 thanks @baldurk ! 2018-09-10 14:39:45 +02:00
Adam Sawicki
f305aebdfd Fixed version number in source file. 2018-09-10 14:07:32 +02:00
Adam Sawicki
f7baf623d0 Minor updates in documentation. Added VK9 to list of known usages. Issue #39 thanks @disks86 ! 2018-09-10 11:09:03 +02:00
Adam Sawicki
0dbbaad040 Minor additions, including function VmaPrevPow2. 2018-09-07 17:43:40 +02:00
Adam Sawicki
8092715d2c VmaBlockMetadata_Buddy: Fixed reporting of space wasted due to internal fragmentation as unused blocks. Added test for multi-block pool with buddy algorithm. 2018-09-07 17:27:23 +02:00
Adam Sawicki
21017c6cbe Implemented VmaBlockMetadata_Linear::AddPoolStats. 2018-09-07 15:26:59 +02:00
Adam Sawicki
6540b19ed5 Implemented VmaBlockMetadata_Buddy::GetUnusedRangeSizeMax(). 2018-09-07 15:09:41 +02:00
Adam Sawicki
a7863d9664 Implemented VmaBlockMetadata_Buddy::GetSumFreeSize. 2018-09-07 15:05:02 +02:00
Adam Sawicki
8796504f62 Added macro VMA_VALIDATE to simplify validation methods. Implemented proper calculation of VmaBlockMetadata_Buddy::GetAllocationCount. 2018-09-07 15:00:13 +02:00
Adam Sawicki
4338f6667d Added internal function VmaIsPow2 and asserts checking if various alignment parameters are power of 2. 2018-09-07 14:12:37 +02:00
Adam Sawicki
6689924517 Further fixes for compilation on Windows. Defined NOMINMAX for Windows.h. Issue #38 2018-09-07 12:40:31 +02:00
Adam Sawicki
a70e05dbc5 . 2018-09-07 12:36:38 +02:00
Adam Sawicki
24c4f45abf Changed VmaBlockMetadata_Buddy::m_FreeList into a doubly linked list. Implemented merging of free blocks. Buddy allocation algorithm now works. 2018-09-06 17:39:11 +02:00
Adam Sawicki
bf1a931a2d Next small step: moved split logic from VmaBlockMetadata_Buddy::CreateAllocationRequest to VmaBlockMetadata_Buddy::Alloc. 2018-09-06 17:04:32 +02:00
Adam Sawicki
447e36fe9a Fixed missing #include <Windows.h> for cases when it's needed but macro VK_USE_PLATFORM_WIN32_KHR is not defined. Issue #38 thanks @farnoy ! 2018-09-06 11:38:37 +02:00
Adam Sawicki
a83793a63e Buddy allocator - more coding. 2018-09-03 13:40:42 +02:00
Adam Sawicki
abf747a79f Removed hack for clang compiler error. It didn't work anyway. 2018-09-03 11:48:40 +02:00
Adam Sawicki
655b87fd87 Small addition to documentation. 2018-08-28 14:32:15 +02:00
Adam Sawicki
c4227e5acf Fixes warning: field 'm_Blocks' will be initialized after field 'm_HasEmptyBlock' [-Wreorder] #37 Thanks @TheLavaBlock ! 2018-08-28 13:12:14 +02:00
Adam Sawicki
6d9d718343 TEMP started coding buddy algorithm. 2018-08-28 13:09:27 +02:00
Adam Sawicki
0a3fb6ca60 Tests: benchmark of linear allocator now compares to various allocation strategies. 2018-08-27 14:40:27 +02:00
Adam Sawicki
33d2ce744b Added writing results of linear allocator benchmark to file "LinearAllocator.csv". 2018-08-27 13:59:13 +02:00
Adam Sawicki
740b08f6eb Testing environment: Improved formatting of CSV faile with results of main benchmark. 2018-08-27 13:42:07 +02:00
Adam Sawicki
1d2d627146 Merge branch 'master' into allocation_defragmentation_strategies 2018-08-27 13:20:43 +02:00
Adam Sawicki
c7d1b584b7 Fixes for compilation under Linux gcc and clang. #2 2018-08-27 12:30:53 +02:00
Adam Sawicki
6277abb3c4 Fixes for compilation under Linux gcc and clang. 2018-08-27 12:21:35 +02:00
Adam Sawicki
c5b223fe4b VmaAllocator_T::FreeMemory: Fixed synchronization bug for cases when an allocation becomes lost at the same time as it is being freed. 2018-08-27 11:53:02 +02:00
Adam Sawicki
751f1460d5 Updated date next to version number. 2018-08-27 11:03:21 +02:00
Adam Sawicki
7ec3930906 Documentation "Introduction" - added paragraph about macros define before including headers. Issue #36 Thanks @chaoticbob ! 2018-08-27 11:00:06 +02:00
Adam Sawicki
0667e33bdd Added allocation strategy to main benchmark. 2018-08-24 17:26:44 +02:00
Adam Sawicki
1852036194 Added VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT, WORST_FIT, FIRST_FIT, and aliases: VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT, MIN_TIME, MIN_FRAGMENTATION.
Deleted VMA_BEST_FIT macro.
2018-08-24 16:28:28 +02:00
Adam Sawicki
70a683e53f Added support for multiple Vulkan memory blocks in custom pools with VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT. Works with free-at-once and stack, doesn't work with double stack or ring buffer.
Added new structure members VmaPoolStats::blockCount.
2018-08-24 15:36:32 +02:00
Adam Sawicki
90eb51c225 Changed behavior of custom pools: VmaPoolCreateInfo::blockSize 0 (default) now means that pool may use variable block sizes, just like default pools do. 2018-08-24 13:43:52 +02:00
Adam Sawicki
f9b6868cf1 Described version 2.1.0-beta.1 in CHANGELOG.md.
Minor fixes in documentation.
2018-08-24 12:13:37 +02:00
Adam Sawicki
4c6e9e81bc Linear allocation algorithm is finished! Recompiled binaries, regenerated Doxygen documentation. Announcing version 2.1.0-beta.1. 2018-08-24 11:23:37 +02:00
Adam Sawicki
0a60713b07 Added benchmark for linear allocator. 2018-08-24 11:18:41 +02:00
Adam Sawicki
dedab850e9 Documented linear allocation algorithm. Added "Linear allocation algorithm" documentation chapter. 2018-08-23 15:00:58 +02:00
Adam Sawicki
cba11e8bfb Deleted temporary code. 2018-08-23 13:21:15 +02:00
Adam Sawicki
477b22ebf1 Added 'LinearAlgorithm' member to JSON dump format and its usage in VmaDumpVis.py. 2018-08-23 13:20:22 +02:00
Adam Sawicki
35e9aca80f Minor refactoring. 2018-08-23 13:05:05 +02:00
Adam Sawicki
d0100e9d1a Ensured that allocations from pools with linear algorithm are ignored in vmaDefragment.
Made vmaDefragment work only with memory types that are HOST_VISIBLE and HOST_COHERENT.
2018-08-23 12:56:58 +02:00
Adam Sawicki
0270b98d2f Optimized VmaBlockMetadata_Linear::FreeAtOffset to use binary search.
Refactored VmaBinaryFindFirstNotLess.
2018-08-23 12:18:01 +02:00