Files
XCEngine/docs/api/rhi/fence/getnativehandle.md
2026-03-20 02:35:45 +08:00

33 lines
653 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.
# RHIFence::GetNativeHandle
```cpp
virtual void* GetNativeHandle() = 0;
```
获取围栏的原生句柄,用于平台特定的图形 API 操作。返回的句柄类型取决于具体的 RHI 实现:
- DirectX 12`ID3D12Fence*`
- Vulkan`VkFence`
**参数:**
**返回:** 原生句柄指针(`void*`
**线程安全**:❌
**复杂度**O(1)
**示例**
```cpp
RHIFence* fence = device->CreateFence();
void* nativeHandle = fence->GetNativeHandle();
// 平台特定用法示例DirectX 12
// ID3D12Fence* dxFence = static_cast<ID3D12Fence*>(nativeHandle);
```
## 相关文档
- [RHIFence](fence.md) - 返回类总览