修复的问题: - math: 修复 Quaternion::Normalize 链接错误 - containers: HashMap 迭代器示例使用不存在的 cbegin/cend,删除冗余构造函数声明 - core: RefCounted 析构函数访问级别修正 (protected) - debug: LogLevelToString 示例返回值大小写修正 - memory: 修正 LinearAllocator::Reallocate 返回 nullptr,ProxyAllocator 统计描述,头文件路径 IAllocator.h -> Allocator.h - resources: Texture::Create mipLevels 参数描述修正 - rhi: 修复多处链接错误,新增缺失的方法文档 - threading: TaskSystem 配置项未实现状态标注,Wait 方法空实现标注
83 lines
2.1 KiB
Markdown
83 lines
2.1 KiB
Markdown
# RHITexture
|
|
|
|
**命名空间**: `XCEngine::RHI`
|
|
|
|
**类型**: `class` (abstract)
|
|
|
|
**描述**: GPU 纹理资源抽象接口,用于管理 1D、2D、3D 纹理和立方体贴图等 GPU 资源。
|
|
|
|
## 公共方法
|
|
|
|
### 属性访问
|
|
|
|
| 方法 | 文档 |
|
|
|------|------|
|
|
| `GetWidth` | [详细文档](get-width.md) |
|
|
| `GetHeight` | [详细文档](get-height.md) |
|
|
| `GetDepth` | [详细文档](get-depth.md) |
|
|
| `GetMipLevels` | [详细文档](get-mip-levels.md) |
|
|
| `GetFormat` | [详细文档](get-format.md) |
|
|
| `GetTextureType` | [详细文档](get-texture-type.md) |
|
|
|
|
### 状态管理
|
|
|
|
| 方法 | 文档 |
|
|
|------|------|
|
|
| `GetState` | [详细文档](get-state.md) |
|
|
| `SetState` | [详细文档](set-state.md) |
|
|
|
|
### 生命周期
|
|
|
|
| 方法 | 文档 |
|
|
|------|------|
|
|
| `Shutdown` | [详细文档](shutdown.md) |
|
|
|
|
### 其他
|
|
|
|
| 方法 | 文档 |
|
|
|------|------|
|
|
| `GetNativeHandle` | [详细文档](get-native-handle.md) |
|
|
| `GetName` | [详细文档](get-name.md) |
|
|
| `SetName` | [详细文档](set-name.md) |
|
|
|
|
## 纹理类型 (TextureType)
|
|
|
|
| 枚举值 | 描述 |
|
|
|--------|------|
|
|
| `TextureType::Texture1D` | 1D 纹理 |
|
|
| `TextureType::Texture2D` | 2D 纹理 |
|
|
| `TextureType::Texture2DArray` | 2D 纹理数组 |
|
|
| `TextureType::Texture3D` | 3D 纹理(体积纹理) |
|
|
| `TextureType::TextureCube` | 立方体贴图 |
|
|
| `TextureType::TextureCubeArray` | 立方体贴图数组 |
|
|
|
|
## 纹理格式 (Format)
|
|
|
|
| 格式 | 描述 |
|
|
|------|------|
|
|
| `Format::R8G8B8A8_UNorm` | 四通道 8 位归一化 |
|
|
| `Format::R16G16B16A16_Float` | 四通道 16 位浮点 |
|
|
| `Format::D32_Float` | 32 位深度 |
|
|
| `Format::BC1_UNorm` | BC1 压缩 (DXT1) |
|
|
| `Format::BC7_UNorm` | BC7 高质量压缩 |
|
|
|
|
## 使用示例
|
|
|
|
```cpp
|
|
TextureDesc desc;
|
|
desc.width = 1024;
|
|
desc.height = 1024;
|
|
desc.format = (uint32_t)Format::R8G8B8A8_UNorm;
|
|
desc.textureType = (uint32_t)TextureType::Texture2D;
|
|
|
|
RHITexture* texture = device->CreateTexture(desc);
|
|
texture->SetState(ResourceStates::PixelShaderResource);
|
|
texture->Shutdown();
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
|
|
- [RHIDevice](../device/device.md) - 创建设备
|
|
- [RHIBuffer](../buffer/buffer.md) - 缓冲区资源
|