23 C
New York

AMD releases Vulkan support for Dense Geometry Format

Published:

In our Solving the Dense Geometry Problem blog we described Dense Geometry Format (DGF), a block-based geometry compression technology developed by AMD, which will be directly supported by future GPU architectures.

We are now releasing a provisional Vulkan® extension VK_AMDX_dense_geometry_format that enables DGF data to be provided directly to the acceleration structure build, removing the performance and memory costs imposed by a separate decoding step. On hardware with native DGF support, the extension will significantly improve BLAS build time, and sharply reduce BLAS memory footprint.

The extension is very simple. When an application wants to build an acceleration structure using pre-compressed DGF data it sets the geometryType member of VkAccelerationStructureGeometryKHR to VK_GEOMETRY_TYPE_DENSE_GEOMETRY_FORMAT_TRIANGLES_AMDX

typedef enum VkGeometryTypeKHR {

VK_GEOMETRY_TYPE_TRIANGLES_KHR = 0,

VK_GEOMETRY_TYPE_AABBS_KHR = 1,

VK_GEOMETRY_TYPE_INSTANCES_KHR = 2,

// Provided by VK_AMDX_dense_geometry_format

VK_GEOMETRY_TYPE_DENSE_GEOMETRY_FORMAT_TRIANGLES_AMDX = 1000478000,

and then extends VkAccelerationStructureGeometryKHR by attaching a VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX to its pNext chain.

// Provided by VK_AMDX_dense_geometry_format

typedef struct VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX {

VkDeviceOrHostAddressConstKHR compressedData;

uint32_t maxPrimitiveIndex;

uint32_t maxGeometryIndex;

VkCompressedTriangleFormatAMDX format;

} VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX;

The members of VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX can be filled out either by saving off the values when compressing the data using e.g. the sample encoder (DGFTester.exe) in the DGF SDK:

c:\DGFSDK\build\DGFSDK\DGFTester\Debug>DGFTester.exe teapot.obj --dump-bin teapot.dgf

Loading obj file: teapot.obj

Model size: 4690 verts 9128 tris 0 materials

491 DGF blocks (0.00% palette)

8953 block vertices, 9128 block triangles (0.98 V/Tri)

Vertex duplication factor: 1.91

Vertex duplication cost per byte: 0.47B/Tri

Blocks per cluster: Min: 2 Max: 9 Mean: 4.63

Tris per cluster: Min: 50 Max: 127 Mean: 86.11

or at runtime using something like this code snippet from the DGF SDK to extract the values from the DGF data:

const auto numBlocks = GetNumDGFBlocks();

for (size_t block = 0; block < numBlocks; block++) {

const uint8_t* pBlock = m_blocks.data() + block * DGF::BLOCK_SIZE;

DGF::DecodeMetaData(&meta, pBlock);

uint8_t opaqueFlags[DGF::MAX_TRIS];

uint32_t geomID[DGF::MAX_TRIS];

DGF::DecodeGeomIDs(geomID, opaqueFlags, pBlock);

for (size_t i=0; i<meta.numTris; i++)

m_maxGeomIndex = std::max(m_maxGeomIndex, geomID[i]);

m_maxPrimIndex = std::max(m_maxPrimIndex, meta.primIDBase + (meta.numTris - 1));

m_sumBlockTris += meta.numTris;

m_sumBlockVerts += meta.numVerts;

Support for this extension is initially available in the AMD Software: Adrenalin Edition™ 25.10.25.02 preview driver and then in an upcoming AMD Software: Adrenalin Edition driver.

There is also a simple sample app showing the extension’s usage:

Resources

To get started using the extension, check out the following resources:

Join the AMD Developer Community Discord Server to connect with fellow developers and AMD staff to discuss this release in the “GAME DEV BOARDS_”.

Disclaimers

Links to third-party sites are provided for convenience and unless explicitly stated, AMD is not responsible for the contents of such linked sites, and no endorsement is implied. GD-98

Khronos and Vulkan are registered trademarks of the Khronos Group Inc.

Source link

Related articles

Recent articles