Open kvark opened 4 years ago
If it's possible, would it make sense to use weak_framework
here, and expose a helper function to check if Metal is available?
we load symbols when metal-rs objects are created (or some kind of a Metal context is initialized) instead of dynamically checking for symbols on each and every call
If we want to use libloading for this, how should this work? Would we internally share a map of function pointers?
Hi, any news on this?
@GopherJ not yet, we might experiment with the first approach above (i.e. using weak_framework
and a helper function to check if it's loaded)
@grovesNL ok thanks take your time and ping me if it's resolved, I'll be excited to test again. 😄
Would #[link(name = "Metal", kind = "weak_framework")]
work?
Yeah I think something like that should work – just need to test it out
Update: I asked on the Rust Zulip and Discourse (https://users.rust-lang.org/t/how-to-use-weak-linking-on-macos-link-with-weak-framework/50732) but had no response yet
Similar to https://github.com/gfx-rs/d3d12-rs/pull/19, we need to avoid implicit linking of Metal framework if we want to run (any application that uses metal-rs in some way) on macOS 10.10 and earlier.
One workaround that the clients could do is "-weak_framework Metal" instead of just "-framework". See https://phabricator.services.mozilla.com/D54946 for Gecko. They would still need to make sure that no entry points are used.
I think loading the libraries dynamically and explicitly by metal-rs is still better for the following reasons: