Make sure to properly reset per-command list state so we don't leak

This commit is contained in:
baldurk
2020-07-15 12:15:07 +01:00
parent f70d397d0e
commit 67df704f5a
2 changed files with 12 additions and 8 deletions
@@ -287,6 +287,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
D3D12RenderState &state = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state;
state = D3D12RenderState();
state.m_ResourceManager = GetResourceManager();
state.m_DebugManager = m_pDevice->GetDebugManager();
state.pipe = GetResID(pInitialState);
// whenever a command-building chunk asks for the command list, it
@@ -381,6 +384,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(SerialiserType &ser,
// reset state
D3D12RenderState &state = m_Cmd->m_BakedCmdListInfo[BakedCommandList].state;
state = D3D12RenderState();
state.m_ResourceManager = GetResourceManager();
state.m_DebugManager = m_pDevice->GetDebugManager();
state.pipe = GetResID(pInitialState);
+8 -8
View File
@@ -114,7 +114,7 @@ void D3D12DebugAPIWrapper::AddDebugMessage(MessageCategory c, MessageSeverity sv
bool D3D12DebugAPIWrapper::FetchSRV(const DXBCDebug::BindingSlot &slot)
{
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
// Get the root signature
@@ -255,7 +255,7 @@ bool D3D12DebugAPIWrapper::FetchSRV(const DXBCDebug::BindingSlot &slot)
}
bool D3D12DebugAPIWrapper::FetchUAV(const DXBCDebug::BindingSlot &slot)
{
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
// Get the root signature
@@ -467,7 +467,7 @@ ShaderVariable D3D12DebugAPIWrapper::GetSampleInfo(DXBCBytecode::OperandType typ
{
ShaderVariable result("", 0U, 0U, 0U, 0U);
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
if(type == DXBCBytecode::TYPE_RASTERIZER)
@@ -597,7 +597,7 @@ ShaderVariable D3D12DebugAPIWrapper::GetBufferInfo(DXBCBytecode::OperandType typ
{
ShaderVariable result("", 0U, 0U, 0U, 0U);
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
// Get the root signature
@@ -748,7 +748,7 @@ ShaderVariable D3D12DebugAPIWrapper::GetResourceInfo(DXBCBytecode::OperandType t
{
ShaderVariable result("", 0U, 0U, 0U, 0U);
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
// Get the root signature
@@ -1716,7 +1716,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
dxbc->GetDisassembly();
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
WrappedID3D12PipelineState *pso =
m_pDevice->GetResourceManager()->GetCurrentAs<WrappedID3D12PipelineState>(rs.pipe);
@@ -1769,7 +1769,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
UINT i = *it;
if(rs.vbuffers.size() > i)
{
D3D12RenderState::VertBuffer &vb = rs.vbuffers[i];
const D3D12RenderState::VertBuffer &vb = rs.vbuffers[i];
ID3D12Resource *buffer = m_pDevice->GetResourceManager()->GetCurrentAs<ID3D12Resource>(vb.buf);
if(vb.stride * (draw->vertexOffset + idx) < vb.size)
@@ -2883,7 +2883,7 @@ ShaderDebugTrace *D3D12Replay::DebugThread(uint32_t eventId, const uint32_t grou
dxbc->GetDisassembly();
D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
WrappedID3D12PipelineState *pso =
m_pDevice->GetResourceManager()->GetCurrentAs<WrappedID3D12PipelineState>(rs.pipe);