Files
XCEngine/docs/api/rhi/command-list/set-index-buffer.md
2026-03-20 02:35:45 +08:00

32 lines
803 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.
# RHICommandList::SetIndexBuffer
```cpp
virtual void SetIndexBuffer(void* buffer, uint64_t offset, Format format) = 0;
```
绑定索引缓冲区。索引缓冲区存储顶点索引,用于 `DrawIndexed` 调用,从顶点缓冲区中选择顶点组成图元。
**参数:**
- `buffer` - 索引缓冲区指针
- `offset` - 缓冲区内的起始偏移量(字节)
- `format` - 索引格式Format::R16_UINT 或 Format::R32_UINT
**返回:** `void`
**异常:**
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
cmdList->SetIndexBuffer(indexBuffer, 0, Format::R16_UINT);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览
- [DrawIndexed](draw-indexed.md) - 索引绘制
- [SetVertexBuffer](set-vertex-buffer.md) - 设置顶点缓冲