docs: update RHI API docs
This commit is contained in:
26
docs/api/rhi/d3d12/sampler/bind.md
Normal file
26
docs/api/rhi/d3d12/sampler/bind.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# D3D12Sampler::Bind
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Bind(unsigned int unit) override
|
||||
```
|
||||
|
||||
## 描述
|
||||
|
||||
绑定采样器到指定的纹理单元。此方法继承自 `RHISampler` 接口。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `unit` | `unsigned int` | 纹理单元索引 |
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Sampler](sampler.md) - 类总览
|
||||
- [RHISampler](../../sampler/sampler.md) - 抽象采样器接口
|
||||
42
docs/api/rhi/d3d12/sampler/get-desc.md
Normal file
42
docs/api/rhi/d3d12/sampler/get-desc.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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) - 类总览
|
||||
24
docs/api/rhi/d3d12/sampler/get-native-handle.md
Normal file
24
docs/api/rhi/d3d12/sampler/get-native-handle.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# D3D12Sampler::GetNativeHandle
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void* GetNativeHandle() override
|
||||
```
|
||||
|
||||
## 描述
|
||||
|
||||
获取 D3D12 采样器的原生句柄。此方法继承自 `RHISampler` 接口。
|
||||
|
||||
## 参数
|
||||
|
||||
无
|
||||
|
||||
## 返回值
|
||||
|
||||
`void*` - 原生句柄指针。当前实现返回 `nullptr`。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Sampler](sampler.md) - 类总览
|
||||
- [RHISampler](../../sampler/sampler.md) - 抽象采样器接口
|
||||
71
docs/api/rhi/d3d12/sampler/index.md
Normal file
71
docs/api/rhi/d3d12/sampler/index.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# D3D12Sampler 类
|
||||
|
||||
## 命名空间
|
||||
`XCEngine::RHI`
|
||||
|
||||
## 类型
|
||||
类 (Class),继承自 `RHISampler`
|
||||
|
||||
## 描述
|
||||
D3D12 采样器实现类,用于配置纹理采样状态。封装 D3D12 采样器描述符,支持过滤模式、寻址模式等采样参数配置。
|
||||
|
||||
## 概述
|
||||
`D3D12Sampler` 是 RHI 抽象层在 DirectX 12 后端的采样器实现。该类管理 D3D12 采样器状态,与 `RHISampler` 基类配合提供跨平台统一的采样器接口。
|
||||
|
||||
**当前实现状态**: 本类为存根实现,`Initialize()` 仅存储描述符,未创建实际 D3D12 采样器对象。
|
||||
|
||||
## 公共方法表格
|
||||
|
||||
| 方法 | 签名 | 描述 |
|
||||
|------|------|------|
|
||||
| `D3D12Sampler` | `D3D12Sampler()` | 构造函数,初始化描述符为零 |
|
||||
| `~D3D12Sampler` | `~D3D12Sampler()` | 析构函数,调用 `Shutdown()` |
|
||||
| `Initialize` | `bool Initialize(ID3D12Device* device, const D3D12_SAMPLER_DESC& desc)` | 初始化采样器 |
|
||||
| `Shutdown` | `void Shutdown()` | 关闭采样器,重置描述符 |
|
||||
| `GetDesc` | `D3D12_SAMPLER_DESC GetDesc() const` | 获取采样器描述符副本 |
|
||||
| `GetNativeHandle` | `void* GetNativeHandle()` | 获取原生句柄(暂未实现) |
|
||||
| `GetID` | `unsigned int GetID()` | 获取采样器 ID(暂未实现) |
|
||||
| `Bind` | `void Bind(unsigned int unit)` | 绑定到纹理单元(暂未实现) |
|
||||
| `Unbind` | `void Unbind(unsigned int unit)` | 从纹理单元解绑(暂未实现) |
|
||||
|
||||
## 头文件
|
||||
```cpp
|
||||
#include "XCEngine/RHI/D3D12/D3D12Sampler.h"
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
```cpp
|
||||
#include "XCEngine/RHI/D3D12/D3D12Sampler.h"
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
|
||||
// 创建设备指针 (假设已创建)
|
||||
ID3D12Device* device = ...;
|
||||
|
||||
// 配置采样器描述符
|
||||
D3D12_SAMPLER_DESC samplerDesc = {};
|
||||
samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
samplerDesc.MaxAnisotropy = 16;
|
||||
samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_LESS;
|
||||
samplerDesc.BorderColor[0] = 0.0f;
|
||||
samplerDesc.BorderColor[1] = 0.0f;
|
||||
samplerDesc.BorderColor[2] = 0.0f;
|
||||
samplerDesc.BorderColor[3] = 1.0f;
|
||||
|
||||
// 创建并初始化采样器
|
||||
D3D12Sampler* sampler = new D3D12Sampler();
|
||||
if (sampler->Initialize(device, samplerDesc)) {
|
||||
D3D12_SAMPLER_DESC desc = sampler->GetDesc();
|
||||
// 使用采样器...
|
||||
sampler->Shutdown();
|
||||
}
|
||||
delete sampler;
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHISampler 基类](../RHISampler.md)
|
||||
- [D3D12 枚举映射](./D3D12Enum.md)
|
||||
52
docs/api/rhi/d3d12/sampler/initialize.md
Normal file
52
docs/api/rhi/d3d12/sampler/initialize.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# D3D12Sampler::Initialize
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool Initialize(ID3D12Device* device, const D3D12_SAMPLER_DESC& desc)
|
||||
```
|
||||
|
||||
## 描述
|
||||
|
||||
初始化 D3D12 采样器对象。根据提供的采样器描述符创建并配置 D3D12 采样器状态。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `device` | `ID3D12Device*` | D3D12 设备指针,用于创建采样器资源 |
|
||||
| `desc` | `const D3D12_SAMPLER_DESC&` | 采样器描述符,包含过滤模式、寻址模式等配置 |
|
||||
|
||||
## 返回值
|
||||
|
||||
`bool` - 初始化成功返回 `true`,否则返回 `false`
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12Sampler sampler;
|
||||
D3D12_SAMPLER_DESC desc = {};
|
||||
desc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
desc.MipLODBias = 0.0f;
|
||||
desc.MaxAnisotropy = 16;
|
||||
desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
|
||||
desc.BorderColor[0] = 0.0f;
|
||||
desc.BorderColor[1] = 0.0f;
|
||||
desc.BorderColor[2] = 0.0f;
|
||||
desc.BorderColor[3] = 0.0f;
|
||||
desc.MinLOD = 0.0f;
|
||||
desc.MaxLOD = D3D12_FLOAT32_MAX;
|
||||
|
||||
if (sampler.Initialize(device, desc)) {
|
||||
// 采样器初始化成功
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Sampler::Shutdown](shutdown.md) - 关闭采样器
|
||||
- [D3D12Sampler::GetDesc](get-desc.md) - 获取采样器描述符
|
||||
- [D3D12Sampler](sampler.md) - 类总览
|
||||
@@ -2,21 +2,50 @@
|
||||
|
||||
**命名空间**: `XCEngine::RHI`
|
||||
|
||||
**描述**: DirectX 12 采样器的 D3D12 实现,继承自 `RHISampler`。
|
||||
**类型**: `class`
|
||||
|
||||
**继承**: `RHISampler`
|
||||
|
||||
**描述**: DirectX 12 采样器的 D3D12 实现,提供对 D3D12 采样器资源的封装和管理。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`Initialize`](../../../threading/task-system/initialize.md) | 初始化采样器 |
|
||||
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭采样器 |
|
||||
| [`GetDesc`](../buffer/get-desc.md) | 获取采样器描述符 |
|
||||
| [`GetNativeHandle`](../../buffer/get-native-handle.md) | 获取原生句柄 |
|
||||
| [`Initialize`](initialize.md) | 初始化采样器 |
|
||||
| [`GetDesc`](get-desc.md) | 获取采样器描述符 |
|
||||
| [`GetID`](get-id.md) | 获取采样器 ID |
|
||||
| [`Bind`](../../shader/bind.md) | 绑定采样器 |
|
||||
| [`Unbind`](../../shader/unbind.md) | 解绑采样器 |
|
||||
|
||||
## 继承方法
|
||||
|
||||
以下方法继承自 `RHISampler`:
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`Shutdown`](shutdown.md) | 关闭采样器 |
|
||||
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
|
||||
| [`Bind`](bind.md) | 绑定采样器到纹理单元 |
|
||||
| [`Unbind`](unbind.md) | 解绑采样器 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
D3D12Sampler sampler;
|
||||
D3D12_SAMPLER_DESC desc = {};
|
||||
desc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
|
||||
if (sampler.Initialize(device, desc)) {
|
||||
sampler.Bind(0);
|
||||
// 使用采样器...
|
||||
sampler.Unbind(0);
|
||||
sampler.Shutdown();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12 后端总览](../../opengl/overview.md)
|
||||
- [D3D12 后端总览](../d3d12.md) - D3D12 模块总览
|
||||
- [RHISampler](../../sampler/sampler.md) - 抽象采样器接口
|
||||
|
||||
24
docs/api/rhi/d3d12/sampler/shutdown.md
Normal file
24
docs/api/rhi/d3d12/sampler/shutdown.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# D3D12Sampler::Shutdown
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Shutdown() override
|
||||
```
|
||||
|
||||
## 描述
|
||||
|
||||
关闭 D3D12 采样器并释放相关资源。此方法继承自 `RHISampler` 接口。
|
||||
|
||||
## 参数
|
||||
|
||||
无
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Sampler](sampler.md) - 类总览
|
||||
- [RHISampler](../../sampler/sampler.md) - 抽象采样器接口
|
||||
26
docs/api/rhi/d3d12/sampler/unbind.md
Normal file
26
docs/api/rhi/d3d12/sampler/unbind.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# D3D12Sampler::Unbind
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Unbind(unsigned int unit) override
|
||||
```
|
||||
|
||||
## 描述
|
||||
|
||||
从指定的纹理单元解绑采样器。此方法继承自 `RHISampler` 接口。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `unit` | `unsigned int` | 纹理单元索引 |
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Sampler](sampler.md) - 类总览
|
||||
- [RHISampler](../../sampler/sampler.md) - 抽象采样器接口
|
||||
Reference in New Issue
Block a user