This allows Apple platforms to override the default stack size of
a thread in the WorkerThreadPool, which is 512KiB by default.
This must be increased, as SPIRV-Cross, used by the Metal driver, can
use deeply nested stacks, as can debug builds.
This does not resolve the errors noted in #101696, as the project is
incorrectly binding incompatible uniform set descriptors, as set 0
and set 1 have a single `readonly` image and set 2 has a single
`writeonly` texture. The `RenderingDevice` is reporting the errors with
Metal, as it uses a different `_reflect_spirv`, which correctly
determines the read / write attribute. A separate PR will be required
to fix the shared `_reflect_spirv`
Helps #101696
This changes the default shader loading strategy, implemented in the
Metal driver, to compile the `MTLLibrary` on demand when the pipeline
is created, which reduces cold startup time on IPHONE target OSs.
Normally, the `MTLLibrary` is compiled from Metal source asynchronously
when Godot calls
`RenderingDeviceDriverMetal::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 to 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.
This avoids crashing on devices when a number of varyings greater than the device limit is used.
For now this accurately prints an error when compiling the shader, but the error text only pops up in the editor if the number of user varyings is above the limit.
Most important is a fix for an occasional crash due to a use-after-free
bug.
A number of API availability declarations were updated to include tvOS.
The code is now simplified and generic for all platforms, which makes
way for future tvOS support.
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>