Commit Graph

650 Commits

Author SHA1 Message Date
Adam Sawicki
58face4cff Changed macro in defragmentation test to more readable lambda.
Code by @medranSolus
2022-03-14 14:21:59 +01:00
Adam Sawicki
31910c8b08 Fix in defragmentation versus mapping
by @medranSolus

Added TestDefragmentationVsMapping.
2022-03-09 13:24:06 +01:00
Adam Sawicki
7d182e2c5a Change in the defragmentation API. Compatibility breaking!
Removed VmaDefragmentationMove::dstMemory, dstOffset, internalData, added dstTmpAllocation.
Code by @medranSolus
2022-03-07 17:00:12 +01:00
Adam Sawicki
f828262f43 Changed vmaEndDefragmentation to return void (somewhat compatibility breaking)
It couldn't fail anyway.
2022-03-04 14:24:29 +01:00
Adam Sawicki
caf27e0428 Made allocation Name and UserData separate. COMPATIBILITY BREAKING!
Added function vmaSetAllocationName. Added member VmaAllocationInfo::pName.
VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is now deprecated but still works.

Code mostly by @medranSolus
2022-03-03 11:23:14 +01:00
Adam Sawicki
bd39bed5e6 Fixes in defragmentation
Implemented VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT. Fixed allocation mapping after defragmentation.
Also fixed tests - hopefully fixes #248
Code by @medranSolus
2022-03-02 16:10:41 +01:00
Adam Sawicki
01364c7970 Added documentation chapter "VK_EXT_memory_priority"
Other fixes in documentation
2022-02-28 12:10:18 +01:00
Adam Sawicki
6a63f2cb4e Fixed incorrect accounting of memory budget.
Code by @medranSolus
Fixes #241
2022-02-23 13:44:51 +01:00
Adam Sawicki
88510e9801 New API for defragmentation. COMPATIBILITY BREAKING!
See structure VmaDefragmentationInfo, VmaDefragmentationMove, VmaDefragmentationPassMoveInfo, VmaDefragmentationStats, function vmaBeginDefragmentation, vmaEndDefragmentation, vmaBeginDefragmentationPass, vmaEndDefragmentationPass.

Switched to TLSF as the default algorithm - in default pools, custom pools, virtual blocks. Removed generic and buddy algorithm. Removed flags: VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT, VMA_POOL_CREATE_TLSF_ALGORITHM_BIT, VMA_VIRTUAL_BLOCK_CREATE_BUDDY_ALGORITHM_BIT, VMA_VIRTUAL_BLOCK_CREATE_TLSF_ALGORITHM_BIT.

Updated and regenerated documentation.
2022-02-22 23:38:19 +01:00
Adam Sawicki
226bd5a6ad New API for statistics. COMPATIBILITY BREAKING!
New structure VmaStatistics, VmaDetailedStatistics, VmaTotalStatistics. Modified structure VmaBudget.
New function vmaCalculateStatistics, vmaGetPoolStatistics, vmaCalculatePoolStatistics, vmaGetVirtualBlockStatistics, vmaCalculateVirtualBlockStatistics. vmaGetHeapBudgets function unchanged.

Updated and rebuilt the docs.
2022-02-22 15:19:35 +01:00
Adam Sawicki
d00699f26d Another fix in TestLinearAllocator
Closes #239
2022-02-18 11:46:15 +01:00
Adam Sawicki
e0fcd7344e Fixed VulkanUsage::Init for Vulkan SDK not supporting new Vulkan 1.3, to fix CI builds 2022-02-17 14:48:54 +01:00
Adam Sawicki
aee61b1d25 Added new API for selecting preferred memory type: VMA_MEMORY_USAGE_AUTO, VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, VMA_MEMORY_USAGE_AUTO_PREFER_HOST, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT
Old values like VMA_MEMORY_USAGE_GPU_ONLY still work as before, for backward compatibility.
Updated documentation accordingly.

Introduced a concept of mappable and non-mappable allocations - with VMA_MEMORY_USAGE_AUTO* an intent to map has to be specified using VMA_ALLOCATION_CREATE_HOST_ACCESS*.

Added mapping hysteresis logic (internal class VmaMappingHysteresis, config macro VMA_MAPPING_HYSTERESIS_ENABLED) that prevents too many calls vkMapMemory/vkUnmapMemory back and forth.

Internal improvement in VmaBlockVector::AllocatePage to try to keep mappable and non-mappable allocations separate.
2022-02-17 14:44:06 +01:00
Adam Sawicki
c6a338ba88 Fix in TestLinearAllocator for Intel(R) HD Graphics 630
See #239
2022-02-17 11:02:45 +01:00
Adam Sawicki
fd82bc7b6d Fixed few bugs in tests
Fixes #234 - thanks @mkx171217
2022-02-11 11:42:17 +01:00
Adam Sawicki
37c2d74b05 Fixes in test TestVirtualBlocksAlgorithmsBenchmark 2022-02-08 15:38:13 +01:00
Adam Sawicki
15206baf40 Added some new tests: TestAllocationAlgorithmsCorrectness 2022-02-08 15:04:08 +01:00
Adam Sawicki
bb29254253 Fix for VmaBitScan functions in GCC and Clang. Fixed debug margin for generic algorithm.
Hopefully helps for #231.
Code by @medranSolus
2022-02-08 10:50:10 +01:00
Adam Sawicki
fd4ee1d5aa Fixed vmaVirtualFree legal to call with allocation == VK_NULL_HANDLE
Hopefully fixes #230
Fixes in internal validation.
Rebuilt the docs.
2022-02-04 14:32:45 +01:00
Adam Sawicki
22485a05f9 Improved behavior of vmaVirtualAllocate on failed allocation. Fixed VmaVirtualAllocation to distinguish VK_NULL_HANDLE from successful allocation.
Improved tests.
Rebult the docs.
2022-02-04 11:39:56 +01:00
Adam Sawicki
ab16036dd5 Updated tests and documentation for VMA_DEBUG_MARGIN
Fixed type of VmaVirtualBlockCreateInfo::flags.
Rebuilt the docs.
2022-02-01 17:57:17 +01:00
Adam Sawicki
48d3cc46a0 Minor fixes after merging #226 2022-01-31 17:20:29 +01:00
Adam Sawicki
08759cbec5 Changed value of VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT / VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT.
Added support for VMA_DEBUG_MARGIN in TLSF algorithm.
Changed behavior of VMA_DEBUG_MARGIN to be included only after not before every allocation.
Bug fixes and improvements in TLSF algorithm.
Added benchmark for virtual allocator.

Code by @medranSolus
2022-01-28 13:07:58 +01:00
Adam Sawicki
ed83ac24d2 Changes in ALLOCATION_CREATE_STRATEGY flags. COMPATIBILITY BREAKING!
Removed flags: VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT, VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT, VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT.
Regenerated documentation.
2022-01-26 17:47:11 +01:00
Adam Sawicki
6c1c16f05c Misc minor fixes 2022-01-26 17:46:38 +01:00
Adam Sawicki
f451b94158 Fixed vmaBuildVirtualBlockStatsString, vmaFreeVirtualBlockStatsString to also be inside #if VMA_STATS_STRING_ENABLED
Updated copyright headers for to year 2022.

Change by @medranSolus
2022-01-21 12:56:18 +01:00
Adam Sawicki
d3a85f0dc3 Refactored virtual allocator. (COMPATIBILITY BREAKING!) Added TLSF algoritym.
Refactored virtual allocator: Added type VmaVirtualAllocation, member VmaVirtualAllocationInfo::offset, changed parameters of vmaVirtualAllocate, vmaVirtualFree, vmaSetVirtualAllocationUserData, vmaGetVirtualAllocationInfo.

Added TLSF algorithm: Added VMA_POOL_CREATE_TLSF_ALGORITHM_BIT, VMA_VIRTUAL_BLOCK_CREATE_TLSF_ALGORITHM_BIT.

Some internal refactoring.

Improved documentation: Grouped API elements into Doxygen modules.

Code mostly by @medranSolus.
2022-01-20 17:00:33 +01:00
Adam Sawicki
a8581fc96c Deleted the whole Record&Replay feature. COMPATIBILITY BREAKING!
Removed from the API: VmaAllocatorCreateInfo::pRecordSettings, VmaRecordSettings, VmaRecordFlagBits, VmaRecordFlags.
Regenerated documentation. Updated README.
2022-01-10 18:11:09 +01:00
Adam Sawicki
1e97603ab8 Deleted the whole feature of lost allocations. COMPATIBILITY BREAKING!
Removed from the interface: VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT, VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT, vmaCreateLostAllocation, vmaMakePoolAllocationsLost, vmaTouchAllocation, VmaAllocatorCreateInfo::frameInUseCount, VmaPoolCreateInfo::frameInUseCount.

Also fixed a bug with synchronization in VmaDedicatedAllocationList.
2022-01-10 17:57:11 +01:00
Adam Sawicki
5453c4b5eb Fixed compilation of tests. 2022-01-07 14:27:36 +01:00
Adam Sawicki
c61770a162 Fixed CMakeLists.txt regarding VMA_DYNAMIC_VULKAN_FUNCTIONS, VMA_STATIC_VULKAN_FUNCTIONS
Closes #218
2022-01-05 18:41:51 +01:00
Adam Sawicki
7c48285034 Removed VMA_USE_STL_CONTAINERS 2021-12-22 14:57:18 +01:00
Adam Sawicki
cbad11e039 Fixed vmaGetPoolStats for dedicated allocations
Added new tests: TestPoolsAndAllocationParameters.
2021-12-22 14:50:49 +01:00
Adam Sawicki
4586be47d8 Fixed usage of VMA_STATIC_VULKAN_FUNCTIONS, VMA_DYNAMIC_VULKAN_FUNCTIONS in CmakeLists.txt
Fixes #215
2021-12-17 12:11:06 +01:00
Adam Sawicki
5c8b3ba955 Fixes in CMakeLists.txt files
Added header files, added NATVIS file, added missing project dependencies.
2021-12-07 16:48:59 +01:00
Adam Sawicki
d3067c3620 Improved NATVIS file - added support for VmaIntrusiveLinkedList usage 2021-12-07 16:48:07 +01:00
Adam Sawicki
35eeb340a3 Renamed function vmaGetBudget to vmaGetHeapBudgets. COMPATIBILITY BREAKING!
Rebuilt the docs.
Closes #213
2021-12-06 17:36:18 +01:00
Adam Sawicki
4cd813a8c6 Added flag VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT 2021-12-06 12:14:13 +01:00
Adam Sawicki
4e4e1c085d Added parameters -t --Test and -s -TestSparseBinding to the test app, to execute tests and exit. 2021-12-03 12:13:44 +01:00
Adam Sawicki
d74155933e Improvements in CMakeLists.txt 2021-12-03 11:37:36 +01:00
Adam Sawicki
2854266061 Fix in TestHeapSizeLimit 2021-12-02 16:38:35 +01:00
Adam Sawicki
f529a86ab5 Added VmaVulkanFunctions::vkGetInstanceProcAddr, vkGetDeviceProcAddr
These are now required when using VMA_DYNAMIC_VULKAN_FUNCTIONS. Compatibility breaking!

Closes #211
2021-11-29 17:52:30 +01:00
Adam Sawicki
41296759b9 Refactoring: Added function VmaAddStatInfoAllocation, VmaAddStatInfoUnusedRange
Submitting improved tests.
2021-10-30 12:44:40 +02:00
Adam Sawicki
73ff8e07d1 Preparations for adding support for alternative algorithms in virtual blocks and tests for them 2021-10-28 19:20:12 +02:00
Adam Sawicki
c6432507c5 Implemented vmaBuildVirtualBlockStatsString, vmaFreeVirtualBlockStatsString 2021-10-28 17:00:17 +02:00
Adam Sawicki
cc61fe10d8 Implemented vmaClearVirtualBlock 2021-10-28 16:03:09 +02:00
Adam Sawicki
9a091e8ccb Implemented vmaCalculateVirtualBlockStats 2021-10-28 15:00:24 +02:00
Adam Sawicki
72949fa9d8 Enabled more tests 2021-10-28 14:54:07 +02:00
Adam Sawicki
e1812303d6 More coding and more tests. Basic functionality is working now. 2021-10-28 14:46:45 +02:00
Adam Sawicki
54b7eccc35 More implementation and first tests.
Crashing for now - need more refactoring.
2021-10-28 14:32:34 +02:00