Skip to content

Commit

Permalink
Don't crash on new barriers when mid-command buffer state fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed Oct 2, 2023
1 parent b835a4c commit 5afd960
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions renderdoc/driver/d3d12/d3d12_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,12 @@ void D3D12ResourceManager::ApplyBarriers(BarrierSet &barriers,
{
const D3D12_RESOURCE_TRANSITION_BARRIER &trans = barriers.barriers[b].Transition;
ResourceId id = GetResID(trans.pResource);
SubresourceStateVector &st = states[id];

auto it = states.find(id);
if(it == states.end())
return;

SubresourceStateVector &st = it->second;

// skip non-transitions, or begin-halves of transitions
if(barriers.barriers[b].Type != D3D12_RESOURCE_BARRIER_TYPE_TRANSITION ||
Expand Down Expand Up @@ -718,7 +723,12 @@ void D3D12ResourceManager::ApplyBarriers(BarrierSet &barriers,
{
const D3D12_TEXTURE_BARRIER &trans = barriers.newBarriers[b];
ResourceId id = GetResID(trans.pResource);
SubresourceStateVector &st = states[id];

auto it = states.find(id);
if(it == states.end())
return;

SubresourceStateVector &st = it->second;

// skip begin-halves of split transitions
if(trans.SyncBefore == D3D12_BARRIER_SYNC_SPLIT)
Expand Down

0 comments on commit 5afd960

Please sign in to comment.