filament icon indicating copy to clipboard operation
filament copied to clipboard

Alternatives to engine.flushAndWait()

Open rawnsley opened this issue 5 years ago • 4 comments

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.

rawnsley avatar Mar 20 '20 14:03 rawnsley

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.

romainguy avatar Mar 21 '20 06:03 romainguy

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.

pixelflinger avatar Mar 23 '20 19:03 pixelflinger

☹️ thanks for the info anyway.

rawnsley avatar Mar 23 '20 19:03 rawnsley

You could also use the async version of readPixels maybe -- this would stall less.

pixelflinger avatar Jul 07 '21 19:07 pixelflinger