dotrix
dotrix copied to clipboard
Feature Request: One time, excecute on next frame
There are times, such as when computing one off jobs on the gpu, you need to run something on the next frame once.
For example: In the PR #159 there is a method to copy textures from the GPU to the cpu. For this to work we need to enqueue a command to the gpu and wait for the next frame cycle so that it is completed.
As another example, we could compute bounding boxes on the gpu and then copy them back to the cpu next frame for collision or raycasting analysis.
This is a tracking issue to discuss how should we implement it.
Possible ways to achieve this:
- Async method that allows us to await a frame change, have some
std::future::Futureobject that completes once a frame has incremented - Make cycle could an
Arc<AtomicU32>and expose methods to share it. This could be abusable if them modify it. - Make systems cancel-able in some way. For example if a system returns
STOPthen we remove it. This way the user can enqueue a system do what every they need like checkcyclecount and act on it and remove when done.