Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions MiniEngine/Core/CommandListManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ void CommandQueue::Shutdown()

m_AllocatorPool.Shutdown();

CloseHandle(m_FenceEventHandle);

m_pFence->Release();
m_pFence = nullptr;

Expand Down Expand Up @@ -81,9 +79,6 @@ void CommandQueue::Create(ID3D12Device* pDevice)
m_pFence->SetName(L"CommandListManager::m_pFence");
m_pFence->Signal((uint64_t)m_Type << 56);

m_FenceEventHandle = CreateEvent(nullptr, false, false, nullptr);
ASSERT(m_FenceEventHandle != NULL);

m_AllocatorPool.Create(pDevice);

ASSERT(IsReady());
Expand Down Expand Up @@ -171,17 +166,8 @@ void CommandQueue::WaitForFence(uint64_t FenceValue)
if (IsFenceComplete(FenceValue))
return;

// TODO: Think about how this might affect a multi-threaded situation. Suppose thread A
// wants to wait for fence 100, then thread B comes along and wants to wait for 99. If
// the fence can only have one event set on completion, then thread B has to wait for
// 100 before it knows 99 is ready. Maybe insert sequential events?
{
std::lock_guard<std::mutex> LockGuard(m_EventMutex);

m_pFence->SetEventOnCompletion(FenceValue, m_FenceEventHandle);
WaitForSingleObject(m_FenceEventHandle, INFINITE);
m_LastCompletedFenceValue = FenceValue;
}
m_pFence->SetEventOnCompletion(FenceValue, NULL);
m_LastCompletedFenceValue = FenceValue;
}

void CommandListManager::WaitForFence(uint64_t FenceValue)
Expand Down
1 change: 0 additions & 1 deletion MiniEngine/Core/CommandListManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class CommandQueue
ID3D12Fence* m_pFence;
uint64_t m_NextFenceValue;
uint64_t m_LastCompletedFenceValue;
HANDLE m_FenceEventHandle;

};

Expand Down