Files
XCEngine/docs/api/rhi/d3d12/d3d12-sampler.md

65 lines
1.3 KiB
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.
# D3D12Sampler
DirectX 12 采样器的 D3D12 实现。
## 头文件
```cpp
#include <XCEngine/RHI/D3D12/D3D12Sampler.h>
```
## 继承关系
```
RHISampler (interface)
└── D3D12Sampler (implementation)
```
## 公共成员函数
### 构造函数与析构函数
#### `D3D12Sampler()`
默认构造函数。
#### `~D3D12Sampler() override`
析构函数,确保调用 `Shutdown()`
### 初始化
#### `bool Initialize(ID3D12Device* device, const D3D12_SAMPLER_DESC& desc)`
初始化采样器。
- `device`: D3D12 设备
- `desc`: D3D12 采样器描述
- 返回: 初始化是否成功
#### `void Shutdown() override`
释放采样器。
### 描述
#### `D3D12_SAMPLER_DESC GetDesc() const`
获取采样器描述。
### 接口实现
#### `void* GetNativeHandle() override`
返回 `nullptr`D3D12 采样器通过描述符堆管理)。
#### `unsigned int GetID() override`
返回 0。
#### `void Bind(unsigned int unit) override / Unbind(unsigned int unit) override`
绑定/解绑(空实现)。
## 内部成员
| 成员 | 类型 | 描述 |
|------|------|------|
| `m_desc` | `D3D12_SAMPLER_DESC` | 采样器描述 |
## 备注
- D3D12 采样器通常放在根签名或采样器描述符堆中
- 静态采样器在根签名中声明,无需描述符堆