Files
XCSDD/docs/api/rhi/swap-chain/swap-chain.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

44 lines
1.4 KiB
Markdown

# RHISwapChain
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 交换链抽象接口,用于管理窗口渲染和帧缓冲区切换。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
| [`GetCurrentBackBufferIndex`](get-current-back-buffer-index.md) | 获取当前后台缓冲区索引 |
| [`GetCurrentBackBuffer`](get-current-back-buffer.md) | 获取当前后台缓冲区 |
| [`Present`](present.md) | 呈现画面 |
| [`Resize`](resize.md) | 调整交换链大小 |
| [`SetFullscreen`](set-fullscreen.md) | 设置全屏模式 |
| [`IsFullscreen`](is-fullscreen.md) | 检查是否全屏 |
| [`ShouldClose`](should-close.md) | 检查是否应关闭 |
| [`SetShouldClose`](set-should-close.md) | 设置关闭标志 |
| [`PollEvents`](poll-events.md) | 处理窗口事件 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
## 使用示例
```cpp
while (!swapChain->ShouldClose()) {
swapChain->PollEvents();
RHITexture* backBuffer = swapChain->GetCurrentBackBuffer();
commandList->Reset();
commandList->SetRenderTargets(1, &backBuffer, nullptr);
commandList->ClearRenderTarget(backBuffer, clearColor);
commandList->Close();
commandQueue->ExecuteCommandLists(1, (void**)&commandList);
swapChain->Present(1, 0);
}
```
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [RHITexture](../texture/texture.md) - 纹理资源