{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_KHR_timeline_semaphore"
module Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore  ( getSemaphoreCounterValue
                                                              , waitSemaphores
                                                              , waitSemaphoresSafe
                                                              , signalSemaphore
                                                              , PhysicalDeviceTimelineSemaphoreFeatures(..)
                                                              , PhysicalDeviceTimelineSemaphoreProperties(..)
                                                              , SemaphoreTypeCreateInfo(..)
                                                              , TimelineSemaphoreSubmitInfo(..)
                                                              , SemaphoreWaitInfo(..)
                                                              , SemaphoreSignalInfo(..)
                                                              , StructureType(..)
                                                              , SemaphoreType(..)
                                                              , SemaphoreWaitFlagBits(..)
                                                              , SemaphoreWaitFlags
                                                              ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
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 Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import qualified Data.Vector (null)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
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.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetSemaphoreCounterValue))
import Vulkan.Dynamic (DeviceCmds(pVkSignalSemaphore))
import Vulkan.Dynamic (DeviceCmds(pVkWaitSemaphores))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Semaphore)
import Vulkan.Core10.Handles (Semaphore(..))
import Vulkan.Core12.Enums.SemaphoreType (SemaphoreType)
import Vulkan.Core12.Enums.SemaphoreWaitFlagBits (SemaphoreWaitFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core12.Enums.SemaphoreType (SemaphoreType(..))
import Vulkan.Core12.Enums.SemaphoreWaitFlagBits (SemaphoreWaitFlagBits(..))
import Vulkan.Core12.Enums.SemaphoreWaitFlagBits (SemaphoreWaitFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetSemaphoreCounterValue
  :: FunPtr (Ptr Device_T -> Semaphore -> Ptr Word64 -> IO Result) -> Ptr Device_T -> Semaphore -> Ptr Word64 -> IO Result

-- | vkGetSemaphoreCounterValue - Query the current state of a timeline
-- semaphore
--
-- = Description
--
-- Note
--
-- If a
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#devsandqueues-submission queue submission>
-- command is pending execution, then the value returned by this command
-- /may/ immediately be out of date.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_DEVICE_LOST'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'Vulkan.Core10.Handles.Semaphore'
getSemaphoreCounterValue :: forall io
                          . (MonadIO io)
                         => -- | @device@ is the logical device that owns the semaphore.
                            --
                            -- #VUID-vkGetSemaphoreCounterValue-device-parameter# @device@ /must/ be a
                            -- valid 'Vulkan.Core10.Handles.Device' handle
                            Device
                         -> -- | @semaphore@ is the handle of the semaphore to query.
                            --
                            -- #VUID-vkGetSemaphoreCounterValue-semaphore-03255# @semaphore@ /must/
                            -- have been created with a
                            -- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
                            -- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
                            --
                            -- #VUID-vkGetSemaphoreCounterValue-semaphore-parameter# @semaphore@ /must/
                            -- be a valid 'Vulkan.Core10.Handles.Semaphore' handle
                            --
                            -- #VUID-vkGetSemaphoreCounterValue-semaphore-parent# @semaphore@ /must/
                            -- have been created, allocated, or retrieved from @device@
                            Semaphore
                         -> io (("value" ::: Word64))
getSemaphoreCounterValue :: Device -> Semaphore -> io ("value" ::: Word64)
getSemaphoreCounterValue device :: Device
device semaphore :: Semaphore
semaphore = IO ("value" ::: Word64) -> io ("value" ::: Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("value" ::: Word64) -> io ("value" ::: Word64))
-> (ContT ("value" ::: Word64) IO ("value" ::: Word64)
    -> IO ("value" ::: Word64))
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
-> io ("value" ::: Word64)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ("value" ::: Word64) IO ("value" ::: Word64)
-> IO ("value" ::: Word64)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ("value" ::: Word64) IO ("value" ::: Word64)
 -> io ("value" ::: Word64))
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
-> io ("value" ::: Word64)
forall a b. (a -> b) -> a -> b
$ do
  let vkGetSemaphoreCounterValuePtr :: FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
vkGetSemaphoreCounterValuePtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Semaphore
      -> ("pValue" ::: Ptr ("value" ::: Word64))
      -> IO Result)
pVkGetSemaphoreCounterValue (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT ("value" ::: Word64) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("value" ::: Word64) IO ())
-> IO () -> ContT ("value" ::: Word64) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
vkGetSemaphoreCounterValuePtr FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> Semaphore
      -> ("pValue" ::: Ptr ("value" ::: Word64))
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
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 vkGetSemaphoreCounterValue is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetSemaphoreCounterValue' :: Ptr Device_T
-> Semaphore
-> ("pValue" ::: Ptr ("value" ::: Word64))
-> IO Result
vkGetSemaphoreCounterValue' = FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
-> Ptr Device_T
-> Semaphore
-> ("pValue" ::: Ptr ("value" ::: Word64))
-> IO Result
mkVkGetSemaphoreCounterValue FunPtr
  (Ptr Device_T
   -> Semaphore
   -> ("pValue" ::: Ptr ("value" ::: Word64))
   -> IO Result)
vkGetSemaphoreCounterValuePtr
  "pValue" ::: Ptr ("value" ::: Word64)
pPValue <- ((("pValue" ::: Ptr ("value" ::: Word64))
  -> IO ("value" ::: Word64))
 -> IO ("value" ::: Word64))
-> ContT
     ("value" ::: Word64) IO ("pValue" ::: Ptr ("value" ::: Word64))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pValue" ::: Ptr ("value" ::: Word64))
   -> IO ("value" ::: Word64))
  -> IO ("value" ::: Word64))
 -> ContT
      ("value" ::: Word64) IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ((("pValue" ::: Ptr ("value" ::: Word64))
     -> IO ("value" ::: Word64))
    -> IO ("value" ::: Word64))
-> ContT
     ("value" ::: Word64) IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ IO ("pValue" ::: Ptr ("value" ::: Word64))
-> (("pValue" ::: Ptr ("value" ::: Word64)) -> IO ())
-> (("pValue" ::: Ptr ("value" ::: Word64))
    -> IO ("value" ::: Word64))
-> IO ("value" ::: Word64)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a. Int -> IO (Ptr a)
callocBytes @Word64 8) ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT ("value" ::: Word64) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("value" ::: Word64) IO Result)
-> IO Result -> ContT ("value" ::: Word64) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetSemaphoreCounterValue" (Ptr Device_T
-> Semaphore
-> ("pValue" ::: Ptr ("value" ::: Word64))
-> IO Result
vkGetSemaphoreCounterValue' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Semaphore
semaphore) ("pValue" ::: Ptr ("value" ::: Word64)
pPValue))
  IO () -> ContT ("value" ::: Word64) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("value" ::: Word64) IO ())
-> IO () -> ContT ("value" ::: Word64) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  "value" ::: Word64
pValue <- IO ("value" ::: Word64)
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("value" ::: Word64)
 -> ContT ("value" ::: Word64) IO ("value" ::: Word64))
-> IO ("value" ::: Word64)
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
forall a b. (a -> b) -> a -> b
$ ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 "pValue" ::: Ptr ("value" ::: Word64)
pPValue
  ("value" ::: Word64)
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("value" ::: Word64)
 -> ContT ("value" ::: Word64) IO ("value" ::: Word64))
-> ("value" ::: Word64)
-> ContT ("value" ::: Word64) IO ("value" ::: Word64)
forall a b. (a -> b) -> a -> b
$ ("value" ::: Word64
pValue)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkWaitSemaphoresUnsafe
  :: FunPtr (Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result) -> Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result

foreign import ccall
  "dynamic" mkVkWaitSemaphoresSafe
  :: FunPtr (Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result) -> Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result

-- | waitSemaphores with selectable safeness
waitSemaphoresSafeOrUnsafe :: forall io
                            . (MonadIO io)
                           => (FunPtr (Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result) -> Ptr Device_T -> Ptr SemaphoreWaitInfo -> Word64 -> IO Result)
                           -> -- | @device@ is the logical device that owns the semaphore.
                              --
                              -- #VUID-vkWaitSemaphores-device-parameter# @device@ /must/ be a valid
                              -- 'Vulkan.Core10.Handles.Device' handle
                              Device
                           -> -- | @pWaitInfo@ is a pointer to a 'SemaphoreWaitInfo' structure containing
                              -- information about the wait condition.
                              --
                              -- #VUID-vkWaitSemaphores-pWaitInfo-parameter# @pWaitInfo@ /must/ be a
                              -- valid pointer to a valid 'SemaphoreWaitInfo' structure
                              SemaphoreWaitInfo
                           -> -- | @timeout@ is the timeout period in units of nanoseconds. @timeout@ is
                              -- adjusted to the closest value allowed by the implementation-dependent
                              -- timeout accuracy, which /may/ be substantially longer than one
                              -- nanosecond, and /may/ be longer than the requested period.
                              ("timeout" ::: Word64)
                           -> io (Result)
waitSemaphoresSafeOrUnsafe :: (FunPtr
   (Ptr Device_T
    -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
 -> Ptr Device_T
 -> Ptr SemaphoreWaitInfo
 -> ("value" ::: Word64)
 -> IO Result)
-> Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
waitSemaphoresSafeOrUnsafe mkVkWaitSemaphores :: FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> Ptr Device_T
-> Ptr SemaphoreWaitInfo
-> ("value" ::: Word64)
-> IO Result
mkVkWaitSemaphores device :: Device
device waitInfo :: SemaphoreWaitInfo
waitInfo timeout :: "value" ::: Word64
timeout = IO Result -> io Result
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Result -> io Result)
-> (ContT Result IO Result -> IO Result)
-> ContT Result IO Result
-> io Result
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT Result IO Result -> IO Result
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT Result IO Result -> io Result)
-> ContT Result IO Result -> io Result
forall a b. (a -> b) -> a -> b
$ do
  let vkWaitSemaphoresPtr :: FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
vkWaitSemaphoresPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
pVkWaitSemaphores (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT Result IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Result IO ()) -> IO () -> ContT Result IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
vkWaitSemaphoresPtr FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
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 vkWaitSemaphores is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkWaitSemaphores' :: Ptr Device_T
-> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result
vkWaitSemaphores' = FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> Ptr Device_T
-> Ptr SemaphoreWaitInfo
-> ("value" ::: Word64)
-> IO Result
mkVkWaitSemaphores FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
vkWaitSemaphoresPtr
  Ptr SemaphoreWaitInfo
pWaitInfo <- ((Ptr SemaphoreWaitInfo -> IO Result) -> IO Result)
-> ContT Result IO (Ptr SemaphoreWaitInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SemaphoreWaitInfo -> IO Result) -> IO Result)
 -> ContT Result IO (Ptr SemaphoreWaitInfo))
-> ((Ptr SemaphoreWaitInfo -> IO Result) -> IO Result)
-> ContT Result IO (Ptr SemaphoreWaitInfo)
forall a b. (a -> b) -> a -> b
$ SemaphoreWaitInfo
-> (Ptr SemaphoreWaitInfo -> IO Result) -> IO Result
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SemaphoreWaitInfo
waitInfo)
  Result
r <- IO Result -> ContT Result IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT Result IO Result)
-> IO Result -> ContT Result IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkWaitSemaphores" (Ptr Device_T
-> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result
vkWaitSemaphores' (Device -> Ptr Device_T
deviceHandle (Device
device)) Ptr SemaphoreWaitInfo
pWaitInfo ("value" ::: Word64
timeout))
  IO () -> ContT Result IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Result IO ()) -> IO () -> ContT Result IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  Result -> ContT Result IO Result
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Result -> ContT Result IO Result)
-> Result -> ContT Result IO Result
forall a b. (a -> b) -> a -> b
$ (Result
r)

-- | vkWaitSemaphores - Wait for timeline semaphores on the host
--
-- = Description
--
-- If the condition is satisfied when 'waitSemaphores' is called, then
-- 'waitSemaphores' returns immediately. If the condition is not satisfied
-- at the time 'waitSemaphores' is called, then 'waitSemaphores' will block
-- and wait until the condition is satisfied or the @timeout@ has expired,
-- whichever is sooner.
--
-- If @timeout@ is zero, then 'waitSemaphores' does not wait, but simply
-- returns information about the current state of the semaphore.
-- 'Vulkan.Core10.Enums.Result.TIMEOUT' will be returned in this case if
-- the condition is not satisfied, even though no actual wait was
-- performed.
--
-- If the condition is satisfied before the @timeout@ has expired,
-- 'waitSemaphores' returns 'Vulkan.Core10.Enums.Result.SUCCESS'.
-- Otherwise, 'waitSemaphores' returns 'Vulkan.Core10.Enums.Result.TIMEOUT'
-- after the @timeout@ has expired.
--
-- If device loss occurs (see
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#devsandqueues-lost-device Lost Device>)
-- before the timeout has expired, 'waitSemaphores' /must/ return in finite
-- time with either 'Vulkan.Core10.Enums.Result.SUCCESS' or
-- 'Vulkan.Core10.Enums.Result.ERROR_DEVICE_LOST'.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
--     -   'Vulkan.Core10.Enums.Result.TIMEOUT'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_DEVICE_LOST'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'SemaphoreWaitInfo'
waitSemaphores :: forall io
                . (MonadIO io)
               => -- | @device@ is the logical device that owns the semaphore.
                  --
                  -- #VUID-vkWaitSemaphores-device-parameter# @device@ /must/ be a valid
                  -- 'Vulkan.Core10.Handles.Device' handle
                  Device
               -> -- | @pWaitInfo@ is a pointer to a 'SemaphoreWaitInfo' structure containing
                  -- information about the wait condition.
                  --
                  -- #VUID-vkWaitSemaphores-pWaitInfo-parameter# @pWaitInfo@ /must/ be a
                  -- valid pointer to a valid 'SemaphoreWaitInfo' structure
                  SemaphoreWaitInfo
               -> -- | @timeout@ is the timeout period in units of nanoseconds. @timeout@ is
                  -- adjusted to the closest value allowed by the implementation-dependent
                  -- timeout accuracy, which /may/ be substantially longer than one
                  -- nanosecond, and /may/ be longer than the requested period.
                  ("timeout" ::: Word64)
               -> io (Result)
waitSemaphores :: Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
waitSemaphores = (FunPtr
   (Ptr Device_T
    -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
 -> Ptr Device_T
 -> Ptr SemaphoreWaitInfo
 -> ("value" ::: Word64)
 -> IO Result)
-> Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
forall (io :: * -> *).
MonadIO io =>
(FunPtr
   (Ptr Device_T
    -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
 -> Ptr Device_T
 -> Ptr SemaphoreWaitInfo
 -> ("value" ::: Word64)
 -> IO Result)
-> Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
waitSemaphoresSafeOrUnsafe FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> Ptr Device_T
-> Ptr SemaphoreWaitInfo
-> ("value" ::: Word64)
-> IO Result
mkVkWaitSemaphoresUnsafe

-- | A variant of 'waitSemaphores' which makes a *safe* FFI call
waitSemaphoresSafe :: forall io
                    . (MonadIO io)
                   => -- | @device@ is the logical device that owns the semaphore.
                      --
                      -- #VUID-vkWaitSemaphores-device-parameter# @device@ /must/ be a valid
                      -- 'Vulkan.Core10.Handles.Device' handle
                      Device
                   -> -- | @pWaitInfo@ is a pointer to a 'SemaphoreWaitInfo' structure containing
                      -- information about the wait condition.
                      --
                      -- #VUID-vkWaitSemaphores-pWaitInfo-parameter# @pWaitInfo@ /must/ be a
                      -- valid pointer to a valid 'SemaphoreWaitInfo' structure
                      SemaphoreWaitInfo
                   -> -- | @timeout@ is the timeout period in units of nanoseconds. @timeout@ is
                      -- adjusted to the closest value allowed by the implementation-dependent
                      -- timeout accuracy, which /may/ be substantially longer than one
                      -- nanosecond, and /may/ be longer than the requested period.
                      ("timeout" ::: Word64)
                   -> io (Result)
waitSemaphoresSafe :: Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
waitSemaphoresSafe = (FunPtr
   (Ptr Device_T
    -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
 -> Ptr Device_T
 -> Ptr SemaphoreWaitInfo
 -> ("value" ::: Word64)
 -> IO Result)
-> Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
forall (io :: * -> *).
MonadIO io =>
(FunPtr
   (Ptr Device_T
    -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
 -> Ptr Device_T
 -> Ptr SemaphoreWaitInfo
 -> ("value" ::: Word64)
 -> IO Result)
-> Device -> SemaphoreWaitInfo -> ("value" ::: Word64) -> io Result
waitSemaphoresSafeOrUnsafe FunPtr
  (Ptr Device_T
   -> Ptr SemaphoreWaitInfo -> ("value" ::: Word64) -> IO Result)
-> Ptr Device_T
-> Ptr SemaphoreWaitInfo
-> ("value" ::: Word64)
-> IO Result
mkVkWaitSemaphoresSafe


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkSignalSemaphore
  :: FunPtr (Ptr Device_T -> Ptr SemaphoreSignalInfo -> IO Result) -> Ptr Device_T -> Ptr SemaphoreSignalInfo -> IO Result

-- | vkSignalSemaphore - Signal a timeline semaphore on the host
--
-- = Description
--
-- When 'signalSemaphore' is executed on the host, it defines and
-- immediately executes a
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-signaling semaphore signal operation>
-- which sets the timeline semaphore to the given value.
--
-- The first synchronization scope is defined by the host execution model,
-- but includes execution of 'signalSemaphore' on the host and anything
-- that happened-before it.
--
-- The second synchronization scope is empty.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'SemaphoreSignalInfo'
signalSemaphore :: forall io
                 . (MonadIO io)
                => -- | @device@ is the logical device that owns the semaphore.
                   --
                   -- #VUID-vkSignalSemaphore-device-parameter# @device@ /must/ be a valid
                   -- 'Vulkan.Core10.Handles.Device' handle
                   Device
                -> -- | @pSignalInfo@ is a pointer to a 'SemaphoreSignalInfo' structure
                   -- containing information about the signal operation.
                   --
                   -- #VUID-vkSignalSemaphore-pSignalInfo-parameter# @pSignalInfo@ /must/ be a
                   -- valid pointer to a valid 'SemaphoreSignalInfo' structure
                   SemaphoreSignalInfo
                -> io ()
signalSemaphore :: Device -> SemaphoreSignalInfo -> io ()
signalSemaphore device :: Device
device signalInfo :: SemaphoreSignalInfo
signalInfo = 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 vkSignalSemaphorePtr :: FunPtr
  (Ptr Device_T
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
vkSignalSemaphorePtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
pVkSignalSemaphore (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
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
vkSignalSemaphorePtr FunPtr
  (Ptr Device_T
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
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 vkSignalSemaphore is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkSignalSemaphore' :: Ptr Device_T
-> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result
vkSignalSemaphore' = FunPtr
  (Ptr Device_T
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
-> Ptr Device_T
-> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> IO Result
mkVkSignalSemaphore FunPtr
  (Ptr Device_T
   -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result)
vkSignalSemaphorePtr
  "pSignalInfo" ::: Ptr SemaphoreSignalInfo
pSignalInfo <- ((("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO ()) -> IO ())
-> ContT () IO ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO ()) -> IO ())
 -> ContT () IO ("pSignalInfo" ::: Ptr SemaphoreSignalInfo))
-> ((("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO ())
    -> IO ())
-> ContT () IO ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
forall a b. (a -> b) -> a -> b
$ SemaphoreSignalInfo
-> (("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SemaphoreSignalInfo
signalInfo)
  Result
r <- IO Result -> ContT () IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT () IO Result)
-> IO Result -> ContT () IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkSignalSemaphore" (Ptr Device_T
-> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO Result
vkSignalSemaphore' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pSignalInfo" ::: Ptr SemaphoreSignalInfo
pSignalInfo)
  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 ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))


-- | VkPhysicalDeviceTimelineSemaphoreFeatures - Structure describing
-- timeline semaphore features that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceTimelineSemaphoreFeatures' structure
-- describe the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceTimelineSemaphoreFeatures' structure is included
-- in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
-- it is filled with values indicating whether each feature is supported.
-- 'PhysicalDeviceTimelineSemaphoreFeatures' /can/ also be included in the
-- @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to enable
-- features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceTimelineSemaphoreFeatures = PhysicalDeviceTimelineSemaphoreFeatures
  { -- | #extension-features-timelineSemaphore# @timelineSemaphore@ indicates
    -- whether semaphores created with a
    -- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
    -- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE' are
    -- supported.
    PhysicalDeviceTimelineSemaphoreFeatures -> Bool
timelineSemaphore :: Bool }
  deriving (Typeable, PhysicalDeviceTimelineSemaphoreFeatures
-> PhysicalDeviceTimelineSemaphoreFeatures -> Bool
(PhysicalDeviceTimelineSemaphoreFeatures
 -> PhysicalDeviceTimelineSemaphoreFeatures -> Bool)
-> (PhysicalDeviceTimelineSemaphoreFeatures
    -> PhysicalDeviceTimelineSemaphoreFeatures -> Bool)
-> Eq PhysicalDeviceTimelineSemaphoreFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceTimelineSemaphoreFeatures
-> PhysicalDeviceTimelineSemaphoreFeatures -> Bool
$c/= :: PhysicalDeviceTimelineSemaphoreFeatures
-> PhysicalDeviceTimelineSemaphoreFeatures -> Bool
== :: PhysicalDeviceTimelineSemaphoreFeatures
-> PhysicalDeviceTimelineSemaphoreFeatures -> Bool
$c== :: PhysicalDeviceTimelineSemaphoreFeatures
-> PhysicalDeviceTimelineSemaphoreFeatures -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceTimelineSemaphoreFeatures)
#endif
deriving instance Show PhysicalDeviceTimelineSemaphoreFeatures

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

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

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

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


-- | VkPhysicalDeviceTimelineSemaphoreProperties - Structure describing
-- timeline semaphore properties that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceTimelineSemaphoreProperties' structure
-- describe the following implementation-dependent limits:
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceTimelineSemaphoreProperties = PhysicalDeviceTimelineSemaphoreProperties
  { -- | #extension-limits-maxTimelineSemaphoreValueDifference#
    -- @maxTimelineSemaphoreValueDifference@ indicates the maximum difference
    -- allowed by the implementation between the current value of a timeline
    -- semaphore and any pending signal or wait operations.
    PhysicalDeviceTimelineSemaphoreProperties -> "value" ::: Word64
maxTimelineSemaphoreValueDifference :: Word64 }
  deriving (Typeable, PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> Bool
(PhysicalDeviceTimelineSemaphoreProperties
 -> PhysicalDeviceTimelineSemaphoreProperties -> Bool)
-> (PhysicalDeviceTimelineSemaphoreProperties
    -> PhysicalDeviceTimelineSemaphoreProperties -> Bool)
-> Eq PhysicalDeviceTimelineSemaphoreProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> Bool
$c/= :: PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> Bool
== :: PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> Bool
$c== :: PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceTimelineSemaphoreProperties)
#endif
deriving instance Show PhysicalDeviceTimelineSemaphoreProperties

instance ToCStruct PhysicalDeviceTimelineSemaphoreProperties where
  withCStruct :: PhysicalDeviceTimelineSemaphoreProperties
-> (Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b) -> IO b
withCStruct x :: PhysicalDeviceTimelineSemaphoreProperties
x f :: Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b) -> IO b)
-> (Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceTimelineSemaphoreProperties
p -> Ptr PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceTimelineSemaphoreProperties
p PhysicalDeviceTimelineSemaphoreProperties
x (Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b
f Ptr PhysicalDeviceTimelineSemaphoreProperties
p)
  pokeCStruct :: Ptr PhysicalDeviceTimelineSemaphoreProperties
-> PhysicalDeviceTimelineSemaphoreProperties -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceTimelineSemaphoreProperties
p PhysicalDeviceTimelineSemaphoreProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) ("value" ::: Word64
maxTimelineSemaphoreValueDifference)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceTimelineSemaphoreProperties -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceTimelineSemaphoreProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) ("value" ::: Word64
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceTimelineSemaphoreProperties where
  peekCStruct :: Ptr PhysicalDeviceTimelineSemaphoreProperties
-> IO PhysicalDeviceTimelineSemaphoreProperties
peekCStruct p :: Ptr PhysicalDeviceTimelineSemaphoreProperties
p = do
    "value" ::: Word64
maxTimelineSemaphoreValueDifference <- ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr PhysicalDeviceTimelineSemaphoreProperties
p Ptr PhysicalDeviceTimelineSemaphoreProperties
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64))
    PhysicalDeviceTimelineSemaphoreProperties
-> IO PhysicalDeviceTimelineSemaphoreProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceTimelineSemaphoreProperties
 -> IO PhysicalDeviceTimelineSemaphoreProperties)
-> PhysicalDeviceTimelineSemaphoreProperties
-> IO PhysicalDeviceTimelineSemaphoreProperties
forall a b. (a -> b) -> a -> b
$ ("value" ::: Word64) -> PhysicalDeviceTimelineSemaphoreProperties
PhysicalDeviceTimelineSemaphoreProperties
             "value" ::: Word64
maxTimelineSemaphoreValueDifference

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

instance Zero PhysicalDeviceTimelineSemaphoreProperties where
  zero :: PhysicalDeviceTimelineSemaphoreProperties
zero = ("value" ::: Word64) -> PhysicalDeviceTimelineSemaphoreProperties
PhysicalDeviceTimelineSemaphoreProperties
           "value" ::: Word64
forall a. Zero a => a
zero


-- | VkSemaphoreTypeCreateInfo - Structure specifying the type of a newly
-- created semaphore
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSemaphoreTypeCreateInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO'
--
-- -   #VUID-VkSemaphoreTypeCreateInfo-semaphoreType-parameter#
--     @semaphoreType@ /must/ be a valid
--     'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' value
--
-- == Valid Usage
--
-- -   #VUID-VkSemaphoreTypeCreateInfo-timelineSemaphore-03252# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-timelineSemaphore timelineSemaphore>
--     feature is not enabled, @semaphoreType@ /must/ not equal
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
--
-- -   #VUID-VkSemaphoreTypeCreateInfo-semaphoreType-03279# If
--     @semaphoreType@ is
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_BINARY',
--     @initialValue@ /must/ be zero
--
-- If no 'SemaphoreTypeCreateInfo' structure is included in the @pNext@
-- chain of 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo', then the
-- created semaphore will have a default
-- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
-- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_BINARY'.
--
-- = See Also
--
-- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data SemaphoreTypeCreateInfo = SemaphoreTypeCreateInfo
  { -- | @semaphoreType@ is a 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType'
    -- value specifying the type of the semaphore.
    SemaphoreTypeCreateInfo -> SemaphoreType
semaphoreType :: SemaphoreType
  , -- | @initialValue@ is the initial payload value if @semaphoreType@ is
    -- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'.
    SemaphoreTypeCreateInfo -> "value" ::: Word64
initialValue :: Word64
  }
  deriving (Typeable, SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool
(SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool)
-> (SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool)
-> Eq SemaphoreTypeCreateInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool
$c/= :: SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool
== :: SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool
$c== :: SemaphoreTypeCreateInfo -> SemaphoreTypeCreateInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreTypeCreateInfo)
#endif
deriving instance Show SemaphoreTypeCreateInfo

instance ToCStruct SemaphoreTypeCreateInfo where
  withCStruct :: SemaphoreTypeCreateInfo
-> (Ptr SemaphoreTypeCreateInfo -> IO b) -> IO b
withCStruct x :: SemaphoreTypeCreateInfo
x f :: Ptr SemaphoreTypeCreateInfo -> IO b
f = Int -> Int -> (Ptr SemaphoreTypeCreateInfo -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr SemaphoreTypeCreateInfo -> IO b) -> IO b)
-> (Ptr SemaphoreTypeCreateInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SemaphoreTypeCreateInfo
p -> Ptr SemaphoreTypeCreateInfo
-> SemaphoreTypeCreateInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SemaphoreTypeCreateInfo
p SemaphoreTypeCreateInfo
x (Ptr SemaphoreTypeCreateInfo -> IO b
f Ptr SemaphoreTypeCreateInfo
p)
  pokeCStruct :: Ptr SemaphoreTypeCreateInfo
-> SemaphoreTypeCreateInfo -> IO b -> IO b
pokeCStruct p :: Ptr SemaphoreTypeCreateInfo
p SemaphoreTypeCreateInfo{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr SemaphoreType -> SemaphoreType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr SemaphoreType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SemaphoreType)) (SemaphoreType
semaphoreType)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) ("value" ::: Word64
initialValue)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr SemaphoreTypeCreateInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr SemaphoreTypeCreateInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr SemaphoreType -> SemaphoreType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr SemaphoreType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SemaphoreType)) (SemaphoreType
forall a. Zero a => a
zero)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) ("value" ::: Word64
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct SemaphoreTypeCreateInfo where
  peekCStruct :: Ptr SemaphoreTypeCreateInfo -> IO SemaphoreTypeCreateInfo
peekCStruct p :: Ptr SemaphoreTypeCreateInfo
p = do
    SemaphoreType
semaphoreType <- Ptr SemaphoreType -> IO SemaphoreType
forall a. Storable a => Ptr a -> IO a
peek @SemaphoreType ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo -> Int -> Ptr SemaphoreType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SemaphoreType))
    "value" ::: Word64
initialValue <- ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr SemaphoreTypeCreateInfo
p Ptr SemaphoreTypeCreateInfo
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64))
    SemaphoreTypeCreateInfo -> IO SemaphoreTypeCreateInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SemaphoreTypeCreateInfo -> IO SemaphoreTypeCreateInfo)
-> SemaphoreTypeCreateInfo -> IO SemaphoreTypeCreateInfo
forall a b. (a -> b) -> a -> b
$ SemaphoreType -> ("value" ::: Word64) -> SemaphoreTypeCreateInfo
SemaphoreTypeCreateInfo
             SemaphoreType
semaphoreType "value" ::: Word64
initialValue

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

instance Zero SemaphoreTypeCreateInfo where
  zero :: SemaphoreTypeCreateInfo
zero = SemaphoreType -> ("value" ::: Word64) -> SemaphoreTypeCreateInfo
SemaphoreTypeCreateInfo
           SemaphoreType
forall a. Zero a => a
zero
           "value" ::: Word64
forall a. Zero a => a
zero


-- | VkTimelineSemaphoreSubmitInfo - Structure specifying signal and wait
-- values for timeline semaphores
--
-- = Description
--
-- If the semaphore in 'Vulkan.Core10.Queue.SubmitInfo'::@pWaitSemaphores@
-- or 'Vulkan.Core10.Queue.SubmitInfo'::@pSignalSemaphores@ corresponding
-- to an entry in @pWaitSemaphoreValues@ or @pSignalSemaphoreValues@
-- respectively was not created with a
-- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
-- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE', the
-- implementation /must/ ignore the value in the @pWaitSemaphoreValues@ or
-- @pSignalSemaphoreValues@ entry.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkTimelineSemaphoreSubmitInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO'
--
-- -   #VUID-VkTimelineSemaphoreSubmitInfo-pWaitSemaphoreValues-parameter#
--     If @waitSemaphoreValueCount@ is not @0@, and @pWaitSemaphoreValues@
--     is not @NULL@, @pWaitSemaphoreValues@ /must/ be a valid pointer to
--     an array of @waitSemaphoreValueCount@ @uint64_t@ values
--
-- -   #VUID-VkTimelineSemaphoreSubmitInfo-pSignalSemaphoreValues-parameter#
--     If @signalSemaphoreValueCount@ is not @0@, and
--     @pSignalSemaphoreValues@ is not @NULL@, @pSignalSemaphoreValues@
--     /must/ be a valid pointer to an array of @signalSemaphoreValueCount@
--     @uint64_t@ values
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data TimelineSemaphoreSubmitInfo = TimelineSemaphoreSubmitInfo
  { -- | @waitSemaphoreValueCount@ is the number of semaphore wait values
    -- specified in @pWaitSemaphoreValues@.
    TimelineSemaphoreSubmitInfo -> Word32
waitSemaphoreValueCount :: Word32
  , -- | @pWaitSemaphoreValues@ is an array of length @waitSemaphoreValueCount@
    -- containing values for the corresponding semaphores in
    -- 'Vulkan.Core10.Queue.SubmitInfo'::@pWaitSemaphores@ to wait for.
    TimelineSemaphoreSubmitInfo -> Vector ("value" ::: Word64)
waitSemaphoreValues :: Vector Word64
  , -- | @signalSemaphoreValueCount@ is the number of semaphore signal values
    -- specified in @pSignalSemaphoreValues@.
    TimelineSemaphoreSubmitInfo -> Word32
signalSemaphoreValueCount :: Word32
  , -- | @pSignalSemaphoreValues@ is an array of length
    -- @signalSemaphoreValueCount@ containing values for the corresponding
    -- semaphores in 'Vulkan.Core10.Queue.SubmitInfo'::@pSignalSemaphores@ to
    -- set when signaled.
    TimelineSemaphoreSubmitInfo -> Vector ("value" ::: Word64)
signalSemaphoreValues :: Vector Word64
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (TimelineSemaphoreSubmitInfo)
#endif
deriving instance Show TimelineSemaphoreSubmitInfo

instance ToCStruct TimelineSemaphoreSubmitInfo where
  withCStruct :: TimelineSemaphoreSubmitInfo
-> (Ptr TimelineSemaphoreSubmitInfo -> IO b) -> IO b
withCStruct x :: TimelineSemaphoreSubmitInfo
x f :: Ptr TimelineSemaphoreSubmitInfo -> IO b
f = Int -> Int -> (Ptr TimelineSemaphoreSubmitInfo -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr TimelineSemaphoreSubmitInfo -> IO b) -> IO b)
-> (Ptr TimelineSemaphoreSubmitInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr TimelineSemaphoreSubmitInfo
p -> Ptr TimelineSemaphoreSubmitInfo
-> TimelineSemaphoreSubmitInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr TimelineSemaphoreSubmitInfo
p TimelineSemaphoreSubmitInfo
x (Ptr TimelineSemaphoreSubmitInfo -> IO b
f Ptr TimelineSemaphoreSubmitInfo
p)
  pokeCStruct :: Ptr TimelineSemaphoreSubmitInfo
-> TimelineSemaphoreSubmitInfo -> IO b -> IO b
pokeCStruct p :: Ptr TimelineSemaphoreSubmitInfo
p TimelineSemaphoreSubmitInfo{..} 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 ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO)
    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 ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64) -> Int)
-> Vector ("value" ::: Word64) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ("value" ::: Word64)
waitSemaphoreValues)
    Word32
waitSemaphoreValueCount'' <- IO Word32 -> ContT b IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32 -> ContT b IO Word32) -> IO Word32 -> ContT b IO Word32
forall a b. (a -> b) -> a -> b
$ if (Word32
waitSemaphoreValueCount) Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== 0
      then Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength
      else do
        Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== (Word32
waitSemaphoreValueCount) Bool -> Bool -> Bool
|| Int
pWaitSemaphoreValuesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (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 "" "pWaitSemaphoreValues must be empty or have 'waitSemaphoreValueCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
        Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32
waitSemaphoreValueCount)
    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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
waitSemaphoreValueCount'')
    "pValue" ::: Ptr ("value" ::: Word64)
pWaitSemaphoreValues'' <- if Vector ("value" ::: Word64) -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector ("value" ::: Word64)
waitSemaphoreValues)
      then ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a
nullPtr
      else do
        "pValue" ::: Ptr ("value" ::: Word64)
pPWaitSemaphoreValues <- ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 (((Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64)
waitSemaphoreValues))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
        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
$ (Int -> ("value" ::: Word64) -> IO ())
-> Vector ("value" ::: Word64) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: "value" ::: Word64
e -> ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pValue" ::: Ptr ("value" ::: Word64)
pPWaitSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) ("value" ::: Word64
e)) ((Vector ("value" ::: Word64)
waitSemaphoreValues))
        ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("pValue" ::: Ptr ("value" ::: Word64))
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ "pValue" ::: Ptr ("value" ::: Word64)
pPWaitSemaphoreValues
    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 ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Word64))) "pValue" ::: Ptr ("value" ::: Word64)
pWaitSemaphoreValues''
    let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64) -> Int)
-> Vector ("value" ::: Word64) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ("value" ::: Word64)
signalSemaphoreValues)
    Word32
signalSemaphoreValueCount'' <- IO Word32 -> ContT b IO Word32
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32 -> ContT b IO Word32) -> IO Word32 -> ContT b IO Word32
forall a b. (a -> b) -> a -> b
$ if (Word32
signalSemaphoreValueCount) Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== 0
      then Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength
      else do
        Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== (Word32
signalSemaphoreValueCount) Bool -> Bool -> Bool
|| Int
pSignalSemaphoreValuesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (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 "" "pSignalSemaphoreValues must be empty or have 'signalSemaphoreValueCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
        Word32 -> IO Word32
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32
signalSemaphoreValueCount)
    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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32)) (Word32
signalSemaphoreValueCount'')
    "pValue" ::: Ptr ("value" ::: Word64)
pSignalSemaphoreValues'' <- if Vector ("value" ::: Word64) -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector ("value" ::: Word64)
signalSemaphoreValues)
      then ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a
nullPtr
      else do
        "pValue" ::: Ptr ("value" ::: Word64)
pPSignalSemaphoreValues <- ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 (((Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64)
signalSemaphoreValues))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
        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
$ (Int -> ("value" ::: Word64) -> IO ())
-> Vector ("value" ::: Word64) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: "value" ::: Word64
e -> ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pValue" ::: Ptr ("value" ::: Word64)
pPSignalSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) ("value" ::: Word64
e)) ((Vector ("value" ::: Word64)
signalSemaphoreValues))
        ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("pValue" ::: Ptr ("value" ::: Word64))
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ("pValue" ::: Ptr ("value" ::: Word64))
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ "pValue" ::: Ptr ("value" ::: Word64)
pPSignalSemaphoreValues
    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 ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr Word64))) "pValue" ::: Ptr ("value" ::: Word64)
pSignalSemaphoreValues''
    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 = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr TimelineSemaphoreSubmitInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr TimelineSemaphoreSubmitInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct TimelineSemaphoreSubmitInfo where
  peekCStruct :: Ptr TimelineSemaphoreSubmitInfo -> IO TimelineSemaphoreSubmitInfo
peekCStruct p :: Ptr TimelineSemaphoreSubmitInfo
p = do
    Word32
waitSemaphoreValueCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    "pValue" ::: Ptr ("value" ::: Word64)
pWaitSemaphoreValues <- Ptr ("pValue" ::: Ptr ("value" ::: Word64))
-> IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Word64)))
    let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = if "pValue" ::: Ptr ("value" ::: Word64)
pWaitSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> Bool
forall a. Eq a => a -> a -> Bool
== "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a
nullPtr then 0 else (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
waitSemaphoreValueCount)
    Vector ("value" ::: Word64)
pWaitSemaphoreValues' <- Int
-> (Int -> IO ("value" ::: Word64))
-> IO (Vector ("value" ::: Word64))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pWaitSemaphoreValuesLength (\i :: Int
i -> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pValue" ::: Ptr ("value" ::: Word64)
pWaitSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    Word32
signalSemaphoreValueCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32))
    "pValue" ::: Ptr ("value" ::: Word64)
pSignalSemaphoreValues <- Ptr ("pValue" ::: Ptr ("value" ::: Word64))
-> IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr TimelineSemaphoreSubmitInfo
p Ptr TimelineSemaphoreSubmitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr Word64)))
    let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = if "pValue" ::: Ptr ("value" ::: Word64)
pSignalSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> Bool
forall a. Eq a => a -> a -> Bool
== "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a
nullPtr then 0 else (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
signalSemaphoreValueCount)
    Vector ("value" ::: Word64)
pSignalSemaphoreValues' <- Int
-> (Int -> IO ("value" ::: Word64))
-> IO (Vector ("value" ::: Word64))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pSignalSemaphoreValuesLength (\i :: Int
i -> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pValue" ::: Ptr ("value" ::: Word64)
pSignalSemaphoreValues ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    TimelineSemaphoreSubmitInfo -> IO TimelineSemaphoreSubmitInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TimelineSemaphoreSubmitInfo -> IO TimelineSemaphoreSubmitInfo)
-> TimelineSemaphoreSubmitInfo -> IO TimelineSemaphoreSubmitInfo
forall a b. (a -> b) -> a -> b
$ Word32
-> Vector ("value" ::: Word64)
-> Word32
-> Vector ("value" ::: Word64)
-> TimelineSemaphoreSubmitInfo
TimelineSemaphoreSubmitInfo
             Word32
waitSemaphoreValueCount Vector ("value" ::: Word64)
pWaitSemaphoreValues' Word32
signalSemaphoreValueCount Vector ("value" ::: Word64)
pSignalSemaphoreValues'

instance Zero TimelineSemaphoreSubmitInfo where
  zero :: TimelineSemaphoreSubmitInfo
zero = Word32
-> Vector ("value" ::: Word64)
-> Word32
-> Vector ("value" ::: Word64)
-> TimelineSemaphoreSubmitInfo
TimelineSemaphoreSubmitInfo
           Word32
forall a. Zero a => a
zero
           Vector ("value" ::: Word64)
forall a. Monoid a => a
mempty
           Word32
forall a. Zero a => a
zero
           Vector ("value" ::: Word64)
forall a. Monoid a => a
mempty


-- | VkSemaphoreWaitInfo - Structure containing information about the
-- semaphore wait condition
--
-- == Valid Usage
--
-- -   #VUID-VkSemaphoreWaitInfo-pSemaphores-03256# All of the elements of
--     @pSemaphores@ /must/ reference a semaphore that was created with a
--     'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSemaphoreWaitInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO'
--
-- -   #VUID-VkSemaphoreWaitInfo-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkSemaphoreWaitInfo-flags-parameter# @flags@ /must/ be a valid
--     combination of
--     'Vulkan.Core12.Enums.SemaphoreWaitFlagBits.SemaphoreWaitFlagBits'
--     values
--
-- -   #VUID-VkSemaphoreWaitInfo-pSemaphores-parameter# @pSemaphores@
--     /must/ be a valid pointer to an array of @semaphoreCount@ valid
--     'Vulkan.Core10.Handles.Semaphore' handles
--
-- -   #VUID-VkSemaphoreWaitInfo-pValues-parameter# @pValues@ /must/ be a
--     valid pointer to an array of @semaphoreCount@ @uint64_t@ values
--
-- -   #VUID-VkSemaphoreWaitInfo-semaphoreCount-arraylength#
--     @semaphoreCount@ /must/ be greater than @0@
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core12.Enums.SemaphoreWaitFlagBits.SemaphoreWaitFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'waitSemaphores',
-- 'Vulkan.Extensions.VK_KHR_timeline_semaphore.waitSemaphoresKHR'
data SemaphoreWaitInfo = SemaphoreWaitInfo
  { -- | @flags@ is a bitmask of
    -- 'Vulkan.Core12.Enums.SemaphoreWaitFlagBits.SemaphoreWaitFlagBits'
    -- specifying additional parameters for the semaphore wait operation.
    SemaphoreWaitInfo -> SemaphoreWaitFlags
flags :: SemaphoreWaitFlags
  , -- | @pSemaphores@ is a pointer to an array of @semaphoreCount@ semaphore
    -- handles to wait on.
    SemaphoreWaitInfo -> Vector Semaphore
semaphores :: Vector Semaphore
  , -- | @pValues@ is a pointer to an array of @semaphoreCount@ timeline
    -- semaphore values.
    SemaphoreWaitInfo -> Vector ("value" ::: Word64)
values :: Vector Word64
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreWaitInfo)
#endif
deriving instance Show SemaphoreWaitInfo

instance ToCStruct SemaphoreWaitInfo where
  withCStruct :: SemaphoreWaitInfo -> (Ptr SemaphoreWaitInfo -> IO b) -> IO b
withCStruct x :: SemaphoreWaitInfo
x f :: Ptr SemaphoreWaitInfo -> IO b
f = Int -> Int -> (Ptr SemaphoreWaitInfo -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr SemaphoreWaitInfo -> IO b) -> IO b)
-> (Ptr SemaphoreWaitInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SemaphoreWaitInfo
p -> Ptr SemaphoreWaitInfo -> SemaphoreWaitInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SemaphoreWaitInfo
p SemaphoreWaitInfo
x (Ptr SemaphoreWaitInfo -> IO b
f Ptr SemaphoreWaitInfo
p)
  pokeCStruct :: Ptr SemaphoreWaitInfo -> SemaphoreWaitInfo -> IO b -> IO b
pokeCStruct p :: Ptr SemaphoreWaitInfo
p SemaphoreWaitInfo{..} 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 ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO)
    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 ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    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 SemaphoreWaitFlags -> SemaphoreWaitFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr SemaphoreWaitFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SemaphoreWaitFlags)) (SemaphoreWaitFlags
flags)
    let pSemaphoresLength :: Int
pSemaphoresLength = Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore -> Int) -> Vector Semaphore -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Semaphore
semaphores)
    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
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ((Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64) -> Int)
-> Vector ("value" ::: Word64) -> Int
forall a b. (a -> b) -> a -> b
$ (Vector ("value" ::: Word64)
values)) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
pSemaphoresLength) (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 "" "pValues and pSemaphores must have the same length" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
    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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSemaphoresLength :: Word32))
    Ptr Semaphore
pPSemaphores' <- ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore))
-> ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr Semaphore -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Semaphore ((Vector Semaphore -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Semaphore
semaphores)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
    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
$ (Int -> Semaphore -> IO ()) -> Vector Semaphore -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Semaphore
e -> Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Semaphore
pPSemaphores' Ptr Semaphore -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore) (Semaphore
e)) (Vector Semaphore
semaphores)
    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 Semaphore) -> Ptr Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Semaphore))) (Ptr Semaphore
pPSemaphores')
    "pValue" ::: Ptr ("value" ::: Word64)
pPValues' <- ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 ((Vector ("value" ::: Word64) -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector ("value" ::: Word64)
values)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
    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
$ (Int -> ("value" ::: Word64) -> IO ())
-> Vector ("value" ::: Word64) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: "value" ::: Word64
e -> ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pValue" ::: Ptr ("value" ::: Word64)
pPValues' ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) ("value" ::: Word64
e)) (Vector ("value" ::: Word64)
values)
    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 ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr Word64))) ("pValue" ::: Ptr ("value" ::: Word64)
pPValues')
    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 = 40
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr SemaphoreWaitInfo -> IO b -> IO b
pokeZeroCStruct p :: Ptr SemaphoreWaitInfo
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 ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO)
    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 ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore
pPSemaphores' <- ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore))
-> ((Ptr Semaphore -> IO b) -> IO b) -> ContT b IO (Ptr Semaphore)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr Semaphore -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Semaphore ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
    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
$ (Int -> Semaphore -> IO ()) -> Vector Semaphore -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Semaphore
e -> Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Semaphore
pPSemaphores' Ptr Semaphore -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore) (Semaphore
e)) (Vector Semaphore
forall a. Monoid a => a
mempty)
    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 Semaphore) -> Ptr Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Semaphore))) (Ptr Semaphore
pPSemaphores')
    "pValue" ::: Ptr ("value" ::: Word64)
pPValues' <- ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
 -> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64)))
-> ((("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b)
-> ContT b IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> (("pValue" ::: Ptr ("value" ::: Word64)) -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
    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
$ (Int -> ("value" ::: Word64) -> IO ())
-> Vector ("value" ::: Word64) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: "value" ::: Word64
e -> ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pValue" ::: Ptr ("value" ::: Word64)
pPValues' ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) ("value" ::: Word64
e)) (Vector ("value" ::: Word64)
forall a. Monoid a => a
mempty)
    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 ("pValue" ::: Ptr ("value" ::: Word64))
-> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr Word64))) ("pValue" ::: Ptr ("value" ::: Word64)
pPValues')
    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 SemaphoreWaitInfo where
  peekCStruct :: Ptr SemaphoreWaitInfo -> IO SemaphoreWaitInfo
peekCStruct p :: Ptr SemaphoreWaitInfo
p = do
    SemaphoreWaitFlags
flags <- Ptr SemaphoreWaitFlags -> IO SemaphoreWaitFlags
forall a. Storable a => Ptr a -> IO a
peek @SemaphoreWaitFlags ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr SemaphoreWaitFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SemaphoreWaitFlags))
    Word32
semaphoreCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    Ptr Semaphore
pSemaphores <- Ptr (Ptr Semaphore) -> IO (Ptr Semaphore)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Semaphore) ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo -> Int -> Ptr (Ptr Semaphore)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Semaphore)))
    Vector Semaphore
pSemaphores' <- Int -> (Int -> IO Semaphore) -> IO (Vector Semaphore)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
semaphoreCount) (\i :: Int
i -> Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore ((Ptr Semaphore
pSemaphores Ptr Semaphore -> Int -> Ptr Semaphore
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Semaphore)))
    "pValue" ::: Ptr ("value" ::: Word64)
pValues <- Ptr ("pValue" ::: Ptr ("value" ::: Word64))
-> IO ("pValue" ::: Ptr ("value" ::: Word64))
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr SemaphoreWaitInfo
p Ptr SemaphoreWaitInfo
-> Int -> Ptr ("pValue" ::: Ptr ("value" ::: Word64))
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr Word64)))
    Vector ("value" ::: Word64)
pValues' <- Int
-> (Int -> IO ("value" ::: Word64))
-> IO (Vector ("value" ::: Word64))
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
semaphoreCount) (\i :: Int
i -> ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pValue" ::: Ptr ("value" ::: Word64)
pValues ("pValue" ::: Ptr ("value" ::: Word64))
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    SemaphoreWaitInfo -> IO SemaphoreWaitInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SemaphoreWaitInfo -> IO SemaphoreWaitInfo)
-> SemaphoreWaitInfo -> IO SemaphoreWaitInfo
forall a b. (a -> b) -> a -> b
$ SemaphoreWaitFlags
-> Vector Semaphore
-> Vector ("value" ::: Word64)
-> SemaphoreWaitInfo
SemaphoreWaitInfo
             SemaphoreWaitFlags
flags Vector Semaphore
pSemaphores' Vector ("value" ::: Word64)
pValues'

instance Zero SemaphoreWaitInfo where
  zero :: SemaphoreWaitInfo
zero = SemaphoreWaitFlags
-> Vector Semaphore
-> Vector ("value" ::: Word64)
-> SemaphoreWaitInfo
SemaphoreWaitInfo
           SemaphoreWaitFlags
forall a. Zero a => a
zero
           Vector Semaphore
forall a. Monoid a => a
mempty
           Vector ("value" ::: Word64)
forall a. Monoid a => a
mempty


-- | VkSemaphoreSignalInfo - Structure containing information about a
-- semaphore signal operation
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'signalSemaphore',
-- 'Vulkan.Extensions.VK_KHR_timeline_semaphore.signalSemaphoreKHR'
data SemaphoreSignalInfo = SemaphoreSignalInfo
  { -- | @semaphore@ is the handle of the semaphore to signal.
    --
    -- #VUID-VkSemaphoreSignalInfo-semaphore-03257# @semaphore@ /must/ have
    -- been created with a 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
    -- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
    --
    -- #VUID-VkSemaphoreSignalInfo-semaphore-parameter# @semaphore@ /must/ be a
    -- valid 'Vulkan.Core10.Handles.Semaphore' handle
    SemaphoreSignalInfo -> Semaphore
semaphore :: Semaphore
  , -- | @value@ is the value to signal.
    --
    -- #VUID-VkSemaphoreSignalInfo-value-03258# @value@ /must/ have a value
    -- greater than the current value of the semaphore
    --
    -- #VUID-VkSemaphoreSignalInfo-value-03259# @value@ /must/ be less than the
    -- value of any pending semaphore signal operations
    --
    -- #VUID-VkSemaphoreSignalInfo-value-03260# @value@ /must/ have a value
    -- which does not differ from the current value of the semaphore or the
    -- value of any outstanding semaphore wait or signal operation on
    -- @semaphore@ by more than
    -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#limits-maxTimelineSemaphoreValueDifference maxTimelineSemaphoreValueDifference>
    SemaphoreSignalInfo -> "value" ::: Word64
value :: Word64
  }
  deriving (Typeable, SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool
(SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool)
-> (SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool)
-> Eq SemaphoreSignalInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool
$c/= :: SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool
== :: SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool
$c== :: SemaphoreSignalInfo -> SemaphoreSignalInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreSignalInfo)
#endif
deriving instance Show SemaphoreSignalInfo

instance ToCStruct SemaphoreSignalInfo where
  withCStruct :: SemaphoreSignalInfo
-> (("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b) -> IO b
withCStruct x :: SemaphoreSignalInfo
x f :: ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b
f = Int
-> Int
-> (("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b) -> IO b)
-> (("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p -> ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> SemaphoreSignalInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p SemaphoreSignalInfo
x (("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b
f "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p)
  pokeCStruct :: ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> SemaphoreSignalInfo -> IO b -> IO b
pokeCStruct p :: "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p SemaphoreSignalInfo{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
semaphore)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) ("value" ::: Word64
value)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> IO b -> IO b
pokeZeroCStruct p :: "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
    ("pValue" ::: Ptr ("value" ::: Word64))
-> ("value" ::: Word64) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) ("value" ::: Word64
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct SemaphoreSignalInfo where
  peekCStruct :: ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> IO SemaphoreSignalInfo
peekCStruct p :: "pSignalInfo" ::: Ptr SemaphoreSignalInfo
p = do
    Semaphore
semaphore <- Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo) -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore))
    "value" ::: Word64
value <- ("pValue" ::: Ptr ("value" ::: Word64)) -> IO ("value" ::: Word64)
forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pSignalInfo" ::: Ptr SemaphoreSignalInfo
p ("pSignalInfo" ::: Ptr SemaphoreSignalInfo)
-> Int -> "pValue" ::: Ptr ("value" ::: Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64))
    SemaphoreSignalInfo -> IO SemaphoreSignalInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SemaphoreSignalInfo -> IO SemaphoreSignalInfo)
-> SemaphoreSignalInfo -> IO SemaphoreSignalInfo
forall a b. (a -> b) -> a -> b
$ Semaphore -> ("value" ::: Word64) -> SemaphoreSignalInfo
SemaphoreSignalInfo
             Semaphore
semaphore "value" ::: Word64
value

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

instance Zero SemaphoreSignalInfo where
  zero :: SemaphoreSignalInfo
zero = Semaphore -> ("value" ::: Word64) -> SemaphoreSignalInfo
SemaphoreSignalInfo
           Semaphore
forall a. Zero a => a
zero
           "value" ::: Word64
forall a. Zero a => a
zero