{-# language CPP #-}
-- | = Name
--
-- VK_AMD_display_native_hdr - device extension
--
-- == VK_AMD_display_native_hdr
--
-- [__Name String__]
--     @VK_AMD_display_native_hdr@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     214
--
-- [__Revision__]
--     1
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires Vulkan 1.0
--
--     -   Requires @VK_KHR_get_physical_device_properties2@
--
--     -   Requires @VK_KHR_get_surface_capabilities2@
--
--     -   Requires @VK_KHR_swapchain@
--
-- [__Contact__]
--
--     -   Matthaeus G. Chajdas
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?title=VK_AMD_display_native_hdr:%20&body=@anteru%20 >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2018-12-18
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Matthaeus G. Chajdas, AMD
--
--     -   Aaron Hagan, AMD
--
--     -   Aric Cyr, AMD
--
--     -   Timothy Lottes, AMD
--
--     -   Derrick Owens, AMD
--
--     -   Daniel Rakos, AMD
--
-- == Description
--
-- This extension introduces the following display native HDR features to
-- Vulkan:
--
-- -   A new 'Vulkan.Extensions.VK_KHR_surface.ColorSpaceKHR' enum for
--     setting the native display colorspace. For example, this color space
--     would be set by the swapchain to use the native color space in
--     Freesync2 displays.
--
-- -   Local dimming control
--
-- == New Commands
--
-- -   'setLocalDimmingAMD'
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Extensions.VK_KHR_get_surface_capabilities2.SurfaceCapabilities2KHR':
--
--     -   'DisplayNativeHdrSurfaceCapabilitiesAMD'
--
-- -   Extending
--     'Vulkan.Extensions.VK_KHR_swapchain.SwapchainCreateInfoKHR':
--
--     -   'SwapchainDisplayNativeHdrCreateInfoAMD'
--
-- == New Enum Constants
--
-- -   'AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME'
--
-- -   'AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Extensions.VK_KHR_surface.ColorSpaceKHR':
--
--     -   'Vulkan.Extensions.VK_KHR_surface.COLOR_SPACE_DISPLAY_NATIVE_AMD'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD'
--
-- == Issues
--
-- None.
--
-- == Examples
--
-- None.
--
-- == Version History
--
-- -   Revision 1, 2018-12-18 (Daniel Rakos)
--
--     -   Initial revision
--
-- = See Also
--
-- 'DisplayNativeHdrSurfaceCapabilitiesAMD',
-- 'SwapchainDisplayNativeHdrCreateInfoAMD', 'setLocalDimmingAMD'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_display_native_hdr Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_AMD_display_native_hdr  ( setLocalDimmingAMD
                                                    , DisplayNativeHdrSurfaceCapabilitiesAMD(..)
                                                    , SwapchainDisplayNativeHdrCreateInfoAMD(..)
                                                    , AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION
                                                    , pattern AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION
                                                    , AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME
                                                    , pattern AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME
                                                    , SwapchainKHR(..)
                                                    , ColorSpaceKHR(..)
                                                    ) where

import Vulkan.Internal.Utils (traceAroundEvent)
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.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
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.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.FundamentalTypes (Bool32(..))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkSetLocalDimmingAMD))
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_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD))
import Vulkan.Extensions.VK_KHR_surface (ColorSpaceKHR(..))
import Vulkan.Extensions.Handles (SwapchainKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkSetLocalDimmingAMD
  :: FunPtr (Ptr Device_T -> SwapchainKHR -> Bool32 -> IO ()) -> Ptr Device_T -> SwapchainKHR -> Bool32 -> IO ()

-- | vkSetLocalDimmingAMD - Set Local Dimming
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkSetLocalDimmingAMD-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkSetLocalDimmingAMD-swapChain-parameter# @swapChain@ /must/
--     be a valid 'Vulkan.Extensions.Handles.SwapchainKHR' handle
--
-- -   #VUID-vkSetLocalDimmingAMD-commonparent# Both of @device@, and
--     @swapChain@ /must/ have been created, allocated, or retrieved from
--     the same 'Vulkan.Core10.Handles.Instance'
--
-- == Valid Usage
--
-- -   #VUID-vkSetLocalDimmingAMD-localDimmingSupport-04618# It is only
--     valid to call 'setLocalDimmingAMD' if
--     'DisplayNativeHdrSurfaceCapabilitiesAMD'::@localDimmingSupport@ is
--     supported
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32', 'Vulkan.Core10.Handles.Device',
-- 'Vulkan.Extensions.Handles.SwapchainKHR'
setLocalDimmingAMD :: forall io
                    . (MonadIO io)
                   => -- | @device@ is the device associated with @swapChain@.
                      Device
                   -> -- | @swapChain@ handle to enable local dimming.
                      SwapchainKHR
                   -> -- | @localDimmingEnable@ specifies whether local dimming is enabled for the
                      -- swapchain.
                      ("localDimmingEnable" ::: Bool)
                   -> io ()
setLocalDimmingAMD :: Device -> SwapchainKHR -> ("localDimmingEnable" ::: Bool) -> io ()
setLocalDimmingAMD device :: Device
device swapChain :: SwapchainKHR
swapChain localDimmingEnable :: "localDimmingEnable" ::: Bool
localDimmingEnable = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkSetLocalDimmingAMDPtr :: FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
vkSetLocalDimmingAMDPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
pVkSetLocalDimmingAMD (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  ("localDimmingEnable" ::: Bool) -> IO () -> IO ()
forall (f :: * -> *).
Applicative f =>
("localDimmingEnable" ::: Bool) -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
vkSetLocalDimmingAMDPtr FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
-> FunPtr
     (Ptr Device_T
      -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
-> "localDimmingEnable" ::: Bool
forall a. Eq a => a -> a -> "localDimmingEnable" ::: Bool
/= FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> 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 vkSetLocalDimmingAMD is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkSetLocalDimmingAMD' :: Ptr Device_T
-> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ()
vkSetLocalDimmingAMD' = FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
-> Ptr Device_T
-> SwapchainKHR
-> ("localDimmingEnable" ::: Bool32)
-> IO ()
mkVkSetLocalDimmingAMD FunPtr
  (Ptr Device_T
   -> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ())
vkSetLocalDimmingAMDPtr
  String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent "vkSetLocalDimmingAMD" (Ptr Device_T
-> SwapchainKHR -> ("localDimmingEnable" ::: Bool32) -> IO ()
vkSetLocalDimmingAMD' (Device -> Ptr Device_T
deviceHandle (Device
device)) (SwapchainKHR
swapChain) (("localDimmingEnable" ::: Bool) -> "localDimmingEnable" ::: Bool32
boolToBool32 ("localDimmingEnable" ::: Bool
localDimmingEnable)))
  () -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- | VkDisplayNativeHdrSurfaceCapabilitiesAMD - Structure describing display
-- native HDR specific capabilities of a surface
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data DisplayNativeHdrSurfaceCapabilitiesAMD = DisplayNativeHdrSurfaceCapabilitiesAMD
  { -- | @localDimmingSupport@ specifies whether the surface supports local
    -- dimming. If this is 'Vulkan.Core10.FundamentalTypes.TRUE',
    -- 'SwapchainDisplayNativeHdrCreateInfoAMD' /can/ be used to explicitly
    -- enable or disable local dimming for the surface. Local dimming may also
    -- be overriden by 'setLocalDimmingAMD' during the lifetime of the
    -- swapchain.
    DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
localDimmingSupport :: Bool }
  deriving (Typeable, DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
(DisplayNativeHdrSurfaceCapabilitiesAMD
 -> DisplayNativeHdrSurfaceCapabilitiesAMD
 -> "localDimmingEnable" ::: Bool)
-> (DisplayNativeHdrSurfaceCapabilitiesAMD
    -> DisplayNativeHdrSurfaceCapabilitiesAMD
    -> "localDimmingEnable" ::: Bool)
-> Eq DisplayNativeHdrSurfaceCapabilitiesAMD
forall a.
(a -> a -> "localDimmingEnable" ::: Bool)
-> (a -> a -> "localDimmingEnable" ::: Bool) -> Eq a
/= :: DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
$c/= :: DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
== :: DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
$c== :: DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> "localDimmingEnable" ::: Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DisplayNativeHdrSurfaceCapabilitiesAMD)
#endif
deriving instance Show DisplayNativeHdrSurfaceCapabilitiesAMD

instance ToCStruct DisplayNativeHdrSurfaceCapabilitiesAMD where
  withCStruct :: DisplayNativeHdrSurfaceCapabilitiesAMD
-> (Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b) -> IO b
withCStruct x :: DisplayNativeHdrSurfaceCapabilitiesAMD
x f :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b
f = Int
-> Int
-> (Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b) -> IO b)
-> (Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p -> Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p DisplayNativeHdrSurfaceCapabilitiesAMD
x (Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b
f Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p)
  pokeCStruct :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b -> IO b
pokeCStruct p :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p DisplayNativeHdrSurfaceCapabilitiesAMD{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("localDimmingEnable" ::: Bool32)
-> ("localDimmingEnable" ::: Bool32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (("localDimmingEnable" ::: Bool) -> "localDimmingEnable" ::: Bool32
boolToBool32 ("localDimmingEnable" ::: Bool
localDimmingSupport))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> IO b -> IO b
pokeZeroCStruct p :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("localDimmingEnable" ::: Bool32)
-> ("localDimmingEnable" ::: Bool32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (("localDimmingEnable" ::: Bool) -> "localDimmingEnable" ::: Bool32
boolToBool32 ("localDimmingEnable" ::: Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct DisplayNativeHdrSurfaceCapabilitiesAMD where
  peekCStruct :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> IO DisplayNativeHdrSurfaceCapabilitiesAMD
peekCStruct p :: Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p = do
    "localDimmingEnable" ::: Bool32
localDimmingSupport <- Ptr ("localDimmingEnable" ::: Bool32)
-> IO ("localDimmingEnable" ::: Bool32)
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
p Ptr DisplayNativeHdrSurfaceCapabilitiesAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    DisplayNativeHdrSurfaceCapabilitiesAMD
-> IO DisplayNativeHdrSurfaceCapabilitiesAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DisplayNativeHdrSurfaceCapabilitiesAMD
 -> IO DisplayNativeHdrSurfaceCapabilitiesAMD)
-> DisplayNativeHdrSurfaceCapabilitiesAMD
-> IO DisplayNativeHdrSurfaceCapabilitiesAMD
forall a b. (a -> b) -> a -> b
$ ("localDimmingEnable" ::: Bool)
-> DisplayNativeHdrSurfaceCapabilitiesAMD
DisplayNativeHdrSurfaceCapabilitiesAMD
             (("localDimmingEnable" ::: Bool32) -> "localDimmingEnable" ::: Bool
bool32ToBool "localDimmingEnable" ::: Bool32
localDimmingSupport)

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

instance Zero DisplayNativeHdrSurfaceCapabilitiesAMD where
  zero :: DisplayNativeHdrSurfaceCapabilitiesAMD
zero = ("localDimmingEnable" ::: Bool)
-> DisplayNativeHdrSurfaceCapabilitiesAMD
DisplayNativeHdrSurfaceCapabilitiesAMD
           "localDimmingEnable" ::: Bool
forall a. Zero a => a
zero


-- | VkSwapchainDisplayNativeHdrCreateInfoAMD - Structure specifying display
-- native HDR parameters of a newly created swapchain object
--
-- = Description
--
-- If the @pNext@ chain of
-- 'Vulkan.Extensions.VK_KHR_swapchain.SwapchainCreateInfoKHR' does not
-- include this structure, the default value for @localDimmingEnable@ is
-- 'Vulkan.Core10.FundamentalTypes.TRUE', meaning local dimming is
-- initially enabled for the swapchain.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSwapchainDisplayNativeHdrCreateInfoAMD-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD'
--
-- == Valid Usage
--
-- -   #VUID-VkSwapchainDisplayNativeHdrCreateInfoAMD-localDimmingEnable-04449#
--     It is only valid to set @localDimmingEnable@ to
--     'Vulkan.Core10.FundamentalTypes.TRUE' if
--     'DisplayNativeHdrSurfaceCapabilitiesAMD'::@localDimmingSupport@ is
--     supported
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data SwapchainDisplayNativeHdrCreateInfoAMD = SwapchainDisplayNativeHdrCreateInfoAMD
  { -- | @localDimmingEnable@ specifies whether local dimming is enabled for the
    -- swapchain.
    SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
localDimmingEnable :: Bool }
  deriving (Typeable, SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
(SwapchainDisplayNativeHdrCreateInfoAMD
 -> SwapchainDisplayNativeHdrCreateInfoAMD
 -> "localDimmingEnable" ::: Bool)
-> (SwapchainDisplayNativeHdrCreateInfoAMD
    -> SwapchainDisplayNativeHdrCreateInfoAMD
    -> "localDimmingEnable" ::: Bool)
-> Eq SwapchainDisplayNativeHdrCreateInfoAMD
forall a.
(a -> a -> "localDimmingEnable" ::: Bool)
-> (a -> a -> "localDimmingEnable" ::: Bool) -> Eq a
/= :: SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
$c/= :: SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
== :: SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
$c== :: SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> "localDimmingEnable" ::: Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SwapchainDisplayNativeHdrCreateInfoAMD)
#endif
deriving instance Show SwapchainDisplayNativeHdrCreateInfoAMD

instance ToCStruct SwapchainDisplayNativeHdrCreateInfoAMD where
  withCStruct :: SwapchainDisplayNativeHdrCreateInfoAMD
-> (Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b) -> IO b
withCStruct x :: SwapchainDisplayNativeHdrCreateInfoAMD
x f :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b
f = Int
-> Int
-> (Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b) -> IO b)
-> (Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p -> Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p SwapchainDisplayNativeHdrCreateInfoAMD
x (Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b
f Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p)
  pokeCStruct :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> SwapchainDisplayNativeHdrCreateInfoAMD -> IO b -> IO b
pokeCStruct p :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p SwapchainDisplayNativeHdrCreateInfoAMD{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("localDimmingEnable" ::: Bool32)
-> ("localDimmingEnable" ::: Bool32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (("localDimmingEnable" ::: Bool) -> "localDimmingEnable" ::: Bool32
boolToBool32 ("localDimmingEnable" ::: Bool
localDimmingEnable))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> IO b -> IO b
pokeZeroCStruct p :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ("localDimmingEnable" ::: Bool32)
-> ("localDimmingEnable" ::: Bool32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (("localDimmingEnable" ::: Bool) -> "localDimmingEnable" ::: Bool32
boolToBool32 ("localDimmingEnable" ::: Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct SwapchainDisplayNativeHdrCreateInfoAMD where
  peekCStruct :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> IO SwapchainDisplayNativeHdrCreateInfoAMD
peekCStruct p :: Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p = do
    "localDimmingEnable" ::: Bool32
localDimmingEnable <- Ptr ("localDimmingEnable" ::: Bool32)
-> IO ("localDimmingEnable" ::: Bool32)
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr SwapchainDisplayNativeHdrCreateInfoAMD
p Ptr SwapchainDisplayNativeHdrCreateInfoAMD
-> Int -> Ptr ("localDimmingEnable" ::: Bool32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    SwapchainDisplayNativeHdrCreateInfoAMD
-> IO SwapchainDisplayNativeHdrCreateInfoAMD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SwapchainDisplayNativeHdrCreateInfoAMD
 -> IO SwapchainDisplayNativeHdrCreateInfoAMD)
-> SwapchainDisplayNativeHdrCreateInfoAMD
-> IO SwapchainDisplayNativeHdrCreateInfoAMD
forall a b. (a -> b) -> a -> b
$ ("localDimmingEnable" ::: Bool)
-> SwapchainDisplayNativeHdrCreateInfoAMD
SwapchainDisplayNativeHdrCreateInfoAMD
             (("localDimmingEnable" ::: Bool32) -> "localDimmingEnable" ::: Bool
bool32ToBool "localDimmingEnable" ::: Bool32
localDimmingEnable)

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

instance Zero SwapchainDisplayNativeHdrCreateInfoAMD where
  zero :: SwapchainDisplayNativeHdrCreateInfoAMD
zero = ("localDimmingEnable" ::: Bool)
-> SwapchainDisplayNativeHdrCreateInfoAMD
SwapchainDisplayNativeHdrCreateInfoAMD
           "localDimmingEnable" ::: Bool
forall a. Zero a => a
zero


type AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION"
pattern AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION :: forall a . Integral a => a
pattern $bAMD_DISPLAY_NATIVE_HDR_SPEC_VERSION :: a
$mAMD_DISPLAY_NATIVE_HDR_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION = 1


type AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME = "VK_AMD_display_native_hdr"

-- No documentation found for TopLevel "VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME"
pattern AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bAMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME :: a
$mAMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME = "VK_AMD_display_native_hdr"