Signal dummy fences on all queues to keep debug layers happy

This commit is contained in:
baldurk
2016-10-26 20:39:37 +02:00
parent 2f2da067b0
commit a69012e50d
3 changed files with 20 additions and 0 deletions
+11
View File
@@ -325,6 +325,9 @@ WrappedID3D12Device::~WrappedID3D12Device()
{
RenderDoc::Inst().RemoveDeviceFrameCapturer((ID3D12Device *)this);
for(size_t i = 0; i < m_QueueFences.size(); i++)
SAFE_RELEASE(m_QueueFences[i]);
DestroyInternalResources();
if(m_DeviceRecord)
@@ -2121,6 +2124,14 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
{
startEventID = m_FrameRecord.frameInfo.firstEvent;
partial = false;
m_GPUSyncCounter++;
// I'm not sure the reason for this, but the debug layer warns about being unable to resubmit
// command lists due to the 'previous queue fence' not being ready yet, even if no fences are
// signalled or waited. So instead we just signal a dummy fence each new 'frame'
for(size_t i = 0; i < m_Queues.size(); i++)
m_Queues[i]->Signal(m_QueueFences[i], m_GPUSyncCounter);
}
D3D12ChunkType header = (D3D12ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false);
+1
View File
@@ -226,6 +226,7 @@ private:
// list of all queues being captured
std::vector<WrappedID3D12CommandQueue *> m_Queues;
std::vector<ID3D12Fence *> m_QueueFences;
// the queue we use for all internal work, the first DIRECT queue
WrappedID3D12CommandQueue *m_Queue;
@@ -67,6 +67,14 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue(Serialiser *localSerialis
}
m_Queues.push_back(wrapped);
// create a dummy (dummy) fence
ID3D12Fence *fence = NULL;
hr = this->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), (void **)&fence);
RDCASSERTEQUAL(hr, S_OK);
m_QueueFences.push_back(fence);
}
}