49 lines
1.0 KiB
Markdown
49 lines
1.0 KiB
Markdown
# D3D12PipelineState::Initialize
|
|
|
|
## 函数签名
|
|
|
|
```cpp
|
|
bool Initialize(ID3D12Device* device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC& desc)
|
|
```
|
|
|
|
## 中文描述
|
|
|
|
初始化 D3D12 图形管线状态对象。根据提供的管线状态描述符创建 DirectX 12 管线状态对象。
|
|
|
|
## 参数
|
|
|
|
| 参数 | 类型 | 描述 |
|
|
|------|------|------|
|
|
| `device` | `ID3D12Device*` | D3D12 设备指针 |
|
|
| `desc` | `D3D12_GRAPHICS_PIPELINE_STATE_DESC` | 图形管线状态描述符 |
|
|
|
|
## 返回值
|
|
|
|
`bool` - 初始化成功返回 `true`,失败返回 `false`
|
|
|
|
## 复杂度
|
|
|
|
O(1)
|
|
|
|
## 示例
|
|
|
|
```cpp
|
|
D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = D3D12PipelineState::CreateDesc(
|
|
rootSignature,
|
|
vsBytecode,
|
|
psBytecode,
|
|
gsBytecode,
|
|
inputElementCount,
|
|
inputElements);
|
|
|
|
D3D12PipelineState pipelineState;
|
|
if (!pipelineState.Initialize(device, psoDesc)) {
|
|
// 处理初始化失败
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [D3D12PipelineState](pipeline-state.md) - 类总览
|
|
- [D3D12PipelineState::CreateDesc](create-desc.md) - 创建管线描述符
|