From 7703f5e3b77ad392f4ae6cf5780eb667dd605692 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 12 Nov 2026 16:07:33 +0000 Subject: [PATCH] Share D3D12 Loading & Replay code per API: CommandList2 APIs - Serialise_WriteBufferImmediate --- .../driver/d3d12/d3d12_command_list2_wrap.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp index d1736b4a3..5e2f64f1e 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp @@ -48,17 +48,13 @@ bool WrappedID3D12GraphicsCommandList::Serialise_WriteBufferImmediate( m_Cmd->m_LastCmdListID = GetResID(pCommandList); - if(IsActiveReplaying(m_State)) + if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) - { - Unwrap2(m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID)) - ->WriteBufferImmediate(Count, pParams, pModes); - } - } - else - { - Unwrap2(pCommandList)->WriteBufferImmediate(Count, pParams, pModes); + bool loading = IsLoading(m_State); + ID3D12GraphicsCommandListX *list = !loading ? m_Cmd->RerecordCmdList(m_Cmd->m_LastCmdListID) + : (ID3D12GraphicsCommandListX *)pCommandList; + + Unwrap2(list)->WriteBufferImmediate(Count, pParams, pModes); } }