Commit Graph

673 Commits

Author SHA1 Message Date
Adam Sawicki
596db32a8a Updated date in copyright headers 2024-01-14 20:18:45 +01:00
Adam Sawicki
b2e7801ff3 Added function vmaGetAllocationInfo2, structure VmaAllocationInfo2
See #383, #340 Thanks @debaetsd !
Rebuilt the docs.
2023-11-08 18:01:19 +01:00
Juan Ramos
b48d20cc86 Fixup include of "vk_mem_alloc.h"
No need to include via `../include`

By linking against `GPUOpen::VulkanMemoryAllocator` the proper
include directory is added to the project.
2023-07-11 14:13:20 -06:00
Adam Sawicki
01fe410548 Fixes in Cmake scripts after merging #350 2023-07-11 18:00:37 +02:00
Adam Sawicki
c503590e54
Merge pull request #350 from juan-lunarg/vma/346
Make VulkanMemoryAllocator a header only library
2023-07-11 17:40:25 +02:00
Tim Lobner
3cb5470faa fixed copy paste error in vulkan sample 2023-07-10 14:28:30 +02:00
Juan Ramos
3d23bb07e3 Make VulkanMemoryAllocator a header only library
Dramatically simplify the CMake code for end users. The intent
is to make the CMake for this library very easy to maintain.
While also making it easier for end users to consume.

This makes the CMake code very similar to:
- KhronosGroup/Vulkan-Headers
- KhronosGroup/SPIRV-Headers

Which is good for consistency/expectations.

The VmaUsage library still highlights the expected usage of
the "stb-style" single header file in a project.

closes #346
2023-07-06 14:49:44 -06:00
Alexandre Bouvier
870bae0fca cmake: use find_dependency 2023-07-04 15:09:36 +02:00
Adam Sawicki
db15ce374e
Merge pull request #345 from abouvier/cmake-fix
cmake: always add vulkan headers dir
2023-07-04 13:46:16 +02:00
Alexandre Bouvier
7f9124bad2 cmake: always add vulkan headers dir 2023-06-30 20:57:03 +02:00
Adam Sawicki
0aa3989b8f Switched src/CMakeLists.txt to use C++17 by default to resolve issues with aligned_alloc
Fixes #344
2023-06-13 14:33:10 +02:00
Adam Sawicki
729b7c1408 Fixes for some compiler warnings
Found by Visual Studio 2019
2023-02-24 14:04:59 +01:00
Juan Ramos
0b7c427971 MSVC cleanup
MSVC compiler can be used with Ninja as well. However, the current
CMake code doesn't account for it.
2022-11-30 10:30:19 -07:00
Attractadore
f000f1b369
Fix windows.h not found when cross compiling on Linux
The header provided by mingw-w64 on Linux is called windows.h.
2022-06-19 20:54:03 +03:00
Pierre Narvor
2bb598acd0 [cmake] Updated installation process to use modern CMake targets 2022-06-14 17:40:18 +02:00
Rémi Verschelde
9eab57ea44 Strip trailing whitespace in code files 2022-06-14 13:41:15 +02:00
Monika0000
bbc3d15390 fix re-defines 2022-06-14 04:13:30 +10:00
Adam Sawicki
a6bfc23725 Releasing version 3.0.1
Some fixes in tests for Nvidia cards.
2022-05-26 11:51:12 +02:00
Adam Sawicki
df7648061c Fixes in GpuMemDumpVis.py regarding image height calculation
Added GpuMemDump.schema.json.
Minor improvement in SaveAllocatorStatsToFile.
2022-04-05 13:32:30 +02:00
Adam Sawicki
2d2a9e3df3 Fixed bug with assert failure when JSON dump is created while a custom pool exist with specified string name 2022-03-29 17:24:48 +02:00
Adam Sawicki
3f9f66740a Fix for compilation on AppleClang 13.1
Fixes #253
2022-03-28 13:21:46 +02:00
Adam Sawicki
3c6470cf45 New JSON dump format
Unified across VMA and D3D12MA.
Updated Python script for visualization - now called GpuMemDumpVis.py.

Also a fix for bug in EXTENSIVE defragmentation algorithm - see #232

Code by @medranSolus
2022-03-24 11:50:34 +01:00
Adam Sawicki
6fbb28e3a8 Improvement in TestAllocationAliasing 2022-03-21 13:07:44 +01:00
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