32 lines
803 B
Markdown
32 lines
803 B
Markdown
# 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) - 设置顶点缓冲 |