2026-03-19 00:31:14 +08:00
|
|
|
# RHIPipelineLayout::Initialize
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
virtual bool Initialize(const RHIPipelineLayoutDesc& desc) = 0;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
初始化管线布局。
|
|
|
|
|
|
|
|
|
|
**参数:**
|
2026-03-20 02:35:45 +08:00
|
|
|
- `desc` - 管线布局描述符,包含以下成员:
|
|
|
|
|
- `constantBufferCount` - 常量缓冲区数量
|
|
|
|
|
- `textureCount` - 纹理数量
|
|
|
|
|
- `samplerCount` - 采样器数量
|
|
|
|
|
- `uavCount` - 无序访问视图数量
|
2026-03-19 00:31:14 +08:00
|
|
|
|
|
|
|
|
**返回:** 成功返回 `true`,失败返回 `false`
|
|
|
|
|
|
|
|
|
|
**复杂度:** O(1)
|
|
|
|
|
|
2026-03-20 02:35:45 +08:00
|
|
|
## 示例代码
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
RHIPipelineLayoutDesc desc;
|
|
|
|
|
desc.constantBufferCount = 2;
|
|
|
|
|
desc.textureCount = 4;
|
|
|
|
|
desc.samplerCount = 2;
|
|
|
|
|
desc.uavCount = 1;
|
|
|
|
|
|
|
|
|
|
if (pipelineLayout->Initialize(desc)) {
|
|
|
|
|
// 初始化成功,可以继续使用
|
|
|
|
|
} else {
|
|
|
|
|
// 初始化失败,处理错误
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-19 00:31:14 +08:00
|
|
|
## 相关文档
|
|
|
|
|
|
|
|
|
|
- [RHIPipelineLayout 总览](pipeline-layout.md) - 返回类总览
|