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

> 描述根簽章中內嵌的常數，這些常數在著色器中會顯示為一個常數緩衝區。

描述根簽章中內嵌的常數，這些常數在著色器中會顯示為一個常數緩衝區。

## 語法

```cpp theme={null}
typedef struct D3D12_ROOT_CONSTANTS
{
    UINT ShaderRegister;
    UINT RegisterSpace;
    UINT Num32BitValues;
} D3D12_ROOT_CONSTANTS
```

### 成員

*ShaderRegister*\
類型：UINT

著色器暫存器。

*RegisterSpace*\
類型：UINT

暫存器空間。

*Num32BitValues*\
類型：UINT

佔用單一著色器插槽的常數數目 (這些常數會如同單一常數緩衝區般顯示)。
所有常數都佔用單一根簽章繫結插槽。

## 備註

如需著色器暫存器和空間的詳細資訊，請參閱 [HLSL 中的資源繫結](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/resource-binding-in-hlsl)。

**D3D12\_ROOT\_CONSTANTS** 是 [D3D12\_ROOT\_PARAMETER](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_parameter_public) 的 **Constants** 成員的資料類型。
當您將 **D3D12\_ROOT\_PARAMETER** 的 **SlotType** 欄位設定為 [D3D12\_ROOT\_PARAMETER\_TYPE](/zh-TW/reference/graphics/d3d12/enums/d3d12_root_parameter_type_public) 的 D3D12\_ROOT\_PARAMETER\_TYPE\_32BIT\_CONSTANTS 成員時，請使用 **D3D12\_ROOT\_CONSTANTS**。

## 需求

**標頭:** d3d12\_xs.h 或 d3d12\_x.h\
**程式庫:** d3d12\_xs.lib 或 d3d12\_x.lib\
**支援的平台**: XBOX Series 主機與 XBOX One 系列

## 另請參閱

[CD3DX12\_ROOT\_CONSTANTS](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-root-constants)

[核心結構](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)

[建立根簽章](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/creating-a-root-signature)

[直接在根簽章中使用常數](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/using-constants-directly-in-the-root-signature)


## Related topics

- [D3D12_ROOT_PARAMETER](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_parameter_public.md)
- [D3D12_ROOT_PARAMETER1](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_parameter1_public.md)
- [D3D12_ROOT_PARAMETER_TYPE](/zh-TW/reference/graphics/d3d12/enums/d3d12_root_parameter_type_public.md)
- [D3D12_ROOT_DESCRIPTOR](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_descriptor_public.md)
- [D3D12_ROOT_DESCRIPTOR1](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_descriptor1_public.md)
