{-# language CPP #-}
-- | = Name
--
-- VK_AMD_anti_lag - device extension
--
-- = VK_AMD_anti_lag
--
-- [__Name String__]
--     @VK_AMD_anti_lag@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     477
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Vulkan Version 1.1>
--
-- [__Contact__]
--
--     -   Stu Smith
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_AMD_anti_lag.adoc VK_AMD_anti_lag>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2024-06-06
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Tobias Hector, AMD
--
--     -   Stuart Smith, AMD
--
--     -   Arkadiusz Sarwa, AMD
--
-- == Description
--
-- This extension automatically paces the CPU to make sure it does not get
-- too far ahead of the GPU, reducing the latency between inputs received
-- and updates on the screen. Additionally, Anti-Lag+ offers applications
-- the ability to inform the driver when input processing begins, in order
-- to align the timing of display updates, enabling even lower latency
-- between receiving input and displaying on the screen.
--
-- == New Commands
--
-- -   'antiLagUpdateAMD'
--
-- == New Structures
--
-- -   'AntiLagDataAMD'
--
-- -   'AntiLagPresentationInfoAMD'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceAntiLagFeaturesAMD'
--
-- == New Enums
--
-- -   'AntiLagModeAMD'
--
-- -   'AntiLagStageAMD'
--
-- == New Enum Constants
--
-- -   'AMD_ANTI_LAG_EXTENSION_NAME'
--
-- -   'AMD_ANTI_LAG_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_ANTI_LAG_DATA_AMD'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_ANTI_LAG_FEATURES_AMD'
--
-- == Version History
--
-- -   Revision 1, 2024-06-06 (Arkadiusz Sarw)
--
--     -   Initial version
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_AMD_anti_lag 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_anti_lag  ( antiLagUpdateAMD
                                          , PhysicalDeviceAntiLagFeaturesAMD(..)
                                          , AntiLagDataAMD(..)
                                          , AntiLagPresentationInfoAMD(..)
                                          , AntiLagModeAMD( ANTI_LAG_MODE_DRIVER_CONTROL_AMD
                                                          , ANTI_LAG_MODE_ON_AMD
                                                          , ANTI_LAG_MODE_OFF_AMD
                                                          , ..
                                                          )
                                          , AntiLagStageAMD( ANTI_LAG_STAGE_INPUT_AMD
                                                           , ANTI_LAG_STAGE_PRESENT_AMD
                                                           , ..
                                                           )
                                          , AMD_ANTI_LAG_SPEC_VERSION
                                          , pattern AMD_ANTI_LAG_SPEC_VERSION
                                          , AMD_ANTI_LAG_EXTENSION_NAME
                                          , pattern AMD_ANTI_LAG_EXTENSION_NAME
                                          ) where

import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Utils (maybePeek)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero)
import Vulkan.Zero (Zero(..))
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 Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkAntiLagUpdateAMD))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANTI_LAG_DATA_AMD))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_ANTI_LAG_FEATURES_AMD))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkAntiLagUpdateAMD
  :: FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ()) -> Ptr Device_T -> Ptr AntiLagDataAMD -> IO ()

-- | vkAntiLagUpdateAMD - Provide information to reduce latency
--
-- = Description
--
-- This command should be executed immediately before the application
-- processes user input. If @pData@ is not @NULL@ and
-- 'AntiLagDataAMD'::@pPresentationInfo@ is not @NULL@, this command
-- /should/ be executed again before
-- 'Vulkan.Extensions.VK_KHR_swapchain.queuePresentKHR', with
-- @pPresentationInfo@ set to matching values.
--
-- == Valid Usage
--
-- -   #VUID-vkAntiLagUpdateAMD-antiLag-10061# The
--     <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-antiLag antiLag>
--     feature /must/ be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkAntiLagUpdateAMD-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkAntiLagUpdateAMD-pData-parameter# @pData@ /must/ be a valid
--     pointer to a valid 'AntiLagDataAMD' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'AntiLagDataAMD', 'Vulkan.Core10.Handles.Device'
antiLagUpdateAMD :: forall io
                  . (MonadIO io)
                 => -- | @device@ is the logical device
                    Device
                 -> -- | @pData@ is a pointer to a 'AntiLagDataAMD' structure containing latency
                    -- reduction parameters.
                    AntiLagDataAMD
                 -> io ()
antiLagUpdateAMD :: forall (io :: * -> *).
MonadIO io =>
Device -> AntiLagDataAMD -> io ()
antiLagUpdateAMD Device
device AntiLagDataAMD
data' = IO () -> io ()
forall a. IO a -> io a
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 vkAntiLagUpdateAMDPtr :: FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
vkAntiLagUpdateAMDPtr = DeviceCmds -> FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
pVkAntiLagUpdateAMD (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
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 -> Ptr AntiLagDataAMD -> IO ())
vkAntiLagUpdateAMDPtr FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
-> FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ()) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 String
"" String
"The function pointer for vkAntiLagUpdateAMD is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkAntiLagUpdateAMD' :: Ptr Device_T -> Ptr AntiLagDataAMD -> IO ()
vkAntiLagUpdateAMD' = FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
-> Ptr Device_T -> Ptr AntiLagDataAMD -> IO ()
mkVkAntiLagUpdateAMD FunPtr (Ptr Device_T -> Ptr AntiLagDataAMD -> IO ())
vkAntiLagUpdateAMDPtr
  pData <- ((Ptr AntiLagDataAMD -> IO ()) -> IO ())
-> ContT () IO (Ptr AntiLagDataAMD)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AntiLagDataAMD -> IO ()) -> IO ())
 -> ContT () IO (Ptr AntiLagDataAMD))
-> ((Ptr AntiLagDataAMD -> IO ()) -> IO ())
-> ContT () IO (Ptr AntiLagDataAMD)
forall a b. (a -> b) -> a -> b
$ AntiLagDataAMD -> (Ptr AntiLagDataAMD -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b. AntiLagDataAMD -> (Ptr AntiLagDataAMD -> IO b) -> IO b
withCStruct (AntiLagDataAMD
data')
  lift $ traceAroundEvent "vkAntiLagUpdateAMD" (vkAntiLagUpdateAMD'
                                                  (deviceHandle (device))
                                                  pData)
  pure $ ()


-- | VkPhysicalDeviceAntiLagFeaturesAMD - Structure describing whether
-- VK_AMD_anti_lag can be supported by an implementation.
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceAntiLagFeaturesAMD' structure is included in the
-- @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. If the application wishes to use a
-- 'Vulkan.Core10.Handles.Device' with any features described by
-- 'PhysicalDeviceAntiLagFeaturesAMD', it /must/ add an instance of the
-- structure, with the desired feature members set to
-- 'Vulkan.Core10.FundamentalTypes.TRUE', to the @pNext@ chain of
-- 'Vulkan.Core10.Device.DeviceCreateInfo' when creating the
-- 'Vulkan.Core10.Handles.Device'.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceAntiLagFeaturesAMD = PhysicalDeviceAntiLagFeaturesAMD
  { -- | #features-antiLag# @antiLag@ indicates whether the implementation
    -- supports AMD Radeon™ Anti-Lag functionality. The @antiLag@ feature only
    -- supports a single GPU and /must/ not be enabled if
    -- 'Vulkan.Core11.Promoted_From_VK_KHR_device_group_creation.DeviceGroupDeviceCreateInfo'::@physicalDeviceCount@
    -- is greater than 1.
    PhysicalDeviceAntiLagFeaturesAMD -> Bool
antiLag :: Bool }
  deriving (Typeable, PhysicalDeviceAntiLagFeaturesAMD
-> PhysicalDeviceAntiLagFeaturesAMD -> Bool
(PhysicalDeviceAntiLagFeaturesAMD
 -> PhysicalDeviceAntiLagFeaturesAMD -> Bool)
-> (PhysicalDeviceAntiLagFeaturesAMD
    -> PhysicalDeviceAntiLagFeaturesAMD -> Bool)
-> Eq PhysicalDeviceAntiLagFeaturesAMD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceAntiLagFeaturesAMD
-> PhysicalDeviceAntiLagFeaturesAMD -> Bool
== :: PhysicalDeviceAntiLagFeaturesAMD
-> PhysicalDeviceAntiLagFeaturesAMD -> Bool
$c/= :: PhysicalDeviceAntiLagFeaturesAMD
-> PhysicalDeviceAntiLagFeaturesAMD -> Bool
/= :: PhysicalDeviceAntiLagFeaturesAMD
-> PhysicalDeviceAntiLagFeaturesAMD -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceAntiLagFeaturesAMD)
#endif
deriving instance Show PhysicalDeviceAntiLagFeaturesAMD

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

instance FromCStruct PhysicalDeviceAntiLagFeaturesAMD where
  peekCStruct :: Ptr PhysicalDeviceAntiLagFeaturesAMD
-> IO PhysicalDeviceAntiLagFeaturesAMD
peekCStruct Ptr PhysicalDeviceAntiLagFeaturesAMD
p = do
    antiLag <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceAntiLagFeaturesAMD
p Ptr PhysicalDeviceAntiLagFeaturesAMD -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    pure $ PhysicalDeviceAntiLagFeaturesAMD
             (bool32ToBool antiLag)

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

instance Zero PhysicalDeviceAntiLagFeaturesAMD where
  zero :: PhysicalDeviceAntiLagFeaturesAMD
zero = Bool -> PhysicalDeviceAntiLagFeaturesAMD
PhysicalDeviceAntiLagFeaturesAMD
           Bool
forall a. Zero a => a
zero


-- | VkAntiLagDataAMD - Structure specifying the parameters for
-- vkAntiLagUpdateAMD
--
-- = Description
--
-- This structure specifies anti-lag parameters.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkAntiLagDataAMD-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_ANTI_LAG_DATA_AMD'
--
-- -   #VUID-VkAntiLagDataAMD-mode-parameter# @mode@ /must/ be a valid
--     'AntiLagModeAMD' value
--
-- -   #VUID-VkAntiLagDataAMD-pPresentationInfo-parameter# If
--     @pPresentationInfo@ is not @NULL@, @pPresentationInfo@ /must/ be a
--     valid pointer to a valid 'AntiLagPresentationInfoAMD' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'AntiLagModeAMD', 'AntiLagPresentationInfoAMD',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'antiLagUpdateAMD'
data AntiLagDataAMD = AntiLagDataAMD
  { -- | @mode@ is a 'AntiLagModeAMD' value specifying the anti-lag status.
    AntiLagDataAMD -> AntiLagModeAMD
mode :: AntiLagModeAMD
  , -- | @maxFPS@ is the framerate limit, in frames per second, used by the
    -- application. This limit will be imposed if anti-lag is enabled. If the
    -- application tries to render faster, the framerate will be reduced to
    -- match this limit. A value of 0 will disable the limit.
    AntiLagDataAMD -> Word32
maxFPS :: Word32
  , -- | @pPresentationInfo@ is a pointer to a 'AntiLagPresentationInfoAMD'
    -- structure containing information about the application stage.
    AntiLagDataAMD -> Maybe AntiLagPresentationInfoAMD
presentationInfo :: Maybe AntiLagPresentationInfoAMD
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AntiLagDataAMD)
#endif
deriving instance Show AntiLagDataAMD

instance ToCStruct AntiLagDataAMD where
  withCStruct :: forall b. AntiLagDataAMD -> (Ptr AntiLagDataAMD -> IO b) -> IO b
withCStruct AntiLagDataAMD
x Ptr AntiLagDataAMD -> IO b
f = Int -> (Ptr AntiLagDataAMD -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr AntiLagDataAMD -> IO b) -> IO b)
-> (Ptr AntiLagDataAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr AntiLagDataAMD
p -> Ptr AntiLagDataAMD -> AntiLagDataAMD -> IO b -> IO b
forall b. Ptr AntiLagDataAMD -> AntiLagDataAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AntiLagDataAMD
p AntiLagDataAMD
x (Ptr AntiLagDataAMD -> IO b
f Ptr AntiLagDataAMD
p)
  pokeCStruct :: forall b. Ptr AntiLagDataAMD -> AntiLagDataAMD -> IO b -> IO b
pokeCStruct Ptr AntiLagDataAMD
p AntiLagDataAMD{Maybe AntiLagPresentationInfoAMD
Word32
AntiLagModeAMD
mode :: AntiLagDataAMD -> AntiLagModeAMD
maxFPS :: AntiLagDataAMD -> Word32
presentationInfo :: AntiLagDataAMD -> Maybe AntiLagPresentationInfoAMD
mode :: AntiLagModeAMD
maxFPS :: Word32
presentationInfo :: Maybe AntiLagPresentationInfoAMD
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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 ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANTI_LAG_DATA_AMD)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 AntiLagModeAMD -> AntiLagModeAMD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr AntiLagModeAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagModeAMD)) (AntiLagModeAMD
mode)
    IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
maxFPS)
    pPresentationInfo'' <- case (Maybe AntiLagPresentationInfoAMD
presentationInfo) of
      Maybe AntiLagPresentationInfoAMD
Nothing -> Ptr AntiLagPresentationInfoAMD
-> ContT b IO (Ptr AntiLagPresentationInfoAMD)
forall a. a -> ContT b IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AntiLagPresentationInfoAMD
forall a. Ptr a
nullPtr
      Just AntiLagPresentationInfoAMD
j -> ((Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b)
-> ContT b IO (Ptr AntiLagPresentationInfoAMD)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b)
 -> ContT b IO (Ptr AntiLagPresentationInfoAMD))
-> ((Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b)
-> ContT b IO (Ptr AntiLagPresentationInfoAMD)
forall a b. (a -> b) -> a -> b
$ AntiLagPresentationInfoAMD
-> (Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AntiLagPresentationInfoAMD
-> (Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b
withCStruct (AntiLagPresentationInfoAMD
j)
    lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr AntiLagPresentationInfoAMD))) pPresentationInfo''
    lift $ f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr AntiLagDataAMD -> IO b -> IO b
pokeZeroCStruct Ptr AntiLagDataAMD
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANTI_LAG_DATA_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr AntiLagModeAMD -> AntiLagModeAMD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr AntiLagModeAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagModeAMD)) (AntiLagModeAMD
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct AntiLagDataAMD where
  peekCStruct :: Ptr AntiLagDataAMD -> IO AntiLagDataAMD
peekCStruct Ptr AntiLagDataAMD
p = do
    mode <- forall a. Storable a => Ptr a -> IO a
peek @AntiLagModeAMD ((Ptr AntiLagDataAMD
p Ptr AntiLagDataAMD -> Int -> Ptr AntiLagModeAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagModeAMD))
    maxFPS <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
    pPresentationInfo <- peek @(Ptr AntiLagPresentationInfoAMD) ((p `plusPtr` 24 :: Ptr (Ptr AntiLagPresentationInfoAMD)))
    pPresentationInfo' <- maybePeek (\Ptr AntiLagPresentationInfoAMD
j -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @AntiLagPresentationInfoAMD (Ptr AntiLagPresentationInfoAMD
j)) pPresentationInfo
    pure $ AntiLagDataAMD
             mode maxFPS pPresentationInfo'

instance Zero AntiLagDataAMD where
  zero :: AntiLagDataAMD
zero = AntiLagModeAMD
-> Word32 -> Maybe AntiLagPresentationInfoAMD -> AntiLagDataAMD
AntiLagDataAMD
           AntiLagModeAMD
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Maybe AntiLagPresentationInfoAMD
forall a. Maybe a
Nothing


-- | VkAntiLagPresentationInfoAMD - Structure specifying information about
-- stage
--
-- = Description
--
-- This structure specifies information about the presentation stage for
-- which anti-lag parameters are being set.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'AntiLagDataAMD', 'AntiLagStageAMD',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data AntiLagPresentationInfoAMD = AntiLagPresentationInfoAMD
  { -- | @stage@ is a 'AntiLagStageAMD' value specifying the current application
    -- stage.
    --
    -- #VUID-VkAntiLagPresentationInfoAMD-stage-parameter# @stage@ /must/ be a
    -- valid 'AntiLagStageAMD' value
    AntiLagPresentationInfoAMD -> AntiLagStageAMD
stage :: AntiLagStageAMD
  , -- | @frameIndex@ is set just before the application processes input data
    -- ('ANTI_LAG_STAGE_INPUT_AMD'). The same @frameIndex@ value /should/ be
    -- set before the frame with current input data will be presented by
    -- 'Vulkan.Extensions.VK_KHR_swapchain.queuePresentKHR'
    -- ('ANTI_LAG_STAGE_PRESENT_AMD'). This /should/ be done for each frame.
    AntiLagPresentationInfoAMD -> Word64
frameIndex :: Word64
  }
  deriving (Typeable, AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool
(AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool)
-> (AntiLagPresentationInfoAMD
    -> AntiLagPresentationInfoAMD -> Bool)
-> Eq AntiLagPresentationInfoAMD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool
== :: AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool
$c/= :: AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool
/= :: AntiLagPresentationInfoAMD -> AntiLagPresentationInfoAMD -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AntiLagPresentationInfoAMD)
#endif
deriving instance Show AntiLagPresentationInfoAMD

instance ToCStruct AntiLagPresentationInfoAMD where
  withCStruct :: forall b.
AntiLagPresentationInfoAMD
-> (Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b
withCStruct AntiLagPresentationInfoAMD
x Ptr AntiLagPresentationInfoAMD -> IO b
f = Int -> (Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b)
-> (Ptr AntiLagPresentationInfoAMD -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr AntiLagPresentationInfoAMD
p -> Ptr AntiLagPresentationInfoAMD
-> AntiLagPresentationInfoAMD -> IO b -> IO b
forall b.
Ptr AntiLagPresentationInfoAMD
-> AntiLagPresentationInfoAMD -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AntiLagPresentationInfoAMD
p AntiLagPresentationInfoAMD
x (Ptr AntiLagPresentationInfoAMD -> IO b
f Ptr AntiLagPresentationInfoAMD
p)
  pokeCStruct :: forall b.
Ptr AntiLagPresentationInfoAMD
-> AntiLagPresentationInfoAMD -> IO b -> IO b
pokeCStruct Ptr AntiLagPresentationInfoAMD
p AntiLagPresentationInfoAMD{Word64
AntiLagStageAMD
stage :: AntiLagPresentationInfoAMD -> AntiLagStageAMD
frameIndex :: AntiLagPresentationInfoAMD -> Word64
stage :: AntiLagStageAMD
frameIndex :: Word64
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr AntiLagStageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagStageAMD)) (AntiLagStageAMD
stage)
    Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word64)) (Word64
frameIndex)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr AntiLagPresentationInfoAMD -> IO b -> IO b
pokeZeroCStruct Ptr AntiLagPresentationInfoAMD
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr AntiLagStageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagStageAMD)) (AntiLagStageAMD
forall a. Zero a => a
zero)
    Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word64)) (Word64
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct AntiLagPresentationInfoAMD where
  peekCStruct :: Ptr AntiLagPresentationInfoAMD -> IO AntiLagPresentationInfoAMD
peekCStruct Ptr AntiLagPresentationInfoAMD
p = do
    stage <- forall a. Storable a => Ptr a -> IO a
peek @AntiLagStageAMD ((Ptr AntiLagPresentationInfoAMD
p Ptr AntiLagPresentationInfoAMD -> Int -> Ptr AntiLagStageAMD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AntiLagStageAMD))
    frameIndex <- peek @Word64 ((p `plusPtr` 24 :: Ptr Word64))
    pure $ AntiLagPresentationInfoAMD
             stage frameIndex

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

instance Zero AntiLagPresentationInfoAMD where
  zero :: AntiLagPresentationInfoAMD
zero = AntiLagStageAMD -> Word64 -> AntiLagPresentationInfoAMD
AntiLagPresentationInfoAMD
           AntiLagStageAMD
forall a. Zero a => a
zero
           Word64
forall a. Zero a => a
zero


-- | VkAntiLagModeAMD - Set the status of the anti-lag feature
--
-- = Description
--
-- -   'ANTI_LAG_MODE_DRIVER_CONTROL_AMD' specifies that anti-lag will be
--     enabled or disabled depending on driver settings.
--
-- -   'ANTI_LAG_MODE_ON_AMD' specifies that anti-lag will be enabled.
--
-- -   'ANTI_LAG_MODE_OFF_AMD' specifies that anti-lag will be disabled.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'AntiLagDataAMD'
newtype AntiLagModeAMD = AntiLagModeAMD Int32
  deriving newtype (AntiLagModeAMD -> AntiLagModeAMD -> Bool
(AntiLagModeAMD -> AntiLagModeAMD -> Bool)
-> (AntiLagModeAMD -> AntiLagModeAMD -> Bool) -> Eq AntiLagModeAMD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
== :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
$c/= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
/= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
Eq, Eq AntiLagModeAMD
Eq AntiLagModeAMD =>
(AntiLagModeAMD -> AntiLagModeAMD -> Ordering)
-> (AntiLagModeAMD -> AntiLagModeAMD -> Bool)
-> (AntiLagModeAMD -> AntiLagModeAMD -> Bool)
-> (AntiLagModeAMD -> AntiLagModeAMD -> Bool)
-> (AntiLagModeAMD -> AntiLagModeAMD -> Bool)
-> (AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD)
-> (AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD)
-> Ord AntiLagModeAMD
AntiLagModeAMD -> AntiLagModeAMD -> Bool
AntiLagModeAMD -> AntiLagModeAMD -> Ordering
AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: AntiLagModeAMD -> AntiLagModeAMD -> Ordering
compare :: AntiLagModeAMD -> AntiLagModeAMD -> Ordering
$c< :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
< :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
$c<= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
<= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
$c> :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
> :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
$c>= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
>= :: AntiLagModeAMD -> AntiLagModeAMD -> Bool
$cmax :: AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD
max :: AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD
$cmin :: AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD
min :: AntiLagModeAMD -> AntiLagModeAMD -> AntiLagModeAMD
Ord, Ptr AntiLagModeAMD -> IO AntiLagModeAMD
Ptr AntiLagModeAMD -> Int -> IO AntiLagModeAMD
Ptr AntiLagModeAMD -> Int -> AntiLagModeAMD -> IO ()
Ptr AntiLagModeAMD -> AntiLagModeAMD -> IO ()
AntiLagModeAMD -> Int
(AntiLagModeAMD -> Int)
-> (AntiLagModeAMD -> Int)
-> (Ptr AntiLagModeAMD -> Int -> IO AntiLagModeAMD)
-> (Ptr AntiLagModeAMD -> Int -> AntiLagModeAMD -> IO ())
-> (forall b. Ptr b -> Int -> IO AntiLagModeAMD)
-> (forall b. Ptr b -> Int -> AntiLagModeAMD -> IO ())
-> (Ptr AntiLagModeAMD -> IO AntiLagModeAMD)
-> (Ptr AntiLagModeAMD -> AntiLagModeAMD -> IO ())
-> Storable AntiLagModeAMD
forall b. Ptr b -> Int -> IO AntiLagModeAMD
forall b. Ptr b -> Int -> AntiLagModeAMD -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: AntiLagModeAMD -> Int
sizeOf :: AntiLagModeAMD -> Int
$calignment :: AntiLagModeAMD -> Int
alignment :: AntiLagModeAMD -> Int
$cpeekElemOff :: Ptr AntiLagModeAMD -> Int -> IO AntiLagModeAMD
peekElemOff :: Ptr AntiLagModeAMD -> Int -> IO AntiLagModeAMD
$cpokeElemOff :: Ptr AntiLagModeAMD -> Int -> AntiLagModeAMD -> IO ()
pokeElemOff :: Ptr AntiLagModeAMD -> Int -> AntiLagModeAMD -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO AntiLagModeAMD
peekByteOff :: forall b. Ptr b -> Int -> IO AntiLagModeAMD
$cpokeByteOff :: forall b. Ptr b -> Int -> AntiLagModeAMD -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> AntiLagModeAMD -> IO ()
$cpeek :: Ptr AntiLagModeAMD -> IO AntiLagModeAMD
peek :: Ptr AntiLagModeAMD -> IO AntiLagModeAMD
$cpoke :: Ptr AntiLagModeAMD -> AntiLagModeAMD -> IO ()
poke :: Ptr AntiLagModeAMD -> AntiLagModeAMD -> IO ()
Storable, AntiLagModeAMD
AntiLagModeAMD -> Zero AntiLagModeAMD
forall a. a -> Zero a
$czero :: AntiLagModeAMD
zero :: AntiLagModeAMD
Zero)

-- No documentation found for Nested "VkAntiLagModeAMD" "VK_ANTI_LAG_MODE_DRIVER_CONTROL_AMD"
pattern $mANTI_LAG_MODE_DRIVER_CONTROL_AMD :: forall {r}. AntiLagModeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
$bANTI_LAG_MODE_DRIVER_CONTROL_AMD :: AntiLagModeAMD
ANTI_LAG_MODE_DRIVER_CONTROL_AMD = AntiLagModeAMD 0

-- No documentation found for Nested "VkAntiLagModeAMD" "VK_ANTI_LAG_MODE_ON_AMD"
pattern $mANTI_LAG_MODE_ON_AMD :: forall {r}. AntiLagModeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
$bANTI_LAG_MODE_ON_AMD :: AntiLagModeAMD
ANTI_LAG_MODE_ON_AMD = AntiLagModeAMD 1

-- No documentation found for Nested "VkAntiLagModeAMD" "VK_ANTI_LAG_MODE_OFF_AMD"
pattern $mANTI_LAG_MODE_OFF_AMD :: forall {r}. AntiLagModeAMD -> ((# #) -> r) -> ((# #) -> r) -> r
$bANTI_LAG_MODE_OFF_AMD :: AntiLagModeAMD
ANTI_LAG_MODE_OFF_AMD = AntiLagModeAMD 2

{-# COMPLETE
  ANTI_LAG_MODE_DRIVER_CONTROL_AMD
  , ANTI_LAG_MODE_ON_AMD
  , ANTI_LAG_MODE_OFF_AMD ::
    AntiLagModeAMD
  #-}

conNameAntiLagModeAMD :: String
conNameAntiLagModeAMD :: String
conNameAntiLagModeAMD = String
"AntiLagModeAMD"

enumPrefixAntiLagModeAMD :: String
enumPrefixAntiLagModeAMD :: String
enumPrefixAntiLagModeAMD = String
"ANTI_LAG_MODE_"

showTableAntiLagModeAMD :: [(AntiLagModeAMD, String)]
showTableAntiLagModeAMD :: [(AntiLagModeAMD, String)]
showTableAntiLagModeAMD =
  [
    ( AntiLagModeAMD
ANTI_LAG_MODE_DRIVER_CONTROL_AMD
    , String
"DRIVER_CONTROL_AMD"
    )
  , (AntiLagModeAMD
ANTI_LAG_MODE_ON_AMD, String
"ON_AMD")
  , (AntiLagModeAMD
ANTI_LAG_MODE_OFF_AMD, String
"OFF_AMD")
  ]

instance Show AntiLagModeAMD where
  showsPrec :: Int -> AntiLagModeAMD -> ShowS
showsPrec =
    String
-> [(AntiLagModeAMD, String)]
-> String
-> (AntiLagModeAMD -> Int32)
-> (Int32 -> ShowS)
-> Int
-> AntiLagModeAMD
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixAntiLagModeAMD
      [(AntiLagModeAMD, String)]
showTableAntiLagModeAMD
      String
conNameAntiLagModeAMD
      (\(AntiLagModeAMD Int32
x) -> Int32
x)
      (Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)

instance Read AntiLagModeAMD where
  readPrec :: ReadPrec AntiLagModeAMD
readPrec =
    String
-> [(AntiLagModeAMD, String)]
-> String
-> (Int32 -> AntiLagModeAMD)
-> ReadPrec AntiLagModeAMD
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixAntiLagModeAMD
      [(AntiLagModeAMD, String)]
showTableAntiLagModeAMD
      String
conNameAntiLagModeAMD
      Int32 -> AntiLagModeAMD
AntiLagModeAMD

-- | VkAntiLagStageAMD - Report the application stage
--
-- = Description
--
-- -   'ANTI_LAG_STAGE_INPUT_AMD' specifies the stage before processing
--     input.
--
-- -   'ANTI_LAG_STAGE_PRESENT_AMD' specifies the stage before
--     'Vulkan.Extensions.VK_KHR_swapchain.queuePresentKHR'.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_AMD_anti_lag VK_AMD_anti_lag>,
-- 'AntiLagPresentationInfoAMD'
newtype AntiLagStageAMD = AntiLagStageAMD Int32
  deriving newtype (AntiLagStageAMD -> AntiLagStageAMD -> Bool
(AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> (AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> Eq AntiLagStageAMD
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
== :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
$c/= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
/= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
Eq, Eq AntiLagStageAMD
Eq AntiLagStageAMD =>
(AntiLagStageAMD -> AntiLagStageAMD -> Ordering)
-> (AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> (AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> (AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> (AntiLagStageAMD -> AntiLagStageAMD -> Bool)
-> (AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD)
-> (AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD)
-> Ord AntiLagStageAMD
AntiLagStageAMD -> AntiLagStageAMD -> Bool
AntiLagStageAMD -> AntiLagStageAMD -> Ordering
AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: AntiLagStageAMD -> AntiLagStageAMD -> Ordering
compare :: AntiLagStageAMD -> AntiLagStageAMD -> Ordering
$c< :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
< :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
$c<= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
<= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
$c> :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
> :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
$c>= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
>= :: AntiLagStageAMD -> AntiLagStageAMD -> Bool
$cmax :: AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD
max :: AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD
$cmin :: AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD
min :: AntiLagStageAMD -> AntiLagStageAMD -> AntiLagStageAMD
Ord, Ptr AntiLagStageAMD -> IO AntiLagStageAMD
Ptr AntiLagStageAMD -> Int -> IO AntiLagStageAMD
Ptr AntiLagStageAMD -> Int -> AntiLagStageAMD -> IO ()
Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ()
AntiLagStageAMD -> Int
(AntiLagStageAMD -> Int)
-> (AntiLagStageAMD -> Int)
-> (Ptr AntiLagStageAMD -> Int -> IO AntiLagStageAMD)
-> (Ptr AntiLagStageAMD -> Int -> AntiLagStageAMD -> IO ())
-> (forall b. Ptr b -> Int -> IO AntiLagStageAMD)
-> (forall b. Ptr b -> Int -> AntiLagStageAMD -> IO ())
-> (Ptr AntiLagStageAMD -> IO AntiLagStageAMD)
-> (Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ())
-> Storable AntiLagStageAMD
forall b. Ptr b -> Int -> IO AntiLagStageAMD
forall b. Ptr b -> Int -> AntiLagStageAMD -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: AntiLagStageAMD -> Int
sizeOf :: AntiLagStageAMD -> Int
$calignment :: AntiLagStageAMD -> Int
alignment :: AntiLagStageAMD -> Int
$cpeekElemOff :: Ptr AntiLagStageAMD -> Int -> IO AntiLagStageAMD
peekElemOff :: Ptr AntiLagStageAMD -> Int -> IO AntiLagStageAMD
$cpokeElemOff :: Ptr AntiLagStageAMD -> Int -> AntiLagStageAMD -> IO ()
pokeElemOff :: Ptr AntiLagStageAMD -> Int -> AntiLagStageAMD -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO AntiLagStageAMD
peekByteOff :: forall b. Ptr b -> Int -> IO AntiLagStageAMD
$cpokeByteOff :: forall b. Ptr b -> Int -> AntiLagStageAMD -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> AntiLagStageAMD -> IO ()
$cpeek :: Ptr AntiLagStageAMD -> IO AntiLagStageAMD
peek :: Ptr AntiLagStageAMD -> IO AntiLagStageAMD
$cpoke :: Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ()
poke :: Ptr AntiLagStageAMD -> AntiLagStageAMD -> IO ()
Storable, AntiLagStageAMD
AntiLagStageAMD -> Zero AntiLagStageAMD
forall a. a -> Zero a
$czero :: AntiLagStageAMD
zero :: AntiLagStageAMD
Zero)

-- No documentation found for Nested "VkAntiLagStageAMD" "VK_ANTI_LAG_STAGE_INPUT_AMD"
pattern $mANTI_LAG_STAGE_INPUT_AMD :: forall {r}. AntiLagStageAMD -> ((# #) -> r) -> ((# #) -> r) -> r
$bANTI_LAG_STAGE_INPUT_AMD :: AntiLagStageAMD
ANTI_LAG_STAGE_INPUT_AMD = AntiLagStageAMD 0

-- No documentation found for Nested "VkAntiLagStageAMD" "VK_ANTI_LAG_STAGE_PRESENT_AMD"
pattern $mANTI_LAG_STAGE_PRESENT_AMD :: forall {r}. AntiLagStageAMD -> ((# #) -> r) -> ((# #) -> r) -> r
$bANTI_LAG_STAGE_PRESENT_AMD :: AntiLagStageAMD
ANTI_LAG_STAGE_PRESENT_AMD = AntiLagStageAMD 1

{-# COMPLETE
  ANTI_LAG_STAGE_INPUT_AMD
  , ANTI_LAG_STAGE_PRESENT_AMD ::
    AntiLagStageAMD
  #-}

conNameAntiLagStageAMD :: String
conNameAntiLagStageAMD :: String
conNameAntiLagStageAMD = String
"AntiLagStageAMD"

enumPrefixAntiLagStageAMD :: String
enumPrefixAntiLagStageAMD :: String
enumPrefixAntiLagStageAMD = String
"ANTI_LAG_STAGE_"

showTableAntiLagStageAMD :: [(AntiLagStageAMD, String)]
showTableAntiLagStageAMD :: [(AntiLagStageAMD, String)]
showTableAntiLagStageAMD =
  [ (AntiLagStageAMD
ANTI_LAG_STAGE_INPUT_AMD, String
"INPUT_AMD")
  , (AntiLagStageAMD
ANTI_LAG_STAGE_PRESENT_AMD, String
"PRESENT_AMD")
  ]

instance Show AntiLagStageAMD where
  showsPrec :: Int -> AntiLagStageAMD -> ShowS
showsPrec =
    String
-> [(AntiLagStageAMD, String)]
-> String
-> (AntiLagStageAMD -> Int32)
-> (Int32 -> ShowS)
-> Int
-> AntiLagStageAMD
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixAntiLagStageAMD
      [(AntiLagStageAMD, String)]
showTableAntiLagStageAMD
      String
conNameAntiLagStageAMD
      (\(AntiLagStageAMD Int32
x) -> Int32
x)
      (Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11)

instance Read AntiLagStageAMD where
  readPrec :: ReadPrec AntiLagStageAMD
readPrec =
    String
-> [(AntiLagStageAMD, String)]
-> String
-> (Int32 -> AntiLagStageAMD)
-> ReadPrec AntiLagStageAMD
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixAntiLagStageAMD
      [(AntiLagStageAMD, String)]
showTableAntiLagStageAMD
      String
conNameAntiLagStageAMD
      Int32 -> AntiLagStageAMD
AntiLagStageAMD

type AMD_ANTI_LAG_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_AMD_ANTI_LAG_SPEC_VERSION"
pattern AMD_ANTI_LAG_SPEC_VERSION :: forall a . Integral a => a
pattern $mAMD_ANTI_LAG_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bAMD_ANTI_LAG_SPEC_VERSION :: forall a. Integral a => a
AMD_ANTI_LAG_SPEC_VERSION = 1


type AMD_ANTI_LAG_EXTENSION_NAME = "VK_AMD_anti_lag"

-- No documentation found for TopLevel "VK_AMD_ANTI_LAG_EXTENSION_NAME"
pattern AMD_ANTI_LAG_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mAMD_ANTI_LAG_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bAMD_ANTI_LAG_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
AMD_ANTI_LAG_EXTENSION_NAME = "VK_AMD_anti_lag"