-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix metal feature detection #8439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Fix metal feature detection #8439
Conversation
|
Due to my hatred of metal docs and the fact that they don't make any sense, and because it seems that feature set related docs have been removed, I'm not gonna look over most of the feature detection code, and just trust that it works well enough. I will definitely take another few looks over all of this. Its kind of a nightmare to navigate, but I'll try to improve that a little and make sure that reviewers have to put in slightly less effort to follow what's going on. |
| } else { | ||
| version.at_least((11, 0), (10, 0), os_is_mac) | ||
| }, | ||
| supports_memoryless_storage: metal4 || device.supports_family(MTLGPUFamily::Apple2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this logic? If a device under iOS 13 runs this, metal4 would be false since family_check fails, and then device.supports_family() would be called. Since this API only became available after iOS 13, it would crash the app. (Past example: #5744) Ditto for the other usages of metal3 and metal4.
Also can you please put the OS version check back since the A7 also supports memoryless storage and its last iOS version is 12.5.7, so family checks wouldn't cover it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to, this is a rough sketch, I went over tons of stuff, I'm gonna look at it more deeply in the future
Connections
Description
The following section contains misinformation !! Please ignore for now
Many (most?) of the feature detection logic in the metal backend is completely incorrect. You often must check for both physical device feature support and API support (e.g. many features require the Metal 3 API in addition to hardware support). This is often not checked correctly. For example, I have seen checks for device OR api version correctness, or checks that ignore the API version completely.
In practice, most apple devices that have hardware support for certain features also have high enough OS versions. However, virtual devices/simulated devices only support Metal 3. Therefore, many features would probably cause issues if they were to be tested in CI.
This addresses that by adjusting a TON of feature checks. This is not exhaustive.
Testing
None
Squash or Rebase?
Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.