Files
XCEngine/docs/api/rhi/swap-chain/swap-chain.md
ssdfasd a9f882f233 docs: 修正 API 文档准确性 (第二轮检查)
修复的问题:
- math: 修复 Quaternion::Normalize 链接错误
- containers: HashMap 迭代器示例使用不存在的 cbegin/cend,删除冗余构造函数声明
- core: RefCounted 析构函数访问级别修正 (protected)
- debug: LogLevelToString 示例返回值大小写修正
- memory: 修正 LinearAllocator::Reallocate 返回 nullptr,ProxyAllocator 统计描述,头文件路径 IAllocator.h -> Allocator.h
- resources: Texture::Create mipLevels 参数描述修正
- rhi: 修复多处链接错误,新增缺失的方法文档
- threading: TaskSystem 配置项未实现状态标注,Wait 方法空实现标注
2026-03-19 00:31:14 +08:00

66 lines
1.6 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` | [详细文档](methods.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) - 纹理资源