fix(metal): guard wantsExtendedDynamicRangeContent on iOS below 16 (#10257)

This commit is contained in:
Vladas Zakrevskis authored and GitHub committed 2026-09-16 14:09:55 +00:00
1 parent 89807f134f
commit 0aee018d25
2 files changed
+9 -3

No files matched your search

+1
View File
@@ -230,6 +230,7 @@ By @sagudev in [#10109](https://github.com/gfx-rs/wgpu/pull/10109).
- Report an error instead of panicking when Metal declines to create a texture view, which can occur for some views of textures with `TRANSIENT_ATTACHMENT` usage. By @matthargett in [#10145](https://github.com/gfx-rs/wgpu/pull/10145).
- BREAKING: Advertise `CompositeAlphaMode::PreMultiplied` instead of `PostMultiplied`, matching the premultiplied alpha compositing that Core Animation actually performs for a non-opaque `CAMetalLayer`. By @nicoburns in [#9922](https://github.com/gfx-rs/wgpu/pull/9922).
- If you previously hard-coded `PostMultiplied` to get a transparent macOS window, you will start receiving `UnsupportedAlphaMode` validation errors for this. Those affected should migrate to `PreMultiplied` instead.
- Fix a crash in `Surface::configure` on iOS below 16. `wantsExtendedDynamicRangeContent` is iOS 16+ and is now only called there. By @VladasZ in [#10257](https://github.com/gfx-rs/wgpu/pull/10257).
- Fix a crash when creating a declared alternate sRGB view of a render-attachment-only surface with Metal API Validation enabled. By @jinleili in [#10280](https://github.com/gfx-rs/wgpu/pull/10280).
#### GLES
+8 -3
View File
@@ -283,9 +283,14 @@ impl crate::Surface for super::Surface {
render_layer.setFramebufferOnly(framebuffer_only);
// Opt into Metal EDR for the HDR color spaces (more display power, memory,
// and bandwidth). The HDR spaces are exactly those `is_hdr()` classifies.
let wants_edr = config.color_space.is_hdr();
if wants_edr != render_layer.wantsExtendedDynamicRangeContent() {
render_layer.setWantsExtendedDynamicRangeContent(wants_edr);
//
// `wantsExtendedDynamicRangeContent` is iOS 16+. On older iOS calling it
// throws an unrecognized selector exception and the app aborts.
if available!(macos = 10.11, ios = 16.0, visionos = 1.0) {
let wants_edr = config.color_space.is_hdr();
if wants_edr != render_layer.wantsExtendedDynamicRangeContent() {
render_layer.setWantsExtendedDynamicRangeContent(wants_edr);
}
}
let colorspace_name: Option<&'static CFString> = match config.color_space {