filament
filament copied to clipboard
When app from background to foreground,_renderer->beginFrame(_swapChain) always returns false.
Describe the bug I use Filament to develop a iOS app and I have found a problem with it. After app startup, _renderer->beginFrame(_swapChain) return true, render normally, but when the app enters the background, and again enters the foreground, _renderer->beginFrame(_swapChain) always returns false, the model cannot render properly, I printed _renderer and _swapChain, they are not be released, In your experience, what causes this problem in Filament?
To Reproduce 1、Start app, load model, _renderer->beginFrame(_swapChain) returns true 2、app enters background mode 3、app enters foreground mode 4、discover _renderer->beginFrame(_swapChain) always returns false
Expected behavior When app from background to foreground, _renderer->beginFrame(_swapChain) still returns true
Screenshots
Smartphone (please complete the following information):
- Device: iPhone12
- OS:iOS14.5
@bejado Does iOS release rendering surfaces or something when backgrounding apps?
When an app is backgrounded iOS restricts its use of Metal, which might be affecting things.
Are you continuing to call render
even when the app is backgrounded? Filament doesn't have any way of detecting this. Can you try hooking into applicationWillResignActive
and pausing Filament calls while the app is in the background?
When APP enters the background, the render method stop. But even from the background back to the foreground, the render method is called again, _renderer->beginFrame(_swapChain) also returns false, I'm checking foreground to background, what's happening to the app?
@Rankilau Are you seeing this happen with our unmodified gltf-viewer sample app?
@bejado This problem did not happen in the gltf-viewer sample. When I copied the code to our app, this problem would happen. It is possible that code of our app influence.I will check git diff to find out the reason.
@Rankilau Sounds good. One area to look at is how you're scheduling your frame callbacks. The gltf-viewrer uses CADisplayLink.
I also have a similar problem, has this problem been solved?