Previously the Wayland display server would attempt to enable
HDR output and try to detect if it failed afterwards which had some issues.
Now we can query the rendering driver for support and avoid ever enabling
HDR output when this would fail.
- Remove compiler warnings whilst baking Metal source to binary
libraries, so true errors are easier to spot. Speeds up compilation,
with reduced STDOUT.
- Prevent invalid Metal libraries when baking to older target OSs,
which earlier MSL language support. In these cases, SPIRV-Cross
generates emulated atomic code via buffers (rather than images), that
isn't supported by Godot's Metal driver. These shaders are marked with
a new INVALID flag that triggers a recompilation on the device, by
signaling that the cache is invalid.
Raytracing shader binding table records are addressed through Vulkan
alignment rules that distinguish between the raw shader group handle size,
the per-record handle alignment, and the base alignment required for SBT
region addresses.
The previous layout treated the shader group handle size as the record
stride everywhere. This worked only on devices where the handle size
already satisfied all relevant alignment requirements. It broke down once
multiple ray generation shaders were placed in the same SBT: selecting a
non-zero raygen index advanced the raygen region address by the raw handle
size, which could produce an address that was not aligned to the required
shader group base alignment.
Separate the SBT layout into the appropriate strides:
- ray generation records use a base-aligned stride, since selecting a
raygen shader changes the SBT region start address for the dispatch.
- miss and hit records use the handle-aligned shader group stride, since
their regions start at a base-aligned address and individual records are
selected through the region stride.
This keeps the CPU-side SBT population and the dispatch-time SBT regions
using the same layout, so shader group handles are written to the same
aligned slots that Vulkan later addresses.
- Handle border colour availability check with fallback
- Update patch for metal-cpp to add APIs used by Godot
- Fix segfault when freeing MDImmediateLibrary shaders that are still
in flight
- Change MTL::Texture::allocatedBytes call to safe, for visionOS