You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the CommandListManager.cpp there is a TODO that mentions a small optimization regarding sequential events
// 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?
I think I have a solution in mind using std::unordered_map<uint64_t, HANDLE> m_FenceEventMap;
We should be able to remove the m_FenceEventHandle and manage a hashmap with respect to the fence value.
And in CommandQueue::WaitForFence() creating an event will be handled like so
// Create an event for the specified fence value if it doesn't existif (m_FenceEventMap.find(FenceValue) == m_FenceEventMap.end()) {
// Create a new event for the fence value
HANDLE newEventHandle = CreateEvent(nullptr, false, false, nullptr);
ASSERT(newEventHandle != NULL);
m_FenceEventMap[FenceValue] = newEventHandle;
}
// Wait on the event associated with the specified fence value
HANDLE eventHandle = m_FenceEventMap[FenceValue];
m_pFence->SetEventOnCompletion(FenceValue, eventHandle);
WaitForSingleObject(eventHandle, INFINITE);
// Update the last completed fence value
m_LastCompletedFenceValue = FenceValue;
I can raise a PR with the change implemented, but I think this needs to be discussed before.
The text was updated successfully, but these errors were encountered:
In the CommandListManager.cpp there is a TODO that mentions a small optimization regarding sequential events
I think I have a solution in mind using
std::unordered_map<uint64_t, HANDLE> m_FenceEventMap;
We should be able to remove the
m_FenceEventHandle
and manage a hashmap with respect to the fence value.And in
CommandQueue::WaitForFence()
creating an event will be handled like soI can raise a PR with the change implemented, but I think this needs to be discussed before.
The text was updated successfully, but these errors were encountered: