Add GPU syncs between potential moves across different queues

This commit is contained in:
baldurk committed 2023-05-18 17:27:18 +01:00
1 parent d57a7c9979
commit e33629cac8
4 files changed
+20

No files matched your search

+2
View File
@@ -1460,6 +1460,8 @@ void D3D12DebugManager::GetBufferData(ID3D12Resource *buffer, uint64_t offset, u
if(buffer == NULL) if(buffer == NULL)
return; return;
m_pDevice->GPUSyncAllQueues();
D3D12_RESOURCE_DESC desc = buffer->GetDesc(); D3D12_RESOURCE_DESC desc = buffer->GetDesc();
D3D12_HEAP_PROPERTIES heapProps = {}; D3D12_HEAP_PROPERTIES heapProps = {};
// can't call GetHeapProperties on sparse resources // can't call GetHeapProperties on sparse resources
+9
View File
@@ -3766,14 +3766,21 @@ void WrappedID3D12Device::GPUSync(ID3D12CommandQueue *queue, ID3D12Fence *fence)
void WrappedID3D12Device::GPUSyncAllQueues() void WrappedID3D12Device::GPUSyncAllQueues()
{ {
if(m_GPUSynced)
return;
for(size_t i = 0; i < m_QueueFences.size(); i++) for(size_t i = 0; i < m_QueueFences.size(); i++)
GPUSync(m_Queues[i], m_QueueFences[i]); GPUSync(m_Queues[i], m_QueueFences[i]);
m_GPUSynced = true;
} }
ID3D12GraphicsCommandListX *WrappedID3D12Device::GetNewList() ID3D12GraphicsCommandListX *WrappedID3D12Device::GetNewList()
{ {
ID3D12GraphicsCommandListX *ret = NULL; ID3D12GraphicsCommandListX *ret = NULL;
m_GPUSynced = false;
if(!m_InternalCmds.freecmds.empty()) if(!m_InternalCmds.freecmds.empty())
{ {
ret = m_InternalCmds.freecmds.back(); ret = m_InternalCmds.freecmds.back();
@@ -4444,6 +4451,8 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
{ {
bool partial = true; bool partial = true;
m_GPUSynced = false;
if(startEventID == 0 && (replayType == eReplay_WithoutDraw || replayType == eReplay_Full)) if(startEventID == 0 && (replayType == eReplay_WithoutDraw || replayType == eReplay_Full))
{ {
startEventID = 1; startEventID = 1;
+3
View File
@@ -591,6 +591,9 @@ private:
rdcarray<WrappedID3D12CommandQueue *> m_Queues; rdcarray<WrappedID3D12CommandQueue *> m_Queues;
rdcarray<ID3D12Fence *> m_QueueFences; rdcarray<ID3D12Fence *> m_QueueFences;
// if we've called GPUSyncAllQueues since the last replay
bool m_GPUSynced = false;
// list of queues and buffers kept alive during capture artificially even if the user destroys // list of queues and buffers kept alive during capture artificially even if the user destroys
// them, so we can use them in the capture. Storing this separately prevents races where a // them, so we can use them in the capture. Storing this separately prevents races where a
// queue/buffer is added between us transitioning away from active capturing (so we don't addref // queue/buffer is added between us transitioning away from active capturing (so we don't addref
+6
View File
@@ -301,7 +301,11 @@ void D3D12Replay::ReplayLog(uint32_t endEventID, ReplayLogType replayType)
if(replayed) if(replayed)
return; return;
} }
m_pDevice->ReplayLog(0, endEventID, replayType); m_pDevice->ReplayLog(0, endEventID, replayType);
if(replayType == eReplay_WithoutDraw)
m_pDevice->GPUSyncAllQueues();
} }
SDFile *D3D12Replay::GetStructuredFile() SDFile *D3D12Replay::GetStructuredFile()
@@ -3521,6 +3525,8 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub,
bool wasms = false; bool wasms = false;
bool resolve = params.resolve; bool resolve = params.resolve;
m_pDevice->GPUSyncAllQueues();
ID3D12Resource *resource = NULL; ID3D12Resource *resource = NULL;
{ {