Add an extra GPU sync between submissions on different queues

* If the application did some CPU side synchronisation that's not
  visible in the capture (unlike a queue Wait() which we replay as a GPU
  sync) then there might be overlap that causes simultaneous use
  problems. So instead we sync between submissions on different queues
  to ensure we don't overlap by accident.
This commit is contained in:
baldurk
2017-06-28 10:54:29 +01:00
parent 29726388f6
commit 78aca86902
2 changed files with 13 additions and 0 deletions
@@ -96,6 +96,7 @@ class WrappedID3D12CommandQueue : public ID3D12CommandQueue,
// command recording/replay data shared between queues and lists
D3D12CommandData m_Cmd;
ResourceId m_PrevQueueId;
ResourceId m_BackbufferID;
void ProcessChunk(uint64_t offset, D3D12ChunkType context);
@@ -143,8 +143,20 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLis
ID3D12CommandQueue *real = NULL;
if(m_State <= EXECUTING)
{
real = Unwrap(GetResourceManager()->GetLiveAs<ID3D12CommandQueue>(queueId));
if(m_PrevQueueId != queueId)
{
RDCDEBUG("Previous queue execution was on queue %llu, now executing %llu, syncing GPU",
m_PrevQueueId, queueId);
if(m_PrevQueueId != ResourceId())
m_pDevice->GPUSync(GetResourceManager()->GetLiveAs<ID3D12CommandQueue>(m_PrevQueueId));
m_PrevQueueId = queueId;
}
}
if(m_State == READING)
{
for(uint32_t i = 0; i < numCmds; i++)