41. Memory Decompression
To decompress data between one or more memory regions call:
// Provided by VK_NV_memory_decompression
void vkCmdDecompressMemoryNV(
VkCommandBuffer commandBuffer,
uint32_t decompressRegionCount,
const VkDecompressMemoryRegionNV* pDecompressMemoryRegions);
-
commandBufferis the command buffer into which the command will be recorded. -
decompressRegionCountis the number of memory regions to decompress. -
pDecompressMemoryRegionsis a pointer to an array ofdecompressRegionCountVkDecompressMemoryRegionNV structures specifying decompression parameters.
Each region specified in pDecompressMemoryRegions is decompressed from
the source to destination region based on the specified decompression
method.
The VkDecompressMemoryRegionNV structure is defined as:
// Provided by VK_NV_memory_decompression
typedef struct VkDecompressMemoryRegionNV {
VkDeviceAddress srcAddress;
VkDeviceAddress dstAddress;
VkDeviceSize compressedSize;
VkDeviceSize decompressedSize;
VkMemoryDecompressionMethodFlagsNV decompressionMethod;
} VkDecompressMemoryRegionNV;
-
srcAddressis the address where compressed data is stored. -
dstAddressis the destination address where decompressed data will be written. -
compressedSizeis the size of compressed data in bytes. -
decompressedSizeis the size of decompressed data in bytes. -
decompressionMethodis a bitmask ofVkMemoryDecompressionMethodFlagBitsNVwith a single bit set specifying the method used to decompress data.
To decompress data between one or more memory regions by specifying decompression parameters indirectly in a buffer, call:
// Provided by VK_NV_memory_decompression
void vkCmdDecompressMemoryIndirectCountNV(
VkCommandBuffer commandBuffer,
VkDeviceAddress indirectCommandsAddress,
VkDeviceAddress indirectCommandsCountAddress,
uint32_t stride);
-
commandBufferis the command buffer into which the command will be recorded. -
indirectCommandsAddressis the device address containing decompression parameters laid out as an array of VkDecompressMemoryRegionNV structures. -
indirectCommandsCountAddressis the device address containing the decompression count. -
strideis the byte stride between successive sets of decompression parameters located starting fromindirectCommandsAddress.
Each region specified in indirectCommandsAddress is decompressed from
the source to destination region based on the specified decompression
method.
Bits which can be set in
VkDecompressMemoryRegionNV::decompressionMethod specifying the
decompression method to select, or returned in
VkPhysicalDeviceMemoryDecompressionPropertiesNV::decompressionMethods
specifying the available decompression methods are:
// Provided by VK_NV_memory_decompression
// Flag bits for VkMemoryDecompressionMethodFlagBitsNV
typedef VkFlags64 VkMemoryDecompressionMethodFlagBitsNV;
static const VkMemoryDecompressionMethodFlagBitsNV VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NV = 0x00000001ULL;
-
VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NVspecifies that the GDeflate 1.0 algorithm is used to decompress data.
// Provided by VK_NV_memory_decompression
typedef VkFlags64 VkMemoryDecompressionMethodFlagsNV;
VkMemoryDecompressionMethodFlagsNV is a bitmask type for specifying a
mask of one or more VkMemoryDecompressionMethodFlagBitsNV: