Files
XCEngine/docs/api/rhi/d3d12/command-queue/signal.md
2026-03-20 02:35:45 +08:00

35 lines
866 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# D3D12CommandQueue::Signal
```cpp
void Signal(RHIFence* fence, uint64_t value) override;
```
向指定栅栏发送信号,将栅栏的完成值设置为给定值。该方法用于同步 GPU 和 CPU 操作。
**参数:**
- `fence` - 目标栅栏指针,不能为 `nullptr`
- `value` - 信号值,一个正整数
**返回:**
**复杂度:** O(1)
**使用场景:**
- 标记命令队列中所有已提交命令完成的时间点
- 用于 GPU-CPU 同步
-`Wait` 方法配合实现 GPU 流水线同步
## 示例
```cpp
D3D12Fence* fence; // 已初始化的栅栏
commandQueue.Signal(fence, 1);
// CPU 可以继续其他工作GPU 执行完成后 fence 的值变为 1
```
## 相关文档
- [D3D12CommandQueue 总览](command-queue.md) - 返回类总览
- [Wait](wait-for-idle.md) - 等待命令队列完成
- [D3D12Fence](../fence/fence.md)