From ccd637e84feffc88dcbe4a08535de06766758375 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 12 Nov 2026 16:12:10 +0000 Subject: [PATCH] Share D3D12 Loading & Replay code per API: CommandList5 APIs - Serialise_RSSetShadingRate - Serialise_RSSetShadingRateImage --- .../driver/d3d12/d3d12_command_list5_wrap.cpp | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list5_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list5_wrap.cpp index 9bafc58ad..ff20042cb 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list5_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list5_wrap.cpp @@ -69,24 +69,18 @@ bool WrappedID3D12GraphicsCommandList::Serialise_RSSetShadingRate( bool stateUpdate = false; - if(IsActiveReplaying(m_State)) + if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) - { - Unwrap5(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID)) - ->RSSetShadingRate(baseShadingRate, combiners); + bool loading = IsLoading(m_State); + ID3D12GraphicsCommandListX *list = !loading ? m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID) + : (ID3D12GraphicsCommandListX *)pCommandList; - stateUpdate = true; - } - else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) - { - stateUpdate = true; - } + Unwrap5(list)->RSSetShadingRate(baseShadingRate, combiners); + + stateUpdate = true; } - else + else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) { - Unwrap5(pCommandList)->RSSetShadingRate(baseShadingRate, combiners); - stateUpdate = true; } @@ -163,24 +157,18 @@ bool WrappedID3D12GraphicsCommandList::Serialise_RSSetShadingRateImage(Serialise bool stateUpdate = false; - if(IsActiveReplaying(m_State)) + if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) - { - Unwrap5(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID)) - ->RSSetShadingRateImage(Unwrap(shadingRateImage)); + bool loading = IsLoading(m_State); + ID3D12GraphicsCommandListX *list = !loading ? m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID) + : (ID3D12GraphicsCommandListX *)pCommandList; - stateUpdate = true; - } - else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) - { - stateUpdate = true; - } + Unwrap5(list)->RSSetShadingRateImage(Unwrap(shadingRateImage)); + + stateUpdate = true; } - else + else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) { - Unwrap5(pCommandList)->RSSetShadingRateImage(Unwrap(shadingRateImage)); - stateUpdate = true; }