Files
XCEngine/docs/api/rhi/d3d12/common/create-index-buffer-view.md
2026-03-20 02:35:45 +08:00

38 lines
876 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# D3D12Common::CreateIndexBufferView
```cpp
inline D3D12_INDEX_BUFFER_VIEW CreateIndexBufferView(
D3D12_GPU_VIRTUAL_ADDRESS bufferLocation,
UINT sizeInBytes,
DXGI_FORMAT format
)
```
创建索引缓冲区视图。
**参数:**
- `bufferLocation` - 索引缓冲区 GPU 虚拟地址
- `sizeInBytes` - 缓冲区大小(字节)
- `format` - 索引格式DXGI_FORMAT_R16_UINT 或 DXGI_FORMAT_R32_UINT
**返回:** 配置好的 `D3D12_INDEX_BUFFER_VIEW` 结构
**线程安全:** ✅(纯函数)
**示例:**
```cpp
ID3D12Resource* indexBuffer = ...;
D3D12_INDEX_BUFFER_VIEW ibView = CreateIndexBufferView(
indexBuffer->GetGPUVirtualAddress(),
indexBufferSize,
DXGI_FORMAT_R16_UINT
);
cmdList->IASetIndexBuffer(&ibView);
```
## 相关文档
- [D3D12Common 总览](common.md)
- [CreateVertexBufferView](create-vertex-buffer-view.md)