Fix Metal startup when default device is unavailable#92
Open
ppkuchta wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some macOS systems can enumerate a usable Metal device via
MTLCopyAllDevices()whileMTLCreateSystemDefaultDevice()still returns nil. In that state ds4 aborts during startup with:This change keeps the existing default-device path, but if it returns nil, falls back to the first device returned by
MTLCopyAllDevices(). When that fallback is used, ds4 logs the selected device name before continuing normal Metal initialization.Why
On an Apple M3 Max machine,
system_profilerreported Metal support and a standalone probe showed:Before this patch, ds4 could not start because it only used
MTLCreateSystemDefaultDevice(). After the patch, the same machine starts successfully:Validation
ds4,ds4-server, andds4-benchwithmake./ds4 --ctx 4096 --inspectsuccessfully on the affected M3 Max machine