docs(api): refactor OpenGL and D3D12 binding docs
This commit is contained in:
@@ -1,32 +1,43 @@
|
||||
# OpenGLDescriptorSet::BindWithPipelineLayout
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
|
||||
```cpp
|
||||
void BindWithPipelineLayout(const OpenGLPipelineLayout* pipelineLayout, uint32_t setIndex);
|
||||
void BindWithPipelineLayout(
|
||||
const OpenGLPipelineLayout* pipelineLayout,
|
||||
uint32_t setIndex);
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/RHI/OpenGL/OpenGLDescriptorSet.h`,当前页面用于固定 `OpenGLDescriptorSet` 类目录下的方法级 canonical 路径。
|
||||
## 作用
|
||||
|
||||
**参数:**
|
||||
- `pipelineLayout` - 参数语义详见头文件声明。
|
||||
- `setIndex` - 参数语义详见头文件声明。
|
||||
结合 `pipelineLayout` 把当前 descriptor set 绑定到真正的 OpenGL binding point。这是现代 RHI 路径下的主要绑定函数。
|
||||
|
||||
**返回:** `void` - 无返回值。
|
||||
## 前置条件
|
||||
|
||||
**示例:**
|
||||
- descriptor set 已初始化。
|
||||
- `setIndex` 应与当前 draw / dispatch 使用的 set 槽位一致。
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/RHI/OpenGL/OpenGLDescriptorSet.h>
|
||||
## 参数
|
||||
|
||||
void Example() {
|
||||
XCEngine::RHI::OpenGLDescriptorSet object;
|
||||
// 根据上下文补齐参数后调用 OpenGLDescriptorSet::BindWithPipelineLayout(...)。
|
||||
(void)object;
|
||||
}
|
||||
```
|
||||
- `pipelineLayout`: 提供 `set + binding -> GL binding point` 的映射规则。
|
||||
- `setIndex`: 当前 set 在 pipeline layout 中的索引。
|
||||
|
||||
## 当前实现行为
|
||||
|
||||
- 如果常量数据 dirty,会先上传共享 UBO。
|
||||
- `CBV` 通过 `OpenGLPipelineLayout::GetConstantBufferBindingPoint()` 获取实际 binding point。
|
||||
- `SRV` 通过 `glActiveTexture(GL_TEXTURE0 + bindingPoint)` 绑定为采样纹理。
|
||||
- `UAV` 通过 `glBindImageTexture(bindingPoint, textureId, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8)` 绑定。
|
||||
- `Sampler` 通过 `glBindSampler(bindingPoint, samplerId)` 绑定。
|
||||
- 如果 `pipelineLayout == nullptr` 或 layout 不使用 set layout,则回退为使用原始 `binding` 编号。
|
||||
|
||||
## 当前限制
|
||||
|
||||
- `SRV` 仍然固定按 `GL_TEXTURE_2D` 绑定。
|
||||
- `UAV` 固定使用 `GL_RGBA8`,并且固定使用 mip `0`、layer `0`。
|
||||
- 该函数不会检查 shader 反射结果与 layout 是否一致。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](OpenGLDescriptorSet.md)
|
||||
- [返回模块目录](../OpenGL.md)
|
||||
- [OpenGLPipelineLayout](../OpenGLPipelineLayout/OpenGLPipelineLayout.md)
|
||||
- [Bind](Bind.md)
|
||||
- [OpenGLCommandList::SetGraphicsDescriptorSets](../OpenGLCommandList/SetGraphicsDescriptorSets.md)
|
||||
- [OpenGLCommandList::SetComputeDescriptorSets](../OpenGLCommandList/SetComputeDescriptorSets.md)
|
||||
|
||||
Reference in New Issue
Block a user