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);
-
commandBuffer
is the command buffer into which the command will be recorded. -
decompressRegionCount
is the number of memory regions to decompress. -
pDecompressMemoryRegions
is a pointer to an array ofdecompressRegionCount
VkDecompressMemoryRegionNV 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;
-
srcAddress
is the address where compressed data is stored. -
dstAddress
is the destination address where decompressed data will be written. -
compressedSize
is the size of compressed data in bytes. -
decompressedSize
is the size of decompressed data in bytes. -
decompressionMethod
is a bitmask ofVkMemoryDecompressionMethodFlagBitsNV
with 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);
-
commandBuffer
is the command buffer into which the command will be recorded. -
indirectCommandsAddress
is the device address containing decompression parameters laid out as an array of VkDecompressMemoryRegionNV structures. -
indirectCommandsCountAddress
is the device address containing the decompression count. -
stride
is 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_NV
specifies 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
: