Files
XCEngine/docs/api/d3d12/d3d12-swap-chain-initialize.md

37 lines
854 B
Markdown
Raw Normal View History

# D3D12SwapChain::Initialize
初始化 D3D12SwapChain 交换链。
## 重载 1: 从头创建
```cpp
bool Initialize(IDXGIFactory4* factory, ID3D12CommandQueue* commandQueue, HWND windowHandle, uint32_t width, uint32_t height, uint32_t bufferCount = 2);
```
**参数:**
- `factory` - DXGI 工厂指针
- `commandQueue` - 命令队列指针
- `windowHandle` - 窗口句柄
- `width` - 宽度
- `height` - 高度
- `bufferCount` - 缓冲数量,默认为 2
**返回:** `bool` - 初始化成功返回 true
## 重载 2: 从现有交换链创建
```cpp
bool Initialize(IDXGISwapChain* swapChain, uint32_t width, uint32_t height);
```
**参数:**
- `swapChain` - 现有 DXGI 交换链指针
- `width` - 宽度
- `height` - 高度
**返回:** `bool` - 初始化成功返回 true
## 相关文档
- [D3D12SwapChain 总览](d3d12-swap-chain.md)