diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 825ba3abf..bb1226d29 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -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); diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index e2d527d54..47a676487 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -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(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(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(rs.pipe);