Skip to content

Commit 2b3e416

Browse files
Merge branch 'development'
2 parents 6c55634 + 2cf37c8 commit 2b3e416

File tree

251 files changed

+11811
-20617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+11811
-20617
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
# 2.1.0-beta.1 (2018-08-27)
2+
3+
Major release after many months of development in "development" branch and features branches. Many new features added, some bugs fixed. API stays backward-compatible.
4+
5+
Major changes:
6+
7+
- Added linear allocation algorithm, accessible for custom pools, that can be used as free-at-once, stack, double stack, or ring buffer. See "Linear allocation algorithm" documentation chapter.
8+
- Added `VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT`, `VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT`.
9+
- Added feature to record sequence of calls to the library to a file and replay it using dedicated application. See documentation chapter "Record and replay".
10+
- Recording: added `VmaAllocatorCreateInfo::pRecordSettings`.
11+
- Replaying: added VmaReplay project.
12+
- Recording file format: added document "docs/Recording file format.md".
13+
- Improved support for non-coherent memory.
14+
- Added functions: `vmaFlushAllocation`, `vmaInvalidateAllocation`.
15+
- `nonCoherentAtomSize` is now respected automatically.
16+
- Added `VmaVulkanFunctions::vkFlushMappedMemoryRanges`, `vkInvalidateMappedMemoryRanges`.
17+
- Improved debug features related to detecting incorrect mapped memory usage. See documentation chapter "Debugging incorrect memory usage".
18+
- Added debug macro `VMA_DEBUG_DETECT_CORRUPTION`, functions `vmaCheckCorruption`, `vmaCheckPoolCorruption`.
19+
- Added debug macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to initialize contents of allocations with a bit pattern.
20+
- Changed behavior of `VMA_DEBUG_MARGIN` macro - it now adds margin also before first and after last allocation in a block.
21+
- Changed format of JSON dump returned by `vmaBuildStatsString` (not backward compatible!).
22+
- Custom pools and memory blocks now have IDs that don't change after sorting.
23+
- Added properties: "CreationFrameIndex", "LastUseFrameIndex", "Usage".
24+
- Changed VmaDumpVis tool to use these new properties for better coloring.
25+
- Changed behavior of `vmaGetAllocationInfo` and `vmaTouchAllocation` to update `allocation.lastUseFrameIndex` even if allocation cannot become lost.
26+
27+
Minor changes:
28+
29+
- Changes in custom pools:
30+
- Added new structure member `VmaPoolStats::blockCount`.
31+
- Changed behavior of `VmaPoolCreateInfo::blockSize` = 0 (default) - it now means that pool may use variable block sizes, just like default pools do.
32+
- Improved logic of `vmaFindMemoryTypeIndex` for some cases, especially integrated GPUs.
33+
- VulkanSample application: Removed dependency on external library MathFu. Added own vector and matrix structures.
34+
- Changes that improve compatibility with various platforms, including: Visual Studio 2012, 32-bit code, C compilers.
35+
- Changed usage of "VK_KHR_dedicated_allocation" extension in the code to be optional, driven by macro `VMA_DEDICATED_ALLOCATION`, for compatibility with Android.
36+
- Many additions and fixes in documentation, including description of new features, as well as "Validation layer warnings".
37+
- Other bugfixes.
38+
139
# 2.0.0 (2018-03-19)
240

341
A major release with many compatibility-breaking changes.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ Additional features:
4141
- Configuration: Fill optional members of CreateInfo structure to provide custom CPU memory allocator, pointers to Vulkan functions and other parameters.
4242
- Customization: Predefine appropriate macros to provide your own implementation of all external facilities used by the library, from assert, mutex, and atomic, to vector and linked list.
4343
- Support for memory mapping, reference-counted internally. Support for persistently mapped memory: Just allocate with appropriate flag and you get access to mapped pointer.
44+
- Support for non-coherent memory. Functions that flush/invalidate memory. nonCoherentAtomSize is respected automatically.
4445
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
46+
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
4547
- Support for VK_KHR_dedicated_allocation extension: Just enable it and it will be used automatically by the library.
4648
- Defragmentation: Call one function and let the library move data around to free some memory blocks and make your allocations better compacted.
4749
- Lost allocations: Allocate memory with appropriate flags and let the library remove allocations that are not used for many frames to make room for new ones.
4850
- Statistics: Obtain detailed statistics about the amount of memory used, unused, number of allocated blocks, number of allocations etc. - globally, per memory heap, and per memory type.
4951
- Debug annotations: Associate string with name or opaque pointer to your own data with every allocation.
5052
- JSON dump: Obtain a string in JSON format with detailed map of internal state, including list of allocations and gaps between them.
5153
- Convert this JSON dump into a picture to visualize your memory. See [tools/VmaDumpVis](tools/VmaDumpVis/README.md).
54+
- Debugging incorrect memory usage: Enable initialization of all allocated memory with a bit pattern to detect usage of uninitialized or freed memory. Enable validation of a magic number before and after every allocation to detect out-of-bounds memory corruption.
55+
- Record and replay sequence of calls to library functions to a file to check correctness, measure performance, and gather statistics.
5256

5357
# Prequisites
5458

bin/Shader.frag.spv

0 Bytes
Binary file not shown.

bin/Shader.vert.spv

0 Bytes
Binary file not shown.

bin/VmaReplay_Release_vs2015.exe

160 KB
Binary file not shown.

bin/VulkanSample_Release_vs2015.exe

32.5 KB
Binary file not shown.

docs/Recording file format.md

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
This is an official documentation for file format used by Vulkan Memory Allocator library
2+
to record and replay sequence of calls to its functions.
3+
This feature can be enabled by using `VmaAllocatorCreateInfo::pRecordSettings` structure members.
4+
For details, see main documentation of the library.
5+
Playback can be launched using **VmaReplay** console application.
6+
7+
Recording is a text file.
8+
Line endings: Unix `'\n'`.
9+
Character encoding: single-byte (can be ASCII or UTF-8, whaterver you use in custom strings).
10+
Suggested file extension: **csv**. File can be processed sequentially - no random access is needed.
11+
Each line forms a separate entry.
12+
Each line consists of a set of values (also called columns), separated by comma `','` (hence "CSV" format - Comma Separated Values).
13+
Number of columns is different in different lines.
14+
15+
# Header
16+
17+
First line identifies file format. It must always be:
18+
19+
Vulkan Memory Allocator,Calls recording
20+
21+
Second line identifies format version, where first column is major version and second column is minor version.
22+
Formats with only minor version incremented are backward compatible.
23+
VmaReplay application supports all older versions.
24+
Current version is:
25+
26+
1,3
27+
28+
# Configuration
29+
30+
Header is followed by mandatory configuration section (min format version 1.3). It starts with line:
31+
32+
Config,Begin
33+
34+
And ends with line:
35+
36+
Config,End
37+
38+
Between them there can be zero or more lines with configuration options. They store values of various variables from the current environment from the time of recording, like properties and limits of Vulkan physical device, available memory heaps and types, enabled Vulkan extensions, as well macros that configure VMA internals. Supported configuration options are:
39+
40+
PhysicalDevice,apiVersion,<uint32>
41+
PhysicalDevice,driverVersion,<uint32>
42+
PhysicalDevice,vendorID,<uint32>
43+
PhysicalDevice,deviceID,<uint32>
44+
PhysicalDevice,deviceType,<uint32>
45+
PhysicalDevice,deviceName,<string>
46+
47+
PhysicalDeviceLimits,maxMemoryAllocationCount,<uint32>
48+
PhysicalDeviceLimits,bufferImageGranularity,<uint64>
49+
PhysicalDeviceLimits,nonCoherentAtomSize,<uint64>
50+
51+
PhysicalDeviceMemory,HeapCount,<uint32>
52+
PhysicalDeviceMemory,Heap,<index:uint32>,size,<uint64>
53+
PhysicalDeviceMemory,Heap,<index:uint32>,flags,<uint32>
54+
PhysicalDeviceMemory,TypeCount,<uint32>
55+
PhysicalDeviceMemory,Type,<index:uint32>,heapIndex,<uint32>
56+
PhysicalDeviceMemory,Type,<index:uint32>,propertyFlags,<uint32>
57+
58+
Extension,VK_KHR_dedicated_allocation,<bool>
59+
60+
Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,<bool>
61+
Macro,VMA_DEBUG_ALIGNMENT,<uint64>
62+
Macro,VMA_DEBUG_MARGIN,<uint64>
63+
Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,<bool>
64+
Macro,VMA_DEBUG_DETECT_CORRUPTION,<bool>
65+
Macro,VMA_DEBUG_GLOBAL_MUTEX,<bool>
66+
Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,<uint64>
67+
Macro,VMA_SMALL_HEAP_MAX_SIZE,<uint64>
68+
Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,<uint64>
69+
70+
# Function calls
71+
72+
Remaining lines contain recorded calls to VMA functions. First columns are always:
73+
74+
- Thread ID : uint32
75+
- Time since first call : float, in seconds
76+
- VMA frame index : uint32
77+
- Function name : string
78+
79+
Remaining columns are function parameters and output, depending on function name, which can be:
80+
81+
**vmaCreateAllocator, vmaDestroyAllocator**
82+
83+
No parameters.
84+
85+
**vmaCreatePool**
86+
87+
- memoryTypeIndex : uint32
88+
- flags : uint32
89+
- blockSize : uint64
90+
- minBlockCount : uint64
91+
- maxBlockCount : uint64
92+
- frameInUseCount : uint32
93+
- pool (output) : pointer
94+
95+
**vmaDestroyPool**
96+
97+
- pool : pointer
98+
99+
**vmaSetAllocationUserData**
100+
101+
- allocation : pointer
102+
- pUserData : string (may contain additional commas)
103+
104+
**vmaCreateBuffer**
105+
106+
- bufferCreateInfo.flags : uint32
107+
- bufferCreateInfo.size : uint64
108+
- bufferCreateInfo.usage : uint32
109+
- bufferCreateInfo.sharingMode : uint32
110+
- allocationCreateInfo.flags : uint32
111+
- allocationCreateInfo.usage : uint32
112+
- allocationCreateInfo.requiredFlags : uint32
113+
- allocationCreateInfo.preferredFlags : uint32
114+
- allocationCreateInfo.memoryTypeBits : uint32
115+
- allocationCreateInfo.pool : pointer
116+
- allocation (output) : pointer
117+
- allocationCreateInfo.pUserData : string (may contain additional commas)
118+
119+
**vmaDestroyBuffer**
120+
121+
- allocation : pointer
122+
123+
**vmaCreateImage**
124+
125+
- imageCreateInfo.flags : uint32
126+
- imageCreateInfo.imageType : uint32
127+
- imageCreateInfo.format : uint32
128+
- imageCreateInfo.extent.width : uint32
129+
- imageCreateInfo.extent.height : uint32
130+
- imageCreateInfo.extent.depth : uint32
131+
- imageCreateInfo.mipLevels : uint32
132+
- imageCreateInfo.arrayLayers : uint32
133+
- imageCreateInfo.samples : uint32
134+
- imageCreateInfo.tiling : uint32
135+
- imageCreateInfo.usage : uint32
136+
- imageCreateInfo.sharingMode : uint32
137+
- imageCreateInfo.initialLayout : uint32
138+
- allocationCreateInfo.flags : uint32
139+
- allocationCreateInfo.usage : uint32
140+
- allocationCreateInfo.requiredFlags : uint32
141+
- allocationCreateInfo.preferredFlags : uint32
142+
- allocationCreateInfo.memoryTypeBits : uint32
143+
- allocationCreateInfo.pool : pointer
144+
- allocation (output) : pointer
145+
- allocationCreateInfo.pUserData : string (may contain additional commas)
146+
147+
**vmaDestroyImage**
148+
149+
- allocation : pointer
150+
151+
**vmaFreeMemory** (min format version 1.1)
152+
153+
- allocation : pointer
154+
155+
**vmaCreateLostAllocation** (min format version 1.2)
156+
157+
- allocation (output) : pointer
158+
159+
**vmaAllocateMemory** (min format version 1.2)
160+
161+
- vkMemoryRequirements.size : uint64
162+
- vkMemoryRequirements.alignment : uint64
163+
- vkMemoryRequirements.memoryTypeBits : uint32
164+
- allocationCreateInfo.flags : uint32
165+
- allocationCreateInfo.usage : uint32
166+
- allocationCreateInfo.requiredFlags : uint32
167+
- allocationCreateInfo.preferredFlags : uint32
168+
- allocationCreateInfo.memoryTypeBits : uint32
169+
- allocationCreateInfo.pool : pointer
170+
- allocation (output) : pointer
171+
- allocationCreateInfo.pUserData : string (may contain additional commas)
172+
173+
**vmaAllocateMemoryForBuffer, vmaAllocateMemoryForImage** (min format version 1.2)
174+
175+
- vkMemoryRequirements.size : uint64
176+
- vkMemoryRequirements.alignment : uint64
177+
- vkMemoryRequirements.memoryTypeBits : uint32
178+
- requiresDedicatedAllocation : bool
179+
- prefersDedicatedAllocation : bool
180+
- allocationCreateInfo.flags : uint32
181+
- allocationCreateInfo.usage : uint32
182+
- allocationCreateInfo.requiredFlags : uint32
183+
- allocationCreateInfo.preferredFlags : uint32
184+
- allocationCreateInfo.memoryTypeBits : uint32
185+
- allocationCreateInfo.pool : pointer
186+
- allocation (output) : pointer
187+
- allocationCreateInfo.pUserData : string (may contain additional commas)
188+
189+
**vmaMapMemory, vmaUnmapMemory** (min format version 1.2)
190+
191+
- allocation : pointer
192+
193+
**vmaFlushAllocation, vmaInvalidateAllocation** (min format version 1.2)
194+
195+
- allocation : pointer
196+
- offset : uint64
197+
- size : uint64
198+
199+
**vmaTouchAllocation, vmaGetAllocationInfo** (min format version 1.2)
200+
201+
- allocation : pointer
202+
203+
**vmaMakePoolAllocationsLost** (min format version: 1.2)
204+
205+
- pool : pointer
206+
207+
# Data types
208+
209+
**bool**
210+
211+
Encoded as `0` for false or `1` for true.
212+
213+
**uint32, uint64**
214+
215+
Encoded in decimal format.
216+
217+
**pointer**
218+
219+
Encoded in hexadecimal format.
220+
221+
**pUserData**
222+
223+
If `pUserData` was a pointer, it is encoded as hexadecimal string.
224+
If `VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT` was used with the allocation, the string is written as-is.
225+
It may contain additional commas.
226+
It should not contain end-of-line characters - results are then undefined.
227+
228+
# Example file
229+
230+
Vulkan Memory Allocator,Calls recording
231+
1,3
232+
Config,Begin
233+
PhysicalDevice,apiVersion,4198477
234+
PhysicalDevice,driverVersion,8388653
235+
PhysicalDevice,vendorID,4098
236+
PhysicalDevice,deviceID,26751
237+
PhysicalDevice,deviceType,2
238+
PhysicalDevice,deviceName,Radeon RX Vega
239+
PhysicalDeviceLimits,maxMemoryAllocationCount,4096
240+
PhysicalDeviceLimits,bufferImageGranularity,1
241+
PhysicalDeviceLimits,nonCoherentAtomSize,128
242+
PhysicalDeviceMemory,HeapCount,3
243+
PhysicalDeviceMemory,Heap,0,size,8304721920
244+
PhysicalDeviceMemory,Heap,0,flags,3
245+
PhysicalDeviceMemory,Heap,1,size,8286175232
246+
PhysicalDeviceMemory,Heap,1,flags,0
247+
PhysicalDeviceMemory,Heap,2,size,268435456
248+
PhysicalDeviceMemory,Heap,2,flags,3
249+
PhysicalDeviceMemory,TypeCount,4
250+
PhysicalDeviceMemory,Type,0,heapIndex,0
251+
PhysicalDeviceMemory,Type,0,propertyFlags,1
252+
PhysicalDeviceMemory,Type,1,heapIndex,1
253+
PhysicalDeviceMemory,Type,1,propertyFlags,6
254+
PhysicalDeviceMemory,Type,2,heapIndex,2
255+
PhysicalDeviceMemory,Type,2,propertyFlags,7
256+
PhysicalDeviceMemory,Type,3,heapIndex,1
257+
PhysicalDeviceMemory,Type,3,propertyFlags,14
258+
Extension,VK_KHR_dedicated_allocation,1
259+
Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,0
260+
Macro,VMA_DEBUG_ALIGNMENT,1
261+
Macro,VMA_DEBUG_MARGIN,0
262+
Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,0
263+
Macro,VMA_DEBUG_DETECT_CORRUPTION,0
264+
Macro,VMA_DEBUG_GLOBAL_MUTEX,0
265+
Macro,VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY,1
266+
Macro,VMA_SMALL_HEAP_MAX_SIZE,1073741824
267+
Macro,VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE,268435456
268+
Config,End
269+
12552,0.000,0,vmaCreateAllocator
270+
12552,0.010,0,vmaCreateImage,0,1,37,128,128,1,1,1,1,1,1,0,8,36,2,0,0,0,0000000000000000,000001D85B8B1A80,
271+
12552,0.010,0,vmaSetAllocationUserData,000001D85B8B1A80,Ala ma kota
272+
12552,0.015,0,vmaCreateImage,0,1,37,128,128,1,1,1,1,0,6,0,0,0,1,0,0,0,0000000000000000,000001D85B8B1620,
273+
12552,0.017,0,vmaDestroyImage,000001D85B8B1A80
274+
12552,0.017,0,vmaCreateBuffer,0,768,1,0,4,2,0,0,0,0000000000000000,000001D85B8B19E0,
275+
12552,0.017,0,vmaCreateBuffer,0,768,130,0,0,1,0,0,0,0000000000000000,000001D85B8B1A80,
276+
12552,0.017,0,vmaCreateBuffer,0,60,1,0,4,2,0,0,0,0000000000000000,000001D85B8B1DA0,
277+
12552,0.017,0,vmaCreateBuffer,0,60,66,0,0,1,0,0,0,0000000000000000,000001D85B8B16C0,
278+
12552,0.017,0,vmaDestroyBuffer,000001D85B8B1DA0
279+
12552,0.017,0,vmaDestroyBuffer,000001D85B8B19E0
280+
12552,0.022,0,vmaCreateImage,0,1,126,1424,704,1,1,1,1,0,32,0,0,0,1,0,0,0,0000000000000000,000001D85B8B1EE0,
281+
12552,0.048,0,vmaDestroyImage,000001D85B8B1EE0
282+
12552,0.053,0,vmaCreateImage,0,1,126,1424,704,1,1,1,1,0,32,0,0,0,1,0,0,0,0000000000000000,000001D85B8B1EE0,
283+
12552,0.662,0,vmaDestroyImage,000001D85B8B1EE0
284+
12552,0.695,0,vmaDestroyImage,000001D85B8B1620
285+
12552,0.695,0,vmaDestroyBuffer,000001D85B8B16C0
286+
12552,0.695,0,vmaDestroyBuffer,000001D85B8B1A80
287+
12552,0.695,0,vmaDestroyAllocator
1.23 KB
Loading
1.94 KB
Loading
5.08 KB
Loading

0 commit comments

Comments
 (0)