docs: update RHI API docs
This commit is contained in:
@@ -4,12 +4,40 @@
|
||||
virtual void* GetNativeHandle() = 0;
|
||||
```
|
||||
|
||||
获取原生 API 句柄。
|
||||
获取底层图形 API 的原生句柄。此方法返回的句柄类型取决于具体实现:
|
||||
|
||||
**返回:** 原生管线状态句柄
|
||||
- **D3D12**: `ID3D12PipelineState*`
|
||||
- **OpenGL**: `GLuint`(管线对象 ID)
|
||||
- **Vulkan**: `VkPipeline`
|
||||
- **Metal**: `id<MTLRenderPipelineState>`
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `void*` - 指向底层图形 API 管线状态对象的指针
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/RHI/RHIPipelineState.h"
|
||||
#include "XCEngine/RHI/RHIEnums.h"
|
||||
|
||||
void InspectNativeHandle(RHIPipelineState* pipeline) {
|
||||
void* handle = pipeline->GetNativeHandle();
|
||||
|
||||
PipelineType type = pipeline->GetType();
|
||||
|
||||
if (type == PipelineType::Graphics && handle) {
|
||||
// D3D12: ID3D12PipelineState* d3d12Pipeline = static_cast<ID3D12PipelineState*>(handle);
|
||||
// OpenGL: GLuint glPipeline = static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIPipelineState 总览](pipeline-state.md) - 返回类总览
|
||||
- [RHIPipelineState](pipeline-state.md) - 返回类总览
|
||||
- [RHIPipelineState::GetType](get-type.md) - 获取管线类型
|
||||
|
||||
Reference in New Issue
Block a user