Files
XCEngine/docs/api/rhi/command-list/set-index-buffer.md

32 lines
803 B
Markdown
Raw Normal View History

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