Skip to content

Add min gpu family for baking apple shaders#116114

Open
TCROC wants to merge 1 commit intogodotengine:masterfrom
Lange-Studios:shader-baker-apple-min-gpu-family
Open

Add min gpu family for baking apple shaders#116114
TCROC wants to merge 1 commit intogodotengine:masterfrom
Lange-Studios:shader-baker-apple-min-gpu-family

Conversation

@TCROC
Copy link
Contributor

@TCROC TCROC commented Feb 9, 2026

This adds the ability to specify the minimum gpu family to bake apple shaders against. Currently our MacOS version has a higher gpu family than the iPhone XR supports. Hence when we bake our shaders, they don't run on the iPhone XR. This gives more granular support in the shader baking process and allows users to target older devices than their current Mac.

@TCROC TCROC requested review from a team as code owners February 9, 2026 21:41
@TCROC TCROC force-pushed the shader-baker-apple-min-gpu-family branch from 0511c6f to fcad4b0 Compare February 9, 2026 21:42
@TCROC
Copy link
Contributor Author

TCROC commented Feb 9, 2026

Some issues occurred when rebasing on master before I put in this PR. I'll touch these up tomorrow. But the concept is still the same if anyone wants to review

Copy link
Contributor

@stuartcarnie stuartcarnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is more complex than the min GPU, when baking shaders.

Unfortunately, when shaders are queried in the renderer, it asks the host platform for supported features, such as RD::SUPPORTS_IMAGE_ATOMIC_32_BIT (the primary culprit of the baking issues). On the host platform, this returns true. When baking the shader, the minimum GPU and Metal versions are passed to SPIRV-Cross, based on the MetalDeviceProfile. By default, the versions we pass do not support atomics, so it generates unsupported shader code, as SPIRV-Cross tries to emulate atomics.

Important

If the user specified a target OS of iOS 17 (Metal 3.1) for iOS, the baked shaders should work. For earlier OS versions, Godot should fall back to compiling the code.

@stuartcarnie
Copy link
Contributor

I think the interim solution is to limit shader baking to iOS 17+ for the moment, so that it doesn't generate incorrect shader output.

@TCROC TCROC force-pushed the shader-baker-apple-min-gpu-family branch from fcad4b0 to f67943d Compare February 10, 2026 15:48
@TCROC TCROC force-pushed the shader-baker-apple-min-gpu-family branch 3 times, most recently from 90407c6 to ef57d7f Compare February 10, 2026 17:05
@TCROC TCROC requested a review from a team as a code owner February 10, 2026 17:05
@TCROC TCROC force-pushed the shader-baker-apple-min-gpu-family branch from ef57d7f to def1c7a Compare February 10, 2026 17:34
@TCROC
Copy link
Contributor Author

TCROC commented Feb 11, 2026

@bruvzg @stuartcarnie Also I updated metal_device_profile.cpp and rendinger_device_driver_metal.cpp to include Apple10 in their switch case statements since @stuartcarnie suggested to add that enum into this PR. If there is anywhere else that needs updating for new Apple10 enum just let me know. But searching the repo, that was all I found.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants