docs: update RHI API docs
This commit is contained in:
39
docs/api/rhi/d3d12/common/create-transition-barrier.md
Normal file
39
docs/api/rhi/d3d12/common/create-transition-barrier.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# D3D12Common::CreateTransitionBarrier
|
||||
|
||||
```cpp
|
||||
inline D3D12_RESOURCE_BARRIER CreateTransitionBarrier(
|
||||
ID3D12Resource* resource,
|
||||
D3D12_RESOURCE_STATES stateBefore,
|
||||
D3D12_RESOURCE_STATES stateAfter,
|
||||
UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES
|
||||
)
|
||||
```
|
||||
|
||||
创建资源状态转换屏障,用于同步资源状态转换。
|
||||
|
||||
**参数:**
|
||||
- `resource` - 目标资源指针
|
||||
- `stateBefore` - 转换前的资源状态
|
||||
- `stateAfter` - 转换后的资源状态
|
||||
- `subresource` - 子资源索引,默认为所有子资源
|
||||
|
||||
**返回:** 配置好的 `D3D12_RESOURCE_BARRIER` 结构
|
||||
|
||||
**线程安全:** ✅(纯函数)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
ID3D12Resource* texture = ...;
|
||||
D3D12_RESOURCE_BARRIER barrier = CreateTransitionBarrier(
|
||||
texture,
|
||||
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||
D3D12_RESOURCE_STATE_COMMON
|
||||
);
|
||||
cmdList->ResourceBarrier(1, &barrier);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12Common 总览](common.md)
|
||||
- [D3D12CommandList](../command-list/command-list.md)
|
||||
Reference in New Issue
Block a user