Skip to content

Commit 30daa38

Browse files
committed
Fix incorrect resetting of buffers if created with new-barrier functions
1 parent 39ecded commit 30daa38

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

renderdoc/driver/d3d12/d3d12_manager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,7 +3766,7 @@ void AddStateResetBarrier(D3D12ResourceLayout srcState, D3D12ResourceLayout dstS
37663766
ID3D12Resource *res, UINT subresource, BarrierSet &barriers)
37673767
{
37683768
if((srcState.IsStates() || srcState.ToLayout() == D3D12_BARRIER_LAYOUT_UNDEFINED) &&
3769-
dstState.IsStates())
3769+
(dstState.IsStates() || dstState.ToLayout() == D3D12_BARRIER_LAYOUT_UNDEFINED))
37703770
{
37713771
D3D12_RESOURCE_BARRIER b;
37723772
b.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
@@ -3779,7 +3779,10 @@ void AddStateResetBarrier(D3D12ResourceLayout srcState, D3D12ResourceLayout dstS
37793779
if(srcState.ToLayout() == D3D12_BARRIER_LAYOUT_UNDEFINED)
37803780
b.Transition.StateBefore = D3D12_RESOURCE_STATE_COMMON;
37813781

3782-
// could now be identical after silently promoting the before state.
3782+
if(dstState.ToLayout() == D3D12_BARRIER_LAYOUT_UNDEFINED)
3783+
b.Transition.StateAfter = D3D12_RESOURCE_STATE_COMMON;
3784+
3785+
// could now be identical after silently promoting the before/after state.
37833786
if(b.Transition.StateBefore != b.Transition.StateAfter)
37843787
barriers.barriers.push_back(b);
37853788
}

0 commit comments

Comments
 (0)