Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missing Extended Dynamic Range APIs to iOS #17340

Closed
jfversluis opened this issue Jan 23, 2023 · 4 comments · Fixed by #17345
Closed

Add Missing Extended Dynamic Range APIs to iOS #17340

jfversluis opened this issue Jan 23, 2023 · 4 comments · Fixed by #17345

Comments

@jfversluis
Copy link
Member


Issue moved from dotnet/maui#12852


From @Microno95 on Monday, January 23, 2023 1:07:32 PM

Description

In iOS 16, the extended dynamic range APIs were added for use with Metal. Specifically, the CAMetalLayer class now has the properties wantsExtendedDynamicRangeContent and edrMetadata exposed on iOS.

Adding these to the iOS SDK would enable developers to write applications that can take advantage of EDR on iOS platforms.

Public API Changes

namespace CoreAnimation
{
    [Register("CAMetalLayer", true)]
    [SupportedOSPlatform("ios8.0")]
    [SupportedOSPlatform("macos10.11")]
    [SupportedOSPlatform("maccatalyst13.0")]
    [SupportedOSPlatform("tvos8.0")]
    public class CAMetalLayer : CALayer
    {
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [Export("init")]
        public CAMetalLayer();
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [DesignatedInitializer]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [Export("initWithCoder:")]
        public CAMetalLayer(NSCoder coder);
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        protected CAMetalLayer(NSObjectFlag t);
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        protected internal CAMetalLayer(NativeHandle handle);

        public override NativeHandle ClassHandle { get; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos11.0")]
        [SupportedOSPlatform("macos10.13")]
        [SupportedOSPlatform("ios11.0")]
        [SupportedOSPlatform("maccatalyst11.0")]
        public virtual bool AllowsNextDrawableTimeout { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos13.0")]
        [SupportedOSPlatform("macos10.15")]
        [SupportedOSPlatform("ios13.0")]
        [SupportedOSPlatform("maccatalyst13.0")]
        public virtual CGColorSpace? ColorSpace { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual IMTLDevice? Device { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual CGSize DrawableSize { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual bool FramebufferOnly { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos11.2")]
        [SupportedOSPlatform("macos10.13.2")]
        [SupportedOSPlatform("ios11.2")]
        [SupportedOSPlatform("maccatalyst11.2")]
        public virtual nuint MaximumDrawableCount { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual MTLPixelFormat PixelFormat { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos13.0")]
        [SupportedOSPlatform("macos10.15")]
        [SupportedOSPlatform("ios13.0")]
        [SupportedOSPlatform("maccatalyst13.0")]
        public virtual IMTLDevice? PreferredDevice { get; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual bool PresentsWithTransaction { get; set; }
        // PROPOSED ADDITION //
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios16.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst16.0")]
        public virtual bool wantsExtendedDynamicRangeContent{ get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios16.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst16.0")]
        public virtual CAEDRMetadata? edrMetadata { get; set; }
        // END OF ADDITION //

        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [Export("nextDrawable")]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual ICAMetalDrawable? NextDrawable();
    }
}

Intended Use-Case

I am working as part of software development team where we would like to display High Dynamic Range content on the latest iPad Pros which supports up to 1600 nits in EDR mode, but are unable to fully utilise the display as such.

@jfversluis

This comment was marked as off-topic.

@jfversluis

This comment was marked as off-topic.

@jfversluis

This comment was marked as off-topic.

@rolfbjarne
Copy link
Member

Specifically, the CAMetalLayer class now has the properties wantsExtendedDynamicRangeContent and edrMetadata exposed on iOS.

We've already bound EDRMetadata, but it looks like we thought it wasn't available on iOS, so we bound it wrong:

https://github.com/xamarin/xamarin-macios/blob/main/src/coreanimation.cs#L756-L762

and we're completely missing wantsExtendedDynamicRangeContent.

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Jan 23, 2023
.

Also make CAEdrMetadata available on iOS and add a missing CAEdrMetadata
property.

Fixes xamarin#17340.
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Jan 24, 2023
.

Also make CAEdrMetadata available on iOS and add a missing CAEdrMetadata
property.

Fixes xamarin#17340.
rolfbjarne added a commit that referenced this issue Jan 25, 2023
…17345)

Also make CAEdrMetadata available on iOS and add a missing CAEdrMetadata
property.

Fixes #17340.
@ghost ghost locked as resolved and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants