docs: update RHI API docs
This commit is contained in:
@@ -4,16 +4,42 @@
|
||||
virtual unsigned int GetID() = 0;
|
||||
```
|
||||
|
||||
获取采样器 ID。
|
||||
获取采样器的唯一标识符。该方法返回分配给采样器的唯一整数 ID,可用于采样器的识别、缓存管理或调试目的。
|
||||
|
||||
**返回:** 采样器唯一标识符
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 采样器的唯一无符号整数标识符
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
unsigned int id = sampler->GetID();
|
||||
#include "XCEngine/RHI/RHISampler.h"
|
||||
|
||||
class MySampler : public XCEngine::RHI::RHISampler {
|
||||
public:
|
||||
void Shutdown() override { }
|
||||
void Bind(unsigned int unit) override { }
|
||||
void Unbind(unsigned int unit) override { }
|
||||
void* GetNativeHandle() override { return nullptr; }
|
||||
unsigned int GetID() override { return m_id; }
|
||||
|
||||
private:
|
||||
unsigned int m_id = 1;
|
||||
};
|
||||
|
||||
void Example() {
|
||||
MySampler sampler1;
|
||||
MySampler sampler2;
|
||||
unsigned int id1 = sampler1.GetID();
|
||||
unsigned int id2 = sampler2.GetID();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHISampler 总览](sampler.md) - 返回类总览
|
||||
- [RHISampler::GetNativeHandle](get-native-handle.md) - 获取原生句柄
|
||||
|
||||
Reference in New Issue
Block a user