D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS structure (d3d12.h)

Defines the inputs for a raytracing acceleration structure build operation. This structure is used by ID3D12GraphicsCommandList4::BuildRaytracingAccelerationStructure and ID3D12Device5::GetRaytracingAccelerationStructurePrebuildInfo.

Syntax

typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS {
  D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE        Type;
  D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS Flags;
  UINT                                                NumDescs;
  D3D12_ELEMENTS_LAYOUT                               DescsLayout;
  union {
    D3D12_GPU_VIRTUAL_ADDRESS            InstanceDescs;
    const D3D12_RAYTRACING_GEOMETRY_DESC *pGeometryDescs;
    const D3D12_RAYTRACING_GEOMETRY_DESC const * * ppGeometryDescs;
  };
} D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS;

Members

Type

The type of acceleration structure to build.

Flags

The build flags.

NumDescs

If Type is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TOP_LEVEL, this value is the number of instances, laid out based on DescsLayout.

If Type is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BOTTOM_LEVEL, this value is the number of elements referred to by pGeometryDescs or ppGeometryDescs. Which of these fields is used depends on DescsLayout.

DescsLayout

How geometry descriptions are specified; either an array of descriptions or an array of pointers to descriptions.

InstanceDescs

If Type is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TOP_LEVEL, this refers to NumDescsD3D12_RAYTRACING_INSTANCE_DESC structures in GPU memory describing instances. Each instance must be aligned to 16 bytes, defined as D3D12_RAYTRACING_INSTANCE_DESC_BYTE_ALIGNMENT.

If Type is not D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TOP_LEVEL, this parameter is unused.

If DescLayout is D3D12_ELEMENTS_LAYOUT_ARRAY, InstanceDescs points to an array of instance descriptions in GPU memory.

If DescLayout is D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS, InstanceDescs points to an array in GPU memory of D3D12_GPU_VIRTUAL_ADDRESS pointers to instance descriptions.

The memory pointed to must be in state D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE.

pGeometryDescs

If Type is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BOTTOM_LEVEL, and DescsLayout is D3D12_ELEMENTS_LAYOUT_ARRAY, this field is used and points to NumDescs contiguous D3D12_RAYTRACING_GEOMETRY_DESC structures on the CPU, describing individual geometries.

If Type is not D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BOTTOM_LEVEL or DescsLayout is not D3D12_ELEMENTS_LAYOUT_ARRAY, this parameter is unused.

ppGeometryDescs

If Type is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BOTTOM_LEVEL, and DescsLayout is D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS, this field is used and points to an array of NumDescs pointers to D3D12_RAYTRACING_GEOMETRY_DESC structures on the CPU, describing individual geometries.

Remarks

When used with GetRaytracingAccelerationStructurePrebuildInfo, which actually perform a build, any parameter that is referenced via D3D12_GPU_VIRTUAL_ADDRESS (an address in GPU memory), like InstanceDescs, will not be accessed by the operation. So this memory does not need to be initialized yet or be in a particular resource state. Whether GPU addresses are null or not can be inspected by the operation, even though the pointers are not dereferenced.

Requirements

Requirement Value
Header d3d12.h