diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c71813ce..6b10ecbff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 6365d9199..ce549e6ba 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -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 {