Skip to content

macOS: Fall back to Metal when Vulkan is not compiled in - #125915

Open
adamdmcbride wants to merge 1 commit into
godotengine:masterfrom
adamdmcbride:macos-vulkan-fallback-to-metal
Open

adamdmcbride wants to merge 1 commit into
godotengine:masterfrom
adamdmcbride:macos-vulkan-fallback-to-metal

Conversation

@adamdmcbride

Copy link
Copy Markdown

Fixes #125896.

What problem(s) does this PR solve?

When a project sets rendering/rendering_device/driver.macos to vulkan and the engine was built with
vulkan=no (as the official Apple Silicon builds of 4.8 rc1 were, and as godotengine/godot-build-scripts#180
plans for 4.9), DisplayServerMacOS creates no rendering context and no rasterizer, and the editor
and exported projects crash on startup with signal 11.

This PR switches to Metal in that case and prints a warning, mirroring the existing Intel fallback in
the same function (Metal to Vulkan). The --rendering-driver vulkan command-line option is unchanged:
it still stops with "Unknown rendering driver" because main.cpp checks it against the compiled
drivers.

Testing

Apple M3 Max, macOS 27.2. MRP: a project with only rendering_device/driver.macos="vulkan" and a
main scene that prints the current driver after 30 frames and quits (the same setting as the MRP in
#125896). Each run used a fresh HOME.

Build Run Result
Official 4.8 rc1 (v4.8.rc1.official.7c97c2977) project crash, signal 11
Official 4.8 rc1 editor (-e) crash, signal 11
master (7c97c29), vulkan=no angle=no, without this PR project / editor crash, signal 11 / crash, signal 11
Same, with this PR project "Vulkan is not available in this build, switching to Metal.", then Metal 4.0 - Forward+; the scene prints driver=metal, exit 0
Same, with this PR editor (-e --quit-after 300) same warning, Metal 4.0, the editor opens, exit 0
Same, with this PR --rendering-driver vulkan "Unknown rendering driver 'vulkan', aborting.", exit 1 (unchanged)
Same, with this PR --rendering-driver metal Metal 4.0, exit 0 (unchanged)

Builds with vulkan=yes compile the new block out, so they are unaffected.

Note

AI disclosure: an AI assistant (Claude) analysed the issue, wrote this change and ran the tests, under
my direction. I reviewed the code.

When a project sets `rendering/rendering_device/driver.macos` to
`vulkan` and the engine was built with `vulkan=no` (as official Apple
Silicon builds were in 4.8 rc1), no rendering context was created and
the editor and exported projects crashed on startup.

Switch to Metal in that case, as Intel builds already switch from Metal
to Vulkan.

Fixes godotengine#125896.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@williamchange

Copy link
Copy Markdown
Contributor

Please take a look at the guidelines, AI authored PRs are not accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using "Vulkan" driver for macOS causes project to crash on start

2 participants