MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / WaitForGPU

Function WaitForGPU

Chapter_14/src/Graphics.cpp:917–931  ·  view source on GitHub ↗

* Wait for pending GPU work to complete. */

Source from the content-addressed store, hash-verified

915* Wait for pending GPU work to complete.
916*/
917void WaitForGPU(D3D12Global &d3d)
918{
919 // Schedule a signal command in the queue
920 HRESULT hr = d3d.cmdQueue->Signal(d3d.fence, d3d.fenceValues[d3d.frameIndex]);
921 Utils::Validate(hr, L"Error: failed to signal fence!");
922
923 // Wait until the fence has been processed
924 hr = d3d.fence->SetEventOnCompletion(d3d.fenceValues[d3d.frameIndex], d3d.fenceEvent);
925 Utils::Validate(hr, L"Error: failed to set fence event!");
926
927 WaitForSingleObjectEx(d3d.fenceEvent, INFINITE, FALSE);
928
929 // Increment the fence value for the current frame
930 d3d.fenceValues[d3d.frameIndex]++;
931}
932
933/**
934* Prepare to render the next frame.

Callers 3

BuildCommandListFunction · 0.85
InitMethod · 0.85
CleanupMethod · 0.85

Calls 1

ValidateFunction · 0.85

Tested by

no test coverage detected