google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.36k stars 1.84k forks source link

Improve logging for Metallib function lookup failures #7836

Closed ullerrm closed 1 month ago

ullerrm commented 1 month ago

If a .metallib was compiled with a target iOS version that's newer than the current device, loading the .metallib as an id<MTLLibrary> may succeed, but finding main0 (or any other function in it) will fail and return nil. Currently, this causes a crash due to an assert; logging the error and returning MetalFunctionBundle::error() will still crash, but in a way that's easier to diagnose.

(Note that in practice, this will probably be a useless "Compiler encountered an internal error" message -- the GPU backend is crashing, and the Metal stub library sees as XPC_ERROR_CONNECTION_INTERRUPTED. It retries up to 3 times, crashing each time, and then gives up.)