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

占用单个着色器槽位的常量数量（这些常量显示为单个常量缓冲区）。
所有常量占用单个根签名绑定槽位。

## 备注

有关着色器寄存器和空间的详细信息，请参阅 [Resource Binding in HLSL](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/resource-binding-in-hlsl)。

**D3D12\_ROOT\_CONSTANTS** 是 [D3D12\_ROOT\_PARAMETER](/reference/graphics/d3d12/structs/d3d12_root_parameter_public) 的 **Constants** 成员的数据类型。
当你将 **D3D12\_ROOT\_PARAMETER** 的 **SlotType** 字段设置为 [D3D12\_ROOT\_PARAMETER\_TYPE](/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)

[Core Structures](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)

[Creating a Root Signature](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/creating-a-root-signature)

[Using constants directly in the root signature](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/using-constants-directly-in-the-root-signature)
