Rendering for Display P3 displays

On the Working with Wide Color session Justin Stoyles mentioned that the brightest red(1.0, 0.0, 0.0, 1.0) in Display P3 gamut is represented in the Extended SRGB as 1.358, -0.074, -0.012, 1.0. Indeed to display the brightest red on the MTKView with bgra10_xr_srgb pixel format we need to use that values. But I couldn't find out what conversion techniques are used to get that value.


So can anyone tell me how to convert colors from normalized Display P3 gamut to extended range to use with MTKViews?

So, as FrankSchlegel and me discovered, in order to display a Display P3 content with Metal view we need to set it's colorPixelFormat to rgba16Float and use a Core Image render destination with extendedSRGB color space. Now the content looks perfect on iPhone XS, but it looks a little "washed out" on iPhone X. UIImageView with a CIImage looks perfect on both devices. Any advice about what are we doing wrong or how to replicate UIImageView results?

Rendering for Display P3 displays
 
 
Q