From 5ad608809c9028da9f5c5082397cb6afe9c8dd17 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 12 Nov 2026 16:15:50 +0000 Subject: [PATCH] Share D3D12 Loading & Replay code per API: CommandList9 APIs - Serialise_RSSetDepthBias - Serialise_IASetIndexBufferStripCutValue --- .../driver/d3d12/d3d12_command_list9_wrap.cpp | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp index ed9718141..b1f4b9009 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list9_wrap.cpp @@ -50,24 +50,18 @@ bool WrappedID3D12GraphicsCommandList::Serialise_RSSetDepthBias(SerialiserType & bool stateUpdate = false; - if(IsActiveReplaying(m_State)) + if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) - { - Unwrap9(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID)) - ->RSSetDepthBias(DepthBias, DepthBiasClamp, SlopeScaledDepthBias); + 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; - } + Unwrap9(list)->RSSetDepthBias(DepthBias, DepthBiasClamp, SlopeScaledDepthBias); + + stateUpdate = true; } - else + else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) { - Unwrap9(pCommandList)->RSSetDepthBias(DepthBias, DepthBiasClamp, SlopeScaledDepthBias); - stateUpdate = true; } @@ -122,24 +116,18 @@ bool WrappedID3D12GraphicsCommandList::Serialise_IASetIndexBufferStripCutValue( bool stateUpdate = false; - if(IsActiveReplaying(m_State)) + if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) - { - Unwrap9(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID)) - ->IASetIndexBufferStripCutValue(IBStripCutValue); + 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; - } + Unwrap9(list)->IASetIndexBufferStripCutValue(IBStripCutValue); + + stateUpdate = true; } - else + else if(!m_Cmd->IsPartialCmdList(m_Cmd->m_LastCmdListID)) { - Unwrap9(pCommandList)->IASetIndexBufferStripCutValue(IBStripCutValue); - stateUpdate = true; }