MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / WaitForGPU

Method WaitForGPU

Source/Engine/GraphicsDevice/WebGPU/GPUDeviceWebGPU.cpp:803–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803void GPUDeviceWebGPU::WaitForGPU()
804{
805 if (QueueSubmits == 0 || Engine::FatalError != FatalErrorType::None)
806 return;
807 QueueSubmits = 0;
808 AsyncCallbackWebGPU<WGPUQueueWorkDoneCallbackInfo> workDone(WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT);
809 workDone.Info.callback = [](WGPUQueueWorkDoneStatus status, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2)
810 {
811 AsyncCallbackDataWebGPU& userData = *reinterpret_cast<AsyncCallbackDataWebGPU*>(userdata1);
812 userData.Call(status == WGPUQueueWorkDoneStatus_Success, status, message);
813 };
814 wgpuQueueOnSubmittedWorkDone(Queue, workDone.Info);
815 auto workDoneResult = workDone.Wait(WebGPUInstance);
816 if (workDoneResult == WGPUWaitStatus_TimedOut)
817 {
818 LOG(Error, "WebGPU queue wait has timed out after {}s", (int32)workDone.Data.WaitTime);
819 return;
820 }
821 if (workDoneResult == WGPUWaitStatus_Error)
822 {
823 LOG(Error, "Failed to wait for WebGPU queue. Error: {}, 0x{:x}", workDone.Data.Message, workDone.Data.Status);
824 return;
825 }
826}
827
828GPUQueryWebGPU GPUDeviceWebGPU::AllocateQuery(GPUQueryType type)
829{

Callers 1

ResizeMethod · 0.45

Calls 2

CallMethod · 0.80
WaitMethod · 0.45

Tested by

no test coverage detected