> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# D3D12_RAYTRACING_INSTANCE_DESC (XBOX Series consoles)

> Describes an instance of a raytracing acceleration structure used in GPU memory during the acceleration structure build process.

Describes an instance of a raytracing acceleration structure used in GPU memory during the acceleration structure build process.

## Syntax

```cpp theme={null}
typedef struct D3D12_RAYTRACING_INSTANCE_DESC
{
    FLOAT[4] Transform;
    UINT InstanceID;
    UINT InstanceMask;
    UINT InstanceContributionToHitGroupIndex;
    UINT Flags;
    D3D12_GPU_VIRTUAL_ADDRESS AccelerationStructure;
} D3D12_RAYTRACING_INSTANCE_DESC
```

### Members

*Transform*\
Type: FLOAT\[3]\[4]

A 3x4 transform matrix in row-major layout representing the instance-to-world transformation. Implementations transform rays, as opposed to transforming all of the geometry or AABBs.

<Note>
  The layout of `Transform` is a transpose of how affine matrices are typically stored in memory. Instead of four 3-vectors, `Transform` is laid out as three 4-vectors.
</Note>

*InstanceID*\
Type: UINT

An arbitrary 24-bit value that can be accessed using the `InstanceID` intrinsic function in supported shader types.

*InstanceMask*\
Type: UINT

An 8-bit mask assigned to the instance, which can be used to include/reject groups of instances on a per-ray basis. If the value is zero, then the instance will never be included, so typically this should be set to some non-zero value. For more information see, the `InstanceInclusionMask` parameter to the [TraceRay](https://learn.microsoft.com/en-us/windows/win32/direct3d12/traceray-function) function.

*InstanceContributionToHitGroupIndex*\
Type: UINT

An arbitrary 24-bit value representing per-instance contribution to add into shader table indexing to select the hit group to use.

*Flags*\
Type: UINT

An 8-bit mask representing flags from [D3D12\_RAYTRACING\_INSTANCE\_FLAGS](/reference/graphics/d3d12/enums/d3d12_raytracing_instance_flags_public) to apply to the instance.

*AccelerationStructure*\
Type: D3D12\_GPU\_VIRTUAL\_ADDRESS

Address of the bottom-level acceleration structure that is being instanced. The address must be aligned to 256 bytes, defined as [D3D12\_RAYTRACING\_ACCELERATION\_STRUCTURE\_BYTE\_ALIGNMENT](https://learn.microsoft.com/en-us/windows/win32/direct3d12/constants). Any existing acceleration structure passed in here would already have been required to be placed with such alignment.

The memory pointed to must be in state [D3D12\_RESOURCE\_STATE\_RAYTRACING\_ACCELERATION\_STRUCTURE](/reference/graphics/d3d12_x/enums/d3d12_resource_states).

## Remarks

This C++ struct definition is useful if you're generating instance data on the CPU first, then uploading to the GPU. But your application is also free to generate instance descriptions directly into GPU memory (from compute shaders, for instance) following the same layout.

## Requirements

**Header:** d3d12\_xs.h\
**Library:** d3d12\_xs.lib\
**Supported Platforms**: XBOX Series consoles


## Related topics

- [D3D12_RAYTRACING_INSTANCE_FLAGS (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_raytracing_instance_flags_public.md)
- [D3D12_RAYTRACING_GEOMETRY_DESC (XBOX Series consoles)](/reference/graphics/d3d12/structs/d3d12_raytracing_geometry_desc_public.md)
- [D3D12_RAYTRACING_GEOMETRY_AABBS_DESC (XBOX Series consoles)](/reference/graphics/d3d12/structs/d3d12_raytracing_geometry_aabbs_desc_public.md)
- [D3D12_RAYTRACING_GEOMETRY_FLAGS (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_raytracing_geometry_flags_public.md)
- [D3D12_RAYTRACING_GEOMETRY_TYPE (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_raytracing_geometry_type_public.md)
