Metal: Compile MTLLibrary
on demand when pipeline is created
#103185
+5
−0
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.
Closes #103006
This changes the default shader loading strategy for mobile Apple platforms, implemented in the Metal driver, to compile the
MTLLibrary
on demand when the pipeline is created. This reduces cold startup time on IPHONE target OSs (iOS, tvOS and visionOS).Normally, the
MTLLibrary
is compiled from Metal source asynchronously when Godot callsRenderingDeviceDriverMetal::shader_create_from_bytecode
; however, this changes this behaviour on mobile platforms to do it on demand when the pipeline is created. As noted in #96052, Godot will ask to create many more shaders from bytecode than are initially required. Mobile OSs like iOS are limited to compiling two shader libraries concurrently, which results in a significant bottleneck.This is not the default for macOS, as it can concurrently compile many shaders at once, resulting in faster startup times for the Godot editor.