Merge pull request #98975 from clayjohn/D3D12-event-timing

Move D3D12 fence `SetEventOnCompletion` call to `fence_wait` to avoid stalling on some platforms
This commit is contained in:
Thaddeus Crews 2024-11-13 08:33:55 -06:00
commit 150590a7e8
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84

View File

@ -2160,6 +2160,7 @@ RDD::FenceID RenderingDeviceDriverD3D12::fence_create() {
Error RenderingDeviceDriverD3D12::fence_wait(FenceID p_fence) { Error RenderingDeviceDriverD3D12::fence_wait(FenceID p_fence) {
FenceInfo *fence = (FenceInfo *)(p_fence.id); FenceInfo *fence = (FenceInfo *)(p_fence.id);
fence->d3d_fence->SetEventOnCompletion(fence->fence_value, fence->event_handle);
DWORD res = WaitForSingleObjectEx(fence->event_handle, INFINITE, FALSE); DWORD res = WaitForSingleObjectEx(fence->event_handle, INFINITE, FALSE);
#ifdef PIX_ENABLED #ifdef PIX_ENABLED
PIXNotifyWakeFromFenceSignal(fence->event_handle); PIXNotifyWakeFromFenceSignal(fence->event_handle);
@ -2254,7 +2255,6 @@ Error RenderingDeviceDriverD3D12::command_queue_execute_and_present(CommandQueue
FenceInfo *fence = (FenceInfo *)(p_cmd_fence.id); FenceInfo *fence = (FenceInfo *)(p_cmd_fence.id);
fence->fence_value++; fence->fence_value++;
command_queue->d3d_queue->Signal(fence->d3d_fence.Get(), fence->fence_value); command_queue->d3d_queue->Signal(fence->d3d_fence.Get(), fence->fence_value);
fence->d3d_fence->SetEventOnCompletion(fence->fence_value, fence->event_handle);
} }
} }