Memory Decompression
Commands that can be used to decompress memory between one or more memory regions are vkCmdDecompressMemoryEXT, vkCmdDecompressMemoryNV, vkCmdDecompressMemoryIndirectCountNV, and vkCmdDecompressMemoryIndirectCountEXT.
To decompress memory containing compressed data, call:
// Provided by VK_EXT_memory_decompression
void vkCmdDecompressMemoryEXT(
VkCommandBuffer commandBuffer,
const VkDecompressMemoryInfoEXT* pDecompressMemoryInfoEXT);
-
commandBufferis the command buffer into which the command will be recorded. -
pDecompressMemoryInfoEXTis a pointer to a VkDecompressMemoryInfoEXT structure describing the decompression parameters.
The VkDecompressMemoryInfoEXT structure is defined as:
// Provided by VK_EXT_memory_decompression
typedef struct VkDecompressMemoryInfoEXT {
VkStructureType sType;
const void* pNext;
VkMemoryDecompressionMethodFlagsEXT decompressionMethod;
uint32_t regionCount;
const VkDecompressMemoryRegionEXT* pRegions;
} VkDecompressMemoryInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
decompressionMethodis a bitmask of VkMemoryDecompressionMethodFlagBitsEXT with a single bit set specifying the method used to decompress data. -
regionCountis the number of regions to decompress. -
pRegionsis a pointer to an array of VkDecompressMemoryRegionEXT structures specifying the regions to decompress.
Each memory region specified in pRegions is decompressed from the
source to the destination address based on the decompression method
specified in decompressionMethod.
If any of the specified source and destination regions overlap in memory,
then the results of decompression are undefined.
The VkDecompressMemoryRegionEXT structure is defined as:
// Provided by VK_EXT_memory_decompression
typedef struct VkDecompressMemoryRegionEXT {
VkDeviceAddress srcAddress;
VkDeviceAddress dstAddress;
VkDeviceSize compressedSize;
VkDeviceSize decompressedSize;
} VkDecompressMemoryRegionEXT;
-
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.
Accesses to compressed and decompressed data specified in srcAddress
and dstAddress must be synchronized
with the VK_PIPELINE_STAGE_2_MEMORY_DECOMPRESSION_BIT_EXT
pipeline stage with
access type of
VK_ACCESS_2_MEMORY_DECOMPRESSION_READ_BIT_EXT or
VK_ACCESS_2_MEMORY_DECOMPRESSION_WRITE_BIT_EXT.
To decompress memory containing compressed data, 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 compressed to decompressed region based on the decompression method
specified in VkDecompressMemoryRegionNV::decompressionMethod.
If the regions containing compressed and decompressed data overlap, the
decompression behavior is undefined.
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 of VkMemoryDecompressionMethodFlagBitsNV 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_EXT_memory_decompression
void vkCmdDecompressMemoryIndirectCountEXT(
VkCommandBuffer commandBuffer,
VkMemoryDecompressionMethodFlagsEXT decompressionMethod,
VkDeviceAddress indirectCommandsAddress,
VkDeviceAddress indirectCommandsCountAddress,
uint32_t maxDecompressionCount,
uint32_t stride);
-
commandBufferis the command buffer into which the command will be recorded. -
decompressionMethodis a bitmask of VkMemoryDecompressionMethodFlagBitsEXT with a single bit set specifying the method used to decompress data. -
indirectCommandsAddressis the device address containing decompression parameters laid out as an array of VkDecompressMemoryRegionEXT structures. -
indirectCommandsCountAddressis the device address containing a 32-bit integer value specifying the decompression count. -
maxDecompressionCountis maximum number of decompressions that will be executed. The actual number of executed decompressions is the minimum of the count specified inindirectCommandsCountAddressandmaxDecompressionCount. -
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
decompressionMethod.
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 a 32-bit integer value specifying 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
decompressionMethod.
Bits which can be set in
VkDecompressMemoryRegionEXT::decompressionMethod
or VkDecompressMemoryRegionNV::decompressionMethod
specifying the decompression method to select, or returned in
VkPhysicalDeviceMemoryDecompressionPropertiesEXT::decompressionMethods
specifying the available decompression methods are:
// Provided by VK_EXT_memory_decompression
// Flag bits for VkMemoryDecompressionMethodFlagBitsEXT
typedef VkFlags64 VkMemoryDecompressionMethodFlagBitsEXT;
static const VkMemoryDecompressionMethodFlagBitsEXT VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_EXT = 0x00000001ULL;
static const VkMemoryDecompressionMethodFlagBitsEXT VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NV = 0x00000001ULL;
or the equivalent
// Provided by VK_NV_memory_decompression
typedef VkMemoryDecompressionMethodFlagBitsEXT VkMemoryDecompressionMethodFlagBitsNV;
-
VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_EXTspecifies that the GDeflate 1.0 algorithm is used to decompress data.
// Provided by VK_EXT_memory_decompression
typedef VkFlags64 VkMemoryDecompressionMethodFlagsEXT;
or the equivalent
// Provided by VK_NV_memory_decompression
typedef VkMemoryDecompressionMethodFlagsEXT VkMemoryDecompressionMethodFlagsNV;
VkMemoryDecompressionMethodFlagsEXT is a bitmask type for specifying a
mask of one or more VkMemoryDecompressionMethodFlagBitsEXT.