Alternatives to engine.flushAndWait()
I'm currently using Filament to render to shared textures and then sending the result off to another library that ultimately displays those textures on a screen.
I'm calling engine.flushAndWait() to make sure the texture render has finished, but I would rather do it through some sort of callback. Is that an option in Filament? I guess this is related to fences, which I never really got my head around.
A fence is what you want except that we don't support GPU fences anymore (in the public API that is). The current fences will only tell you that the render thread has executed all the commands up until the fence.
This is not a supported use case right now. flushAndWait will work, however it is very heavy, it will stall both the current thread and the gl thread until the texture is rendered. Alas, this is the only solution right now.
☹️ thanks for the info anyway.
You could also use the async version of readPixels maybe -- this would stall less.