VulkanMemoryAllocator/docs/Recording file format.md

177 lines
5.4 KiB
Markdown
Raw Normal View History

This is an official documentation for file format used by Vulkan Memory Allocator library
to record and replay sequence of calls to its functions.
This feature can be enabled by using `VmaAllocatorCreateInfo::pRecordSettings` structure members.
For details, see main documentation of the library.
Playback can be launched using **VmaReplay** console application.
Recording is a text file.
Line endings: Unix `'\n'`.
Character encoding: single-byte (can be ASCII or UTF-8, whaterver you use in custom strings).
Suggested file extension: **csv**. File can be processed sequentially - no random access is needed.
Each line forms a separate entry.
Each line consists of a set of values (also called columns), separated by comma `','` (hence "CSV" format - Comma Separated Values).
Number of columns is different in different lines.
# Header
First line identifies file format. It must always be:
Vulkan Memory Allocator,Calls recording
Second line identifies format version, where first column is major version and second column is minor version.
Formats with only minor version incremented are backward compatible.
VmaReplay application supports all older versions.
Current version is:
1,2
# Function calls
Remaining lines contain recorded calls to VMA functions. First columns are always:
- Thread ID : uint32
- Time since first call : float, in seconds
- VMA frame index : uint32
- Function name : string
Remaining columns are function parameters and output, depending on function name, which can be:
**vmaCreateAllocator, vmaDestroyAllocator**
No parameters.
**vmaCreatePool**
- memoryTypeIndex : uint32
- flags : uint32
- blockSize : uint64
- minBlockCount : uint64
- maxBlockCount : uint64
- frameInUseCount : uint32
- pool (output) : pointer
**vmaDestroyPool**
- pool : pointer
**vmaSetAllocationUserData**
- allocation : pointer
- pUserData : string (may contain additional commas)
**vmaCreateBuffer**
- bufferCreateInfo.flags : uint32
- bufferCreateInfo.size : uint64
- bufferCreateInfo.usage : uint32
- bufferCreateInfo.sharingMode : uint32
- allocationCreateInfo.flags : uint32
- allocationCreateInfo.usage : uint32
- allocationCreateInfo.requiredFlags : uint32
- allocationCreateInfo.preferredFlags : uint32
- allocationCreateInfo.memoryTypeBits : uint32
- allocationCreateInfo.pool : pointer
- allocation (output) : pointer
- allocationCreateInfo.pUserData : string (may contain additional commas)
**vmaDestroyBuffer**
- allocation : pointer
**vmaCreateImage**
- imageCreateInfo.flags : uint32
- imageCreateInfo.imageType : uint32
- imageCreateInfo.format : uint32
- imageCreateInfo.extent.width : uint32
- imageCreateInfo.extent.height : uint32
- imageCreateInfo.extent.depth : uint32
- imageCreateInfo.mipLevels : uint32
- imageCreateInfo.arrayLayers : uint32
- imageCreateInfo.samples : uint32
- imageCreateInfo.tiling : uint32
- imageCreateInfo.usage : uint32
- imageCreateInfo.sharingMode : uint32
- imageCreateInfo.initialLayout : uint32
- allocationCreateInfo.flags : uint32
- allocationCreateInfo.usage : uint32
- allocationCreateInfo.requiredFlags : uint32
- allocationCreateInfo.preferredFlags : uint32
- allocationCreateInfo.memoryTypeBits : uint32
- allocationCreateInfo.pool : pointer
- allocation (output) : pointer
- allocationCreateInfo.pUserData : string (may contain additional commas)
**vmaDestroyImage**
- allocation : pointer
**vmaFreeMemory** (min format version 1.1)
- allocation : pointer
**vmaCreateLostAllocation** (min format version 1.2)
- allocation (output) : pointer
**vmaAllocateMemory** (min format version 1.2)
- vkMemoryRequirements.size : uint64
- vkMemoryRequirements.alignment : uint64
- vkMemoryRequirements.memoryTypeBits : uint32
- allocationCreateInfo.flags : uint32
- allocationCreateInfo.usage : uint32
- allocationCreateInfo.requiredFlags : uint32
- allocationCreateInfo.preferredFlags : uint32
- allocationCreateInfo.memoryTypeBits : uint32
- allocationCreateInfo.pool : pointer
- allocation (output) : pointer
- allocationCreateInfo.pUserData : string (may contain additional commas)
**vmaAllocateMemoryForBuffer, vmaAllocateMemoryForImage** (min format version 1.2)
- vkMemoryRequirements.size : uint64
- vkMemoryRequirements.alignment : uint64
- vkMemoryRequirements.memoryTypeBits : uint32
- requiresDedicatedAllocation : bool
- prefersDedicatedAllocation : bool
- allocationCreateInfo.flags : uint32
- allocationCreateInfo.usage : uint32
- allocationCreateInfo.requiredFlags : uint32
- allocationCreateInfo.preferredFlags : uint32
- allocationCreateInfo.memoryTypeBits : uint32
- allocationCreateInfo.pool : pointer
- allocation (output) : pointer
- allocationCreateInfo.pUserData : string (may contain additional commas)
**vmaMapMemory, vmaUnmapMemory** (min format version 1.2)
- allocation : pointer
**vmaFlushAllocation, vmaInvalidateAllocation** (min format version 1.2)
- allocation : pointer
- offset : uint64
- size : uint64
## Data types
**bool**
Encoded as `0` for false or `1` for true.
**uint32, uint64**
Encoded in decimal format.
**pointer**
Encoded in hexadecimal format.
**pUserData**
If `pUserData` was a pointer, it is encoded as hexadecimal string.
If `VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT` was used with the allocation, the string is written as-is.
It may contain additional commas.
It should not contain end-of-line characters - results are then undefined.