fix(rhi): Fix RHI abstraction layer API docs per api-skill.md template
- Rename texture/dtor.md to destructor.md per template spec - Remove duplicate non-hyphenated fence docs (getnativehandle.md, issignaled.md, getcompletedvalue.md) - Fix template field issues: - swap-chain, command-queue: 类型 now uses 'class (abstract)' - sampler: 头文件 now uses full path 'XCEngine/RHI/RHISampler.h' - types: 类型 fixed from 'structs' to 'struct' - enums: 类型 fixed from 'enums' to 'enum class' - Fix include paths in command-queue and pipeline-layout code examples - Create missing constructor/destructor docs for 11 classes: buffer, texture, shader, device, command-list, command-queue, fence, sampler, swap-chain, pipeline-state, pipeline-layout - Update class overview pages to include constructor/destructor entries
This commit is contained in:
30
docs/api/rhi/shader/constructor.md
Normal file
30
docs/api/rhi/shader/constructor.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# RHIShader::RHIShader
|
||||
|
||||
```cpp
|
||||
RHIShader() = default;
|
||||
```
|
||||
|
||||
默认构造函数,创建空的 RHIShader 对象。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
// 通过设备编译着色器
|
||||
RHIShader* shader = device->CompileShader(desc);
|
||||
if (shader && shader->IsValid()) {
|
||||
shader->Bind();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIShader 总览](shader.md) - 返回类总览
|
||||
- [CompileShader](../device/compile-shader.md) - 编译着色器
|
||||
29
docs/api/rhi/shader/destructor.md
Normal file
29
docs/api/rhi/shader/destructor.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# RHIShader::~RHIShader
|
||||
|
||||
```cpp
|
||||
virtual ~RHIShader() = default;
|
||||
```
|
||||
|
||||
虚析构函数,确保派生类对象通过基类指针删除时能正确调用析构函数。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
// 通过基类指针销毁着色器对象
|
||||
RHIShader* shader = device->CompileShader(desc);
|
||||
// ... 使用 shader ...
|
||||
delete shader; // 自动调用派生类析构函数
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIShader 总览](shader.md) - 返回类总览
|
||||
- [Shutdown](shutdown.md) - 关闭着色器
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`RHIShader`](constructor.md) | 默认构造函数 |
|
||||
| [`~RHIShader`](destructor.md) | 虚析构函数 |
|
||||
| [`CompileFromFile`](compile-from-file.md) | 从文件编译着色器 |
|
||||
| [`Compile`](compile.md) | 从内存数据编译着色器 |
|
||||
| [`GetType`](get-type.md) | 获取着色器类型 |
|
||||
|
||||
Reference in New Issue
Block a user