Considering following code:
buffer.MapAsync(wgpu::CallbackMode::WaitAnyOnly, ...);
auto future = queue.OnSubmittedWorkDone(wgpu::CallbackMode::WaitAnyOnly, ...);
wgpu::FutureWaitInfo info{future};
instance.WaitOnly(1, &info, UINT64_MAX);
Intuitively I would assume the callback of MapAsync would be called when WaitOnly returns, but it does not because the future of MapAsync is not passed to WaitOnly.
However collecting all futures and then pass them all to WaitOnly is also not practical because number of futures WaitOnly can take is quite small and even a linear regression program can exceed it.
The options I have are:
- Still use
WaitOnly but instead of one single call I split the futures into multiple WaitOnly calls.
- Use other callback mode in
MapAsync and then call ProcessEvents after calling WaitOnly. (Note that even with AllowSpontaneous I still need a ProcessEvents to make the callback get invoked, I don't know if it is intended or a bug.)
But:
- The
WaitOnly approach is overkill and hard-to-use when I only want to wait for submitted work done.
- Using other callbacks mode in
MapAsync would make OnSubmittedWorkDone's callback get called before MapAsync's callbacks.
Considering following code:
Intuitively I would assume the callback of
MapAsyncwould be called whenWaitOnlyreturns, but it does not because the future ofMapAsyncis not passed toWaitOnly.However collecting all futures and then pass them all to
WaitOnlyis also not practical because number of futuresWaitOnlycan take is quite small and even a linear regression program can exceed it.The options I have are:
WaitOnlybut instead of one single call I split the futures into multipleWaitOnlycalls.MapAsyncand then callProcessEventsafter callingWaitOnly. (Note that even withAllowSpontaneousI still need aProcessEventsto make the callback get invoked, I don't know if it is intended or a bug.)But:
WaitOnlyapproach is overkill and hard-to-use when I only want to wait for submitted work done.MapAsyncwould makeOnSubmittedWorkDone's callback get called beforeMapAsync's callbacks.