{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_hdr_metadata  ( setHdrMetadataEXT
                                              , XYColorEXT(..)
                                              , HdrMetadataEXT(..)
                                              , EXT_HDR_METADATA_SPEC_VERSION
                                              , pattern EXT_HDR_METADATA_SPEC_VERSION
                                              , EXT_HDR_METADATA_EXTENSION_NAME
                                              , pattern EXT_HDR_METADATA_EXTENSION_NAME
                                              , SwapchainKHR(..)
                                              ) where

import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CFloat)
import Foreign.C.Types (CFloat(CFloat))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkSetHdrMetadataEXT))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.Handles (SwapchainKHR)
import Vulkan.Extensions.Handles (SwapchainKHR(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_HDR_METADATA_EXT))
import Vulkan.Extensions.Handles (SwapchainKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkSetHdrMetadataEXT
  :: FunPtr (Ptr Device_T -> Word32 -> Ptr SwapchainKHR -> Ptr HdrMetadataEXT -> IO ()) -> Ptr Device_T -> Word32 -> Ptr SwapchainKHR -> Ptr HdrMetadataEXT -> IO ()

-- | vkSetHdrMetadataEXT - function to set Hdr metadata
--
-- == Valid Usage (Implicit)
--
-- -   @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   @pSwapchains@ /must/ be a valid pointer to an array of
--     @swapchainCount@ valid 'Vulkan.Extensions.Handles.SwapchainKHR'
--     handles
--
-- -   @pMetadata@ /must/ be a valid pointer to an array of
--     @swapchainCount@ valid 'HdrMetadataEXT' structures
--
-- -   @swapchainCount@ /must/ be greater than @0@
--
-- -   Both of @device@, and the elements of @pSwapchains@ /must/ have been
--     created, allocated, or retrieved from the same
--     'Vulkan.Core10.Handles.Instance'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'HdrMetadataEXT',
-- 'Vulkan.Extensions.Handles.SwapchainKHR'
setHdrMetadataEXT :: forall io
                   . (MonadIO io)
                  => -- | @device@ is the logical device where the swapchain(s) were created.
                     Device
                  -> -- | @pSwapchains@ is a pointer to an array of @swapchainCount@
                     -- 'Vulkan.Extensions.Handles.SwapchainKHR' handles.
                     ("swapchains" ::: Vector SwapchainKHR)
                  -> -- | @pMetadata@ is a pointer to an array of @swapchainCount@
                     -- 'HdrMetadataEXT' structures.
                     ("metadata" ::: Vector HdrMetadataEXT)
                  -> io ()
setHdrMetadataEXT :: Device
-> ("swapchains" ::: Vector SwapchainKHR)
-> ("metadata" ::: Vector HdrMetadataEXT)
-> io ()
setHdrMetadataEXT device :: Device
device swapchains :: "swapchains" ::: Vector SwapchainKHR
swapchains metadata :: "metadata" ::: Vector HdrMetadataEXT
metadata = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkSetHdrMetadataEXTPtr :: FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
vkSetHdrMetadataEXTPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("swapchainCount" ::: Word32)
      -> ("pSwapchains" ::: Ptr SwapchainKHR)
      -> ("pMetadata" ::: Ptr HdrMetadataEXT)
      -> IO ())
pVkSetHdrMetadataEXT (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
vkSetHdrMetadataEXTPtr FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> ("swapchainCount" ::: Word32)
      -> ("pSwapchains" ::: Ptr SwapchainKHR)
      -> ("pMetadata" ::: Ptr HdrMetadataEXT)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkSetHdrMetadataEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkSetHdrMetadataEXT' :: Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> ("pMetadata" ::: Ptr HdrMetadataEXT)
-> IO ()
vkSetHdrMetadataEXT' = FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
-> Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> ("pMetadata" ::: Ptr HdrMetadataEXT)
-> IO ()
mkVkSetHdrMetadataEXT FunPtr
  (Ptr Device_T
   -> ("swapchainCount" ::: Word32)
   -> ("pSwapchains" ::: Ptr SwapchainKHR)
   -> ("pMetadata" ::: Ptr HdrMetadataEXT)
   -> IO ())
vkSetHdrMetadataEXTPtr
  let pSwapchainsLength :: Int
pSwapchainsLength = ("swapchains" ::: Vector SwapchainKHR) -> Int
forall a. Vector a -> Int
Data.Vector.length (("swapchains" ::: Vector SwapchainKHR) -> Int)
-> ("swapchains" ::: Vector SwapchainKHR) -> Int
forall a b. (a -> b) -> a -> b
$ ("swapchains" ::: Vector SwapchainKHR
swapchains)
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((("metadata" ::: Vector HdrMetadataEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length (("metadata" ::: Vector HdrMetadataEXT) -> Int)
-> ("metadata" ::: Vector HdrMetadataEXT) -> Int
forall a b. (a -> b) -> a -> b
$ ("metadata" ::: Vector HdrMetadataEXT
metadata)) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
pSwapchainsLength) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "pMetadata and pSwapchains must have the same length" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  "pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains <- ((("pSwapchains" ::: Ptr SwapchainKHR) -> IO ()) -> IO ())
-> ContT () IO ("pSwapchains" ::: Ptr SwapchainKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSwapchains" ::: Ptr SwapchainKHR) -> IO ()) -> IO ())
 -> ContT () IO ("pSwapchains" ::: Ptr SwapchainKHR))
-> ((("pSwapchains" ::: Ptr SwapchainKHR) -> IO ()) -> IO ())
-> ContT () IO ("pSwapchains" ::: Ptr SwapchainKHR)
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pSwapchains" ::: Ptr SwapchainKHR) -> IO ()) -> IO ()
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @SwapchainKHR ((("swapchains" ::: Vector SwapchainKHR) -> Int
forall a. Vector a -> Int
Data.Vector.length ("swapchains" ::: Vector SwapchainKHR
swapchains)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ (Int -> SwapchainKHR -> IO ())
-> ("swapchains" ::: Vector SwapchainKHR) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SwapchainKHR
e -> ("pSwapchains" ::: Ptr SwapchainKHR) -> SwapchainKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains ("pSwapchains" ::: Ptr SwapchainKHR)
-> Int -> "pSwapchains" ::: Ptr SwapchainKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SwapchainKHR) (SwapchainKHR
e)) ("swapchains" ::: Vector SwapchainKHR
swapchains)
  "pMetadata" ::: Ptr HdrMetadataEXT
pPMetadata <- ((("pMetadata" ::: Ptr HdrMetadataEXT) -> IO ()) -> IO ())
-> ContT () IO ("pMetadata" ::: Ptr HdrMetadataEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pMetadata" ::: Ptr HdrMetadataEXT) -> IO ()) -> IO ())
 -> ContT () IO ("pMetadata" ::: Ptr HdrMetadataEXT))
-> ((("pMetadata" ::: Ptr HdrMetadataEXT) -> IO ()) -> IO ())
-> ContT () IO ("pMetadata" ::: Ptr HdrMetadataEXT)
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pMetadata" ::: Ptr HdrMetadataEXT) -> IO ()) -> IO ()
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @HdrMetadataEXT ((("metadata" ::: Vector HdrMetadataEXT) -> Int
forall a. Vector a -> Int
Data.Vector.length ("metadata" ::: Vector HdrMetadataEXT
metadata)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 64) 8
  (Int -> HdrMetadataEXT -> ContT () IO ())
-> ("metadata" ::: Vector HdrMetadataEXT) -> ContT () IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: HdrMetadataEXT
e -> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ()) -> IO ()) -> ContT () IO ())
-> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ("pMetadata" ::: Ptr HdrMetadataEXT)
-> HdrMetadataEXT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ("pMetadata" ::: Ptr HdrMetadataEXT
pPMetadata ("pMetadata" ::: Ptr HdrMetadataEXT)
-> Int -> "pMetadata" ::: Ptr HdrMetadataEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (64 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr HdrMetadataEXT) (HdrMetadataEXT
e) (IO () -> IO ())
-> ((() -> IO ()) -> IO ()) -> (() -> IO ()) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ())) ("metadata" ::: Vector HdrMetadataEXT
metadata)
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("swapchainCount" ::: Word32)
-> ("pSwapchains" ::: Ptr SwapchainKHR)
-> ("pMetadata" ::: Ptr HdrMetadataEXT)
-> IO ()
vkSetHdrMetadataEXT' (Device -> Ptr Device_T
deviceHandle (Device
device)) ((Int -> "swapchainCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSwapchainsLength :: Word32)) ("pSwapchains" ::: Ptr SwapchainKHR
pPSwapchains) ("pMetadata" ::: Ptr HdrMetadataEXT
pPMetadata)
  () -> ContT () IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> ContT () IO ()) -> () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- | VkXYColorEXT - structure to specify X,Y chromaticity coordinates
--
-- = See Also
--
-- 'HdrMetadataEXT'
data XYColorEXT = XYColorEXT
  { -- No documentation found for Nested "VkXYColorEXT" "x"
    XYColorEXT -> Float
x :: Float
  , -- No documentation found for Nested "VkXYColorEXT" "y"
    XYColorEXT -> Float
y :: Float
  }
  deriving (Typeable, XYColorEXT -> XYColorEXT -> Bool
(XYColorEXT -> XYColorEXT -> Bool)
-> (XYColorEXT -> XYColorEXT -> Bool) -> Eq XYColorEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XYColorEXT -> XYColorEXT -> Bool
$c/= :: XYColorEXT -> XYColorEXT -> Bool
== :: XYColorEXT -> XYColorEXT -> Bool
$c== :: XYColorEXT -> XYColorEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (XYColorEXT)
#endif
deriving instance Show XYColorEXT

instance ToCStruct XYColorEXT where
  withCStruct :: XYColorEXT -> (Ptr XYColorEXT -> IO b) -> IO b
withCStruct x :: XYColorEXT
x f :: Ptr XYColorEXT -> IO b
f = Int -> Int -> (Ptr XYColorEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 8 4 ((Ptr XYColorEXT -> IO b) -> IO b)
-> (Ptr XYColorEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr XYColorEXT
p -> Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr XYColorEXT
p XYColorEXT
x (Ptr XYColorEXT -> IO b
f Ptr XYColorEXT
p)
  pokeCStruct :: Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
pokeCStruct p :: Ptr XYColorEXT
p XYColorEXT{..} f :: IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
x))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
y))
    IO b
f
  cStructSize :: Int
cStructSize = 8
  cStructAlignment :: Int
cStructAlignment = 4
  pokeZeroCStruct :: Ptr XYColorEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr XYColorEXT
p f :: IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct XYColorEXT where
  peekCStruct :: Ptr XYColorEXT -> IO XYColorEXT
peekCStruct p :: Ptr XYColorEXT
p = do
    CFloat
x <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat))
    CFloat
y <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr XYColorEXT
p Ptr XYColorEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat))
    XYColorEXT -> IO XYColorEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (XYColorEXT -> IO XYColorEXT) -> XYColorEXT -> IO XYColorEXT
forall a b. (a -> b) -> a -> b
$ Float -> Float -> XYColorEXT
XYColorEXT
             ((\(CFloat a :: Float
a) -> Float
a) CFloat
x) ((\(CFloat a :: Float
a) -> Float
a) CFloat
y)

instance Storable XYColorEXT where
  sizeOf :: XYColorEXT -> Int
sizeOf ~XYColorEXT
_ = 8
  alignment :: XYColorEXT -> Int
alignment ~XYColorEXT
_ = 4
  peek :: Ptr XYColorEXT -> IO XYColorEXT
peek = Ptr XYColorEXT -> IO XYColorEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr XYColorEXT -> XYColorEXT -> IO ()
poke ptr :: Ptr XYColorEXT
ptr poked :: XYColorEXT
poked = Ptr XYColorEXT -> XYColorEXT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr XYColorEXT
ptr XYColorEXT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero XYColorEXT where
  zero :: XYColorEXT
zero = Float -> Float -> XYColorEXT
XYColorEXT
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero


-- | VkHdrMetadataEXT - structure to specify Hdr metadata
--
-- == Valid Usage (Implicit)
--
-- Note
--
-- The validity and use of this data is outside the scope of Vulkan.
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'XYColorEXT',
-- 'setHdrMetadataEXT'
data HdrMetadataEXT = HdrMetadataEXT
  { -- | @displayPrimaryRed@ is the mastering display’s red primary in
    -- chromaticity coordinates
    HdrMetadataEXT -> XYColorEXT
displayPrimaryRed :: XYColorEXT
  , -- | @displayPrimaryGreen@ is the mastering display’s green primary in
    -- chromaticity coordinates
    HdrMetadataEXT -> XYColorEXT
displayPrimaryGreen :: XYColorEXT
  , -- | @displayPrimaryBlue@ is the mastering display’s blue primary in
    -- chromaticity coordinates
    HdrMetadataEXT -> XYColorEXT
displayPrimaryBlue :: XYColorEXT
  , -- | @whitePoint@ is the mastering display’s white-point in chromaticity
    -- coordinates
    HdrMetadataEXT -> XYColorEXT
whitePoint :: XYColorEXT
  , -- | @maxLuminance@ is the maximum luminance of the mastering display in nits
    HdrMetadataEXT -> Float
maxLuminance :: Float
  , -- | @minLuminance@ is the minimum luminance of the mastering display in nits
    HdrMetadataEXT -> Float
minLuminance :: Float
  , -- | @maxContentLightLevel@ is content’s maximum luminance in nits
    HdrMetadataEXT -> Float
maxContentLightLevel :: Float
  , -- | @maxFrameAverageLightLevel@ is the maximum frame average light level in
    -- nits
    HdrMetadataEXT -> Float
maxFrameAverageLightLevel :: Float
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HdrMetadataEXT)
#endif
deriving instance Show HdrMetadataEXT

instance ToCStruct HdrMetadataEXT where
  withCStruct :: HdrMetadataEXT
-> (("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b) -> IO b
withCStruct x :: HdrMetadataEXT
x f :: ("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b
f = Int
-> Int -> (("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b) -> IO b)
-> (("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pMetadata" ::: Ptr HdrMetadataEXT
p -> ("pMetadata" ::: Ptr HdrMetadataEXT)
-> HdrMetadataEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMetadata" ::: Ptr HdrMetadataEXT
p HdrMetadataEXT
x (("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b
f "pMetadata" ::: Ptr HdrMetadataEXT
p)
  pokeCStruct :: ("pMetadata" ::: Ptr HdrMetadataEXT)
-> HdrMetadataEXT -> IO b -> IO b
pokeCStruct p :: "pMetadata" ::: Ptr HdrMetadataEXT
p HdrMetadataEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HDR_METADATA_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr XYColorEXT)) (XYColorEXT
displayPrimaryRed) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr XYColorEXT)) (XYColorEXT
displayPrimaryGreen) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr XYColorEXT)) (XYColorEXT
displayPrimaryBlue) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr XYColorEXT)) (XYColorEXT
whitePoint) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxLuminance))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
minLuminance))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxContentLightLevel))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxFrameAverageLightLevel))
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 64
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pMetadata" ::: Ptr HdrMetadataEXT) -> IO b -> IO b
pokeZeroCStruct p :: "pMetadata" ::: Ptr HdrMetadataEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_HDR_METADATA_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr XYColorEXT)) (XYColorEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr XYColorEXT)) (XYColorEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr XYColorEXT)) (XYColorEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr XYColorEXT -> XYColorEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr XYColorEXT)) (XYColorEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct HdrMetadataEXT where
  peekCStruct :: ("pMetadata" ::: Ptr HdrMetadataEXT) -> IO HdrMetadataEXT
peekCStruct p :: "pMetadata" ::: Ptr HdrMetadataEXT
p = do
    XYColorEXT
displayPrimaryRed <- Ptr XYColorEXT -> IO XYColorEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @XYColorEXT (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr XYColorEXT))
    XYColorEXT
displayPrimaryGreen <- Ptr XYColorEXT -> IO XYColorEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @XYColorEXT (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr XYColorEXT))
    XYColorEXT
displayPrimaryBlue <- Ptr XYColorEXT -> IO XYColorEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @XYColorEXT (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr XYColorEXT))
    XYColorEXT
whitePoint <- Ptr XYColorEXT -> IO XYColorEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @XYColorEXT (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr XYColorEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr XYColorEXT))
    CFloat
maxLuminance <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr CFloat))
    CFloat
minLuminance <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr CFloat))
    CFloat
maxContentLightLevel <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr CFloat))
    CFloat
maxFrameAverageLightLevel <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pMetadata" ::: Ptr HdrMetadataEXT
p ("pMetadata" ::: Ptr HdrMetadataEXT) -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr CFloat))
    HdrMetadataEXT -> IO HdrMetadataEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HdrMetadataEXT -> IO HdrMetadataEXT)
-> HdrMetadataEXT -> IO HdrMetadataEXT
forall a b. (a -> b) -> a -> b
$ XYColorEXT
-> XYColorEXT
-> XYColorEXT
-> XYColorEXT
-> Float
-> Float
-> Float
-> Float
-> HdrMetadataEXT
HdrMetadataEXT
             XYColorEXT
displayPrimaryRed XYColorEXT
displayPrimaryGreen XYColorEXT
displayPrimaryBlue XYColorEXT
whitePoint ((\(CFloat a :: Float
a) -> Float
a) CFloat
maxLuminance) ((\(CFloat a :: Float
a) -> Float
a) CFloat
minLuminance) ((\(CFloat a :: Float
a) -> Float
a) CFloat
maxContentLightLevel) ((\(CFloat a :: Float
a) -> Float
a) CFloat
maxFrameAverageLightLevel)

instance Zero HdrMetadataEXT where
  zero :: HdrMetadataEXT
zero = XYColorEXT
-> XYColorEXT
-> XYColorEXT
-> XYColorEXT
-> Float
-> Float
-> Float
-> Float
-> HdrMetadataEXT
HdrMetadataEXT
           XYColorEXT
forall a. Zero a => a
zero
           XYColorEXT
forall a. Zero a => a
zero
           XYColorEXT
forall a. Zero a => a
zero
           XYColorEXT
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero


type EXT_HDR_METADATA_SPEC_VERSION = 2

-- No documentation found for TopLevel "VK_EXT_HDR_METADATA_SPEC_VERSION"
pattern EXT_HDR_METADATA_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_HDR_METADATA_SPEC_VERSION :: a
$mEXT_HDR_METADATA_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_HDR_METADATA_SPEC_VERSION = 2


type EXT_HDR_METADATA_EXTENSION_NAME = "VK_EXT_hdr_metadata"

-- No documentation found for TopLevel "VK_EXT_HDR_METADATA_EXTENSION_NAME"
pattern EXT_HDR_METADATA_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_HDR_METADATA_EXTENSION_NAME :: a
$mEXT_HDR_METADATA_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_HDR_METADATA_EXTENSION_NAME = "VK_EXT_hdr_metadata"