Add GPU syncs between potential moves across different queues

This commit is contained in:
baldurk
2023-05-18 17:27:18 +01:00
parent d57a7c9979
commit e33629cac8
4 changed files with 20 additions and 0 deletions
+2
View File
@@ -1460,6 +1460,8 @@ void D3D12DebugManager::GetBufferData(ID3D12Resource *buffer, uint64_t offset, u
if(buffer == NULL)
return;
m_pDevice->GPUSyncAllQueues();
D3D12_RESOURCE_DESC desc = buffer->GetDesc();
D3D12_HEAP_PROPERTIES heapProps = {};
// can't call GetHeapProperties on sparse resources
+9
View File
@@ -3766,14 +3766,21 @@ void WrappedID3D12Device::GPUSync(ID3D12CommandQueue *queue, ID3D12Fence *fence)
void WrappedID3D12Device::GPUSyncAllQueues()
{
if(m_GPUSynced)
return;
for(size_t i = 0; i < m_QueueFences.size(); i++)
GPUSync(m_Queues[i], m_QueueFences[i]);
m_GPUSynced = true;
}
ID3D12GraphicsCommandListX *WrappedID3D12Device::GetNewList()
{
ID3D12GraphicsCommandListX *ret = NULL;
m_GPUSynced = false;
if(!m_InternalCmds.freecmds.empty())
{
ret = m_InternalCmds.freecmds.back();
@@ -4444,6 +4451,8 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
{
bool partial = true;
m_GPUSynced = false;
if(startEventID == 0 && (replayType == eReplay_WithoutDraw || replayType == eReplay_Full))
{
startEventID = 1;
+3
View File
@@ -591,6 +591,9 @@ private:
rdcarray<WrappedID3D12CommandQueue *> m_Queues;
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
// 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
+6
View File
@@ -301,7 +301,11 @@ void D3D12Replay::ReplayLog(uint32_t endEventID, ReplayLogType replayType)
if(replayed)
return;
}
m_pDevice->ReplayLog(0, endEventID, replayType);
if(replayType == eReplay_WithoutDraw)
m_pDevice->GPUSyncAllQueues();
}
SDFile *D3D12Replay::GetStructuredFile()
@@ -3521,6 +3525,8 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub,
bool wasms = false;
bool resolve = params.resolve;
m_pDevice->GPUSyncAllQueues();
ID3D12Resource *resource = NULL;
{