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

33 lines
835 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::SetVertexBuffer
```cpp
virtual void SetVertexBuffer(uint32_t slot, void* buffer, uint64_t offset, uint32_t stride) = 0;
```
绑定单个顶点缓冲区到指定的槽位。顶点缓冲区包含绘制所需的顶点数据。
**参数:**
- `slot` - 顶点缓冲区槽位索引(范围 0-15
- `buffer` - 顶点缓冲区指针
- `offset` - 缓冲区内的起始偏移量(字节)
- `stride` - 每个顶点的字节大小
**返回:** `void`
**异常:**
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
cmdList->SetVertexBuffer(0, vertexBuffer, 0, sizeof(Vertex));
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览
- [SetVertexBuffers](set-vertex-buffers.md) - 设置多个顶点缓冲
- [SetIndexBuffer](set-index-buffer.md) - 设置索引缓冲