From 42ffc71a0d1d678fef53d91dcab5612ae13dae73 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 20 May 2026 09:51:18 +0100 Subject: [PATCH] Fix D3D12 EI event skipping when at an event inside the outer EI action The curEID might not be the same as baseEventID. This could skip later events which should be replayed, if for example doing multiple partial replays. Fixes device lost triggered when using TriangleSize (Pass) overlay. --- renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 78a9af8fc..277363f22 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -4311,6 +4311,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( if(IsActiveReplaying(m_State)) { uint32_t actualCount = MaxCommandCount; + uint32_t countEventsReplayed = actualCount * comSig->sig.arguments.count(); if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { @@ -4332,6 +4333,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( D3D12CommandData::ActionUse use(m_Cmd->m_CurChunkOffset, 0); auto it = std::lower_bound(m_Cmd->m_ActionUses.begin(), m_Cmd->m_ActionUses.end(), use); + // baseEventID is the EI action EID uint32_t baseEventID = it->eventId; { @@ -4348,6 +4350,10 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( RDCMIN(m_Cmd->m_LastEventID - baseEventID, actualCount * comSig->sig.arguments.count()); uint32_t executesReplayed = argumentsReplayed / comSig->sig.arguments.count(); + // executesReplayed is relative to baseEventID + // compute the number of events to skip relative to the curEID + countEventsReplayed = (baseEventID + argumentsReplayed) - curEID; + BarrierSet barriers; barriers.Configure(pArgumentBuffer, cmdInfo.GetState(m_pDevice, GetResID(pArgumentBuffer)), @@ -4551,11 +4557,11 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect( } // executes skip the event ID past the whole thing - uint32_t numEvents = actualCount * (uint32_t)comSig->sig.arguments.size() + 1; + ++countEventsReplayed; if(m_Cmd->m_FirstEventID > 1) - m_Cmd->m_RootEventID += numEvents; + m_Cmd->m_RootEventID += countEventsReplayed; else - m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].curEventID += numEvents; + cmdInfo.curEventID += countEventsReplayed; } else {