Skip to content

Commit 0a790cb

Browse files
committed
D3D12 Pixel History GPU sync all queues not just the active queue
Delete pOcclusionQueryHeap after fetching the results from it instead of at the end of pixel history function
1 parent 16c4407 commit 0a790cb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

renderdoc/driver/d3d12/d3d12_pixelhistory.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,8 @@ struct D3D12OcclusionCallback : public D3D12PixelHistoryCallback
896896
list->Close();
897897

898898
m_pDevice->ExecuteLists();
899-
m_pDevice->FlushLists();
899+
m_pDevice->FlushLists(true);
900+
m_pDevice->GPUSyncAllQueues();
900901

901902
D3D12_RANGE range;
902903
range.Begin = 0;
@@ -1486,7 +1487,8 @@ struct D3D12TestsFailedCallback : public D3D12PixelHistoryCallback
14861487
list->Close();
14871488

14881489
m_pDevice->ExecuteLists();
1489-
m_pDevice->FlushLists();
1490+
m_pDevice->FlushLists(true);
1491+
m_pDevice->GPUSyncAllQueues();
14901492

14911493
D3D12_RANGE range;
14921494
range.Begin = 0;
@@ -2530,7 +2532,8 @@ struct D3D12PixelHistoryDiscardedFragmentsCallback : D3D12PixelHistoryCallback
25302532
list->Close();
25312533

25322534
m_pDevice->ExecuteLists();
2533-
m_pDevice->FlushLists();
2535+
m_pDevice->FlushLists(true);
2536+
m_pDevice->GPUSyncAllQueues();
25342537

25352538
D3D12_RANGE range;
25362539
range.Begin = 0;
@@ -2848,7 +2851,9 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
28482851
D3D12MarkerRegion occlRegion(m_pDevice->GetQueue()->GetReal(), "D3D12OcclusionCallback");
28492852
m_pDevice->ReplayLog(0, events.back().eventId, eReplay_Full);
28502853
m_pDevice->FlushLists(true);
2854+
m_pDevice->GPUSyncAllQueues();
28512855
occlCb.FetchOcclusionResults();
2856+
SAFE_RELEASE(pOcclusionQueryHeap);
28522857
}
28532858

28542859
// Gather all draw events that could have written to pixel for another replay pass,
@@ -2894,6 +2899,7 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
28942899
"D3D12ColorAndStencilCallback");
28952900
m_pDevice->ReplayLog(0, events.back().eventId, eReplay_Full);
28962901
m_pDevice->FlushLists(true);
2902+
m_pDevice->GPUSyncAllQueues();
28972903
}
28982904

28992905
// If there are any draw events, do another replay pass, in order to figure
@@ -2907,7 +2913,6 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
29072913
if(!CreateOcclusionPool(m_pDevice, (uint32_t)drawEvents.size() * 6, &pTfOcclusionQueryHeap))
29082914
{
29092915
GetDebugManager()->PixelHistoryDestroyResources(resources);
2910-
SAFE_RELEASE(pOcclusionQueryHeap);
29112916
SAFE_DELETE(shaderCache);
29122917
return history;
29132918
}
@@ -2916,6 +2921,7 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
29162921
drawEvents);
29172922
m_pDevice->ReplayLog(0, events.back().eventId, eReplay_Full);
29182923
m_pDevice->FlushLists(true);
2924+
m_pDevice->GPUSyncAllQueues();
29192925
tfCb->FetchOcclusionResults();
29202926
SAFE_RELEASE(pTfOcclusionQueryHeap);
29212927
}
@@ -3054,6 +3060,7 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
30543060
"D3D12PixelHistoryPerFragmentCallback");
30553061
m_pDevice->ReplayLog(0, eventsWithFrags.rbegin()->first, eReplay_Full);
30563062
m_pDevice->FlushLists(true);
3063+
m_pDevice->GPUSyncAllQueues();
30573064
}
30583065

30593066
bytebuf fragData;
@@ -3089,7 +3096,6 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
30893096
if(!CreateOcclusionPool(m_pDevice, primitivesToCheck, &pDiscardedFragsOcclusionQueryHeap))
30903097
{
30913098
GetDebugManager()->PixelHistoryDestroyResources(resources);
3092-
SAFE_RELEASE(pOcclusionQueryHeap);
30933099
SAFE_DELETE(shaderCache);
30943100
return history;
30953101
}
@@ -3100,6 +3106,7 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
31003106

31013107
m_pDevice->ReplayLog(0, events.back().eventId, eReplay_Full);
31023108
m_pDevice->FlushLists(true);
3109+
m_pDevice->GPUSyncAllQueues();
31033110
discardedCb.FetchOcclusionResults();
31043111
SAFE_RELEASE(pDiscardedFragsOcclusionQueryHeap);
31053112

@@ -3216,8 +3223,6 @@ rdcarray<PixelModification> D3D12Replay::PixelHistory(rdcarray<EventUsage> event
32163223

32173224
SAFE_DELETE(tfCb);
32183225

3219-
SAFE_RELEASE(pOcclusionQueryHeap);
3220-
32213226
GetDebugManager()->PixelHistoryDestroyResources(resources);
32223227
SAFE_DELETE(shaderCache);
32233228

0 commit comments

Comments
 (0)