Files
XCEngine/docs/api/rhi/d3d12/sampler/get-desc.md
2026-03-20 02:35:45 +08:00

43 lines
1019 B
Markdown

# D3D12Sampler::GetDesc
## 函数签名
```cpp
D3D12_SAMPLER_DESC GetDesc() const
```
## 描述
获取 D3D12 采样器的描述符结构。该描述符包含了采样器的所有配置信息,包括过滤模式、寻址模式和细节级别等。
## 返回值
`D3D12_SAMPLER_DESC` - 采样器描述符的副本,包含以下配置:
| 字段 | 描述 |
|------|------|
| `Filter` | 过滤模式(线性、点采样、各向异性等) |
| `AddressU/V/W` | UVW 三个方向的寻址模式 |
| `MipLODBias` | Mip 级别偏移 |
| `MaxAnisotropy` | 最大各向异性级别 |
| `ComparisonFunc` | 比较函数 |
| `BorderColor` | 边界颜色 |
| `MinLOD/MaxLOD` | Mip 级别范围 |
## 示例
```cpp
D3D12Sampler sampler;
// ... 初始化 sampler ...
D3D12_SAMPLER_DESC desc = sampler.GetDesc();
if (desc.Filter == D3D12_FILTER_MIN_MAG_MIP_LINEAR) {
// 使用线性过滤
}
```
## 相关文档
- [D3D12Sampler::Initialize](initialize.md) - 初始化采样器
- [D3D12Sampler](sampler.md) - 类总览