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
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
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
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
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
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
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
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
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
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
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
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
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
3b392258e2
Documentation: Added mention of VK_AMD_memory_overallocation_behavior extension.
2018-11-20 11:33:07 +01:00
Adam Sawicki
8ec2ab69d6
VmaReplay: Added parameter --DefragmentatationFlags <Flags>.
2018-11-16 17:22:20 +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
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
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