mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-01 12:20:56 +00:00
Work around D3D12 confusion where feature can be unsupported but used
* Even if new barriers aren't supported, it's still possible to use the creation function and create them in any of the new layouts. In this case we can't use new barriers to transition them out of that state so we have to pretend they've already been moved out.
This commit is contained in:
@@ -1473,11 +1473,29 @@ void D3D12ResourceManager::SerialiseResourceStates(
|
||||
|
||||
for(size_t m = 0; m < States.size(); m++)
|
||||
{
|
||||
const D3D12ResourceLayout srcState = states[liveid][m];
|
||||
const D3D12ResourceLayout dstState = States[m];
|
||||
D3D12ResourceLayout srcState = states[liveid][m];
|
||||
D3D12ResourceLayout dstState = States[m];
|
||||
|
||||
// because of some extreme ugliness on the D3D12 side, resources can be created in new
|
||||
// layouts without the new barriers actually being supported. If that's the case, we just
|
||||
// pretend they're in old COMMON to avoid doing the new barrier
|
||||
if(!m_Device->GetOpts12().EnhancedBarriersSupported && srcState.IsLayout())
|
||||
{
|
||||
RDCASSERT(srcState.ToLayout() == D3D12_BARRIER_LAYOUT_COMMON, srcState.ToLayout());
|
||||
srcState = D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_COMMON);
|
||||
}
|
||||
|
||||
if(!m_Device->GetOpts12().EnhancedBarriersSupported && dstState.IsLayout())
|
||||
{
|
||||
RDCASSERT(dstState.ToLayout() == D3D12_BARRIER_LAYOUT_COMMON, dstState.ToLayout());
|
||||
dstState = D3D12ResourceLayout::FromStates(D3D12_RESOURCE_STATE_COMMON);
|
||||
}
|
||||
|
||||
if(srcState != dstState)
|
||||
{
|
||||
AddStateResetBarrier(srcState, dstState, (ID3D12Resource *)GetCurrentResource(liveid),
|
||||
(UINT)m, barriers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user