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

# ID3D12CommandQueue::Signal

> ID3D12CommandQueue::Signal（XBOX 上的 Direct3D 12）— 将围栏更新到指定值。用于 XBOX 游戏开发的 Direct3D 12 图形 API 参考。

将围栏更新到指定值。

## 语法

```cpp theme={null}
HRESULT Signal(
    ID3D12Fence  pFence,
    UINT64 Value
)
```

### 参数

*pFence*\
类型：ID3D12Fence \*

指向 [ID3D12Fence](/reference/graphics/d3d12/interfaces/id3d12fence/id3d12fence_public) 对象的指针。

*Value*\
类型：UINT64

要将围栏设置为的值。

### 返回值

类型：HRESULT

此方法返回 [Direct3D 12 返回代码](https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3d12-graphics-reference-returnvalues) 之一。

## 备注

使用此方法可从 GPU 端设置围栏值。使用 [ID3D12Fence::Signal](/reference/graphics/d3d12/interfaces/id3d12fence/methods/id3d12fence_signal_public) 可从 CPU 端设置围栏。

#### 示例

向命令队列添加信号，然后等待计算着色器完成模拟，最后发出信号并递增围栏值。

```cpp theme={null}
// Wait for the compute shader to complete the simulation.
UINT64 threadFenceValue = InterlockedIncrement(&m_threadFenceValues[threadIndex]);
ThrowIfFailed(pCommandQueue->Signal(pFence, threadFenceValue));
ThrowIfFailed(pFence->SetEventOnCompletion(threadFenceValue, m_threadFenceEvents[threadIndex]));
WaitForSingleObject(m_threadFenceEvents[threadIndex], INFINITE);

```

```cpp theme={null}
// Add a signal command to the queue.
ThrowIfFailed(m_commandQueue->Signal(m_renderContextFence.Get(), m_renderContextFenceValue));

```

```cpp theme={null}
// Signal and increment the fence value.
ThrowIfFailed(m_commandQueue->Signal(m_renderContextFence.Get(), m_renderContextFenceValue));
m_renderContextFenceValue++;

```

请参阅 [D3D12 参考中的示例代码](https://learn.microsoft.com/en-us/windows/win32/direct3d12/notes-on-example-code)。

<div class="code" />

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机和 XBOX One 系列

## 另请参阅

[ID3D12CommandQueue](/reference/graphics/d3d12_xs/interfaces/ID3D12CommandQueue/id3d12commandqueue_xs)

[多引擎同步](https://learn.microsoft.com/en-us/windows/win32/direct3d12/user-mode-heap-synchronization)


## Related topics

- [ID3D12Fence::Signal](/zh-CN/reference/graphics/d3d12/interfaces/id3d12fence/methods/id3d12fence_signal_public.md)
- [ID3D12CommandQueue::GetDesc](/zh-CN/reference/graphics/d3d12/interfaces/id3d12commandqueue/methods/id3d12commandqueue_getdesc_public.md)
- [D3D12_COMMAND_QUEUE_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_command_queue_desc_public.md)
- [D3D12_COMMAND_QUEUE_PRIORITY](/zh-CN/reference/graphics/d3d12/enums/d3d12_command_queue_priority_public.md)
- [D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY](/zh-CN/reference/graphics/d3d12/structs/d3d12_feature_data_command_queue_priority_public.md)
