Files
XCEngine/docs/api/rhi/buffer/get-state.md

27 lines
523 B
Markdown
Raw Normal View History

# RHIBuffer::GetState
```cpp
virtual ResourceStates GetState() const = 0;
```
2026-03-20 02:35:45 +08:00
获取缓冲区当前所处的资源状态。资源状态决定缓冲区可以用于哪些 GPU 操作。
2026-03-20 02:35:45 +08:00
**返回:** `ResourceStates` 枚举值
**线程安全:** ✅
**复杂度:** O(1)
2026-03-20 02:35:45 +08:00
**示例:**
```cpp
ResourceStates state = buffer->GetState();
if (state == ResourceStates::VertexAndConstantBuffer) {
printf("Buffer is ready for vertex binding\n");
}
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览