> ## 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.

# DispatchRays (XBOX Series consoles)

> Launch the threads of a ray generation shader.

Launch the threads of a ray generation shader.

## Syntax

```cpp theme={null}
void DispatchRays(
    const D3D12_DISPATCH_RAYS_DESC  pDesc
)
```

### Parameters

*pDesc \[in]*\
Type: const D3D12\_DISPATCH\_RAYS\_DESC \*

A description of the ray dispatch

### Return value

Type: void

None.

## Remarks

This method can be called from graphics or compute command lists and bundles.

A raytracing pipeline state must be set on the command list. Otherwise, the behavior of this call is undefined.

There are 3 dimensions passed in to set the grid size:  width/height/depth.  These dimensions are constrained such that width \* height \* depth \<= 2^30. Exceeding this produces undefined behavior.
If any grid dimension is 0, no threads are launched.

## Requirements

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

## See Also

[ID3D12GraphicsCommandList4](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList4/id3d12graphicscommandlist4)


## Related topics

- [D3D12_DISPATCH_RAYS_DESC (XBOX Series consoles)](/reference/graphics/d3d12/structs/d3d12_dispatch_rays_desc_public.md)
- [Dispatch](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_dispatch_public.md)
- [D3D12_RAYTRACING_PIPELINE_FLAGS (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_raytracing_pipeline_flags_public.md)
- [IGameInputDispatcher::Dispatch](/reference/input/gameinput/interfaces/IGameInputDispatcher/methods/igameinputdispatcher_dispatch.md)
- [Raytracing on XBOX Series X|S with XDXR](/build/core-features/graphics/newfeatures/raytracing/index.md)
