docs(api): expand OpenGL view and D3D12 texture docs
This commit is contained in:
@@ -6,41 +6,66 @@
|
||||
|
||||
**头文件**: `XCEngine/RHI/OpenGL/OpenGLRenderTargetView.h`
|
||||
|
||||
**描述**: 定义 `XCEngine/RHI/OpenGL` 子目录中的 `OpenGLRenderTargetView` public API。
|
||||
**描述**: 旧式 OpenGL 颜色渲染目标辅助类,内部为单个纹理附件创建独立 framebuffer。
|
||||
|
||||
## 概述
|
||||
## 概览
|
||||
|
||||
`OpenGLRenderTargetView.h` 是 `XCEngine/RHI/OpenGL` 子目录 下的 public header,当前页面作为平行目录中的 canonical 总览,用于汇总该头文件暴露的主要声明。
|
||||
`OpenGLRenderTargetView` 来自较早的 OpenGL 封装路径。它的核心思路非常直接:
|
||||
|
||||
## 声明概览
|
||||
- 接收一个已经存在的纹理 id
|
||||
- 创建一个专属 framebuffer
|
||||
- 把该纹理的某个 mip、数组层或 cubemap face 附着到 `GL_COLOR_ATTACHMENT0`
|
||||
|
||||
| 声明 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `RenderTargetType` | `enum class` | 头文件中的公开声明。 |
|
||||
| `OpenGLRenderTargetViewDesc` | `struct` | 头文件中的公开声明。 |
|
||||
| `OpenGLRenderTargetView` | `class` | 头文件中的公开声明。 |
|
||||
这和现代显式图形 API 中的 render-target view 概念有相似之处,但在当前引擎里,它已经与更新的 `OpenGLFramebuffer + OpenGLResourceView` 方案产生职责重叠。
|
||||
|
||||
## 公共方法
|
||||
## 设计定位
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [OpenGLRenderTargetView()](Constructor.md) | 构造对象。 |
|
||||
| [~OpenGLRenderTargetView()](Destructor.md) | 销毁对象并释放相关资源。 |
|
||||
| [Initialize](Initialize.md) | 初始化内部状态。 |
|
||||
| [InitializeCubemap](InitializeCubemap.md) | 初始化内部状态。 |
|
||||
| [Shutdown](Shutdown.md) | 关闭并清理内部状态。 |
|
||||
| [Bind](Bind.md) | 公开方法,详见头文件声明。 |
|
||||
| [Unbind](Unbind.md) | 公开方法,详见头文件声明。 |
|
||||
| [Clear](Clear.md) | 清空内部数据。 |
|
||||
| [GetFramebuffer](GetFramebuffer.md) | 获取相关状态或对象。 |
|
||||
| [GetTexture](GetTexture.md) | 获取相关状态或对象。 |
|
||||
| [GetMipLevel](GetMipLevel.md) | 获取相关状态或对象。 |
|
||||
| [GetWidth](GetWidth.md) | 获取相关状态或对象。 |
|
||||
| [GetHeight](GetHeight.md) | 获取相关状态或对象。 |
|
||||
| [BindFramebuffer](BindFramebuffer.md) | 公开方法,详见头文件声明。 |
|
||||
| [UnbindFramebuffer](UnbindFramebuffer.md) | 公开方法,详见头文件声明。 |
|
||||
可以把这个类理解成“快速创建单附件 FBO 的旧工具层”。
|
||||
|
||||
它的优点是:
|
||||
|
||||
- 实现非常直观
|
||||
- 测试与工具代码里使用成本低
|
||||
- 不需要先构造更完整的 framebuffer 描述
|
||||
|
||||
它的缺点也很明显:
|
||||
|
||||
- 只覆盖单颜色附件路径
|
||||
- 没有和统一的 descriptor / framebuffer 体系深度融合
|
||||
- `GetWidth()` / `GetHeight()` 这类字段没有真正维护
|
||||
|
||||
如果你在构建商业级渲染架构,新的 `OpenGLFramebuffer` / `OpenGLResourceView` 路径更接近统一 RHI 的长期方案。
|
||||
|
||||
## 生命周期
|
||||
|
||||
- 构造时不创建任何 OpenGL 对象。
|
||||
- `Initialize()` / `InitializeCubemap()` 成功后持有一个独立 FBO。
|
||||
- `Shutdown()` 或析构时删除该 FBO。
|
||||
|
||||
## 线程语义
|
||||
|
||||
- 当前实现没有同步保护。
|
||||
- 所有调用都应视为依赖当前 OpenGL 上下文,通常应在拥有该上下文的渲染线程执行。
|
||||
|
||||
## 当前实现的真实行为
|
||||
|
||||
- 只操作颜色附件,不直接表达深度/模板附件创建。
|
||||
- `Bind(slot)` 的 `slot` 参数被忽略。
|
||||
- 多 framebuffer 的 `Bind(count, ...)` 是一套明显偏旧的辅助逻辑,不等价于现代 MRT 抽象。
|
||||
- `Clear()` 不会恢复之前的 framebuffer 绑定。
|
||||
- `GetWidth()` / `GetHeight()` 当前基本恒为 `0`。
|
||||
- 单元测试 `tests/RHI/OpenGL/unit/test_render_target_view.cpp` 只覆盖了初始化、绑定/解绑、纹理 id 和 mip 访问这些基础能力。
|
||||
|
||||
## 关键方法
|
||||
|
||||
- [Initialize](Initialize.md)
|
||||
- [InitializeCubemap](InitializeCubemap.md)
|
||||
- [Bind](Bind.md)
|
||||
- [Clear](Clear.md)
|
||||
- [Shutdown](Shutdown.md)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [当前目录](../OpenGL.md) - 返回 `OpenGL` 平行目录
|
||||
- [API 总索引](../../../../main.md) - 返回顶层索引
|
||||
- [OpenGL](../OpenGL.md)
|
||||
- [OpenGLFramebuffer](../OpenGLFramebuffer/OpenGLFramebuffer.md)
|
||||
- [OpenGLResourceView](../OpenGLResourceView/OpenGLResourceView.md)
|
||||
|
||||
Reference in New Issue
Block a user