{-# language CPP #-}
-- No documentation found for Chapter "Promoted_From_VK_KHR_external_fence_capabilities"
module Vulkan.Core11.Promoted_From_VK_KHR_external_fence_capabilities  ( getPhysicalDeviceExternalFenceProperties
                                                                       , PhysicalDeviceExternalFenceInfo(..)
                                                                       , ExternalFenceProperties(..)
                                                                       , StructureType(..)
                                                                       , ExternalFenceHandleTypeFlagBits(..)
                                                                       , ExternalFenceHandleTypeFlags
                                                                       , ExternalFenceFeatureFlagBits(..)
                                                                       , ExternalFenceFeatureFlags
                                                                       ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlags)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlags)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceExternalFenceProperties))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO))
import Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlagBits(..))
import Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits (ExternalFenceFeatureFlags)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits(..))
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetPhysicalDeviceExternalFenceProperties
  :: FunPtr (Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalFenceInfo -> Ptr ExternalFenceProperties -> IO ()) -> Ptr PhysicalDevice_T -> Ptr PhysicalDeviceExternalFenceInfo -> Ptr ExternalFenceProperties -> IO ()

-- | vkGetPhysicalDeviceExternalFenceProperties - Function for querying
-- external fence handle capabilities.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'ExternalFenceProperties', 'Vulkan.Core10.Handles.PhysicalDevice',
-- 'PhysicalDeviceExternalFenceInfo'
getPhysicalDeviceExternalFenceProperties :: forall io
                                          . (MonadIO io)
                                         => -- | @physicalDevice@ is the physical device from which to query the fence
                                            -- capabilities.
                                            --
                                            -- #VUID-vkGetPhysicalDeviceExternalFenceProperties-physicalDevice-parameter#
                                            -- @physicalDevice@ /must/ be a valid
                                            -- 'Vulkan.Core10.Handles.PhysicalDevice' handle
                                            PhysicalDevice
                                         -> -- | @pExternalFenceInfo@ is a pointer to a 'PhysicalDeviceExternalFenceInfo'
                                            -- structure describing the parameters that would be consumed by
                                            -- 'Vulkan.Core10.Fence.createFence'.
                                            --
                                            -- #VUID-vkGetPhysicalDeviceExternalFenceProperties-pExternalFenceInfo-parameter#
                                            -- @pExternalFenceInfo@ /must/ be a valid pointer to a valid
                                            -- 'PhysicalDeviceExternalFenceInfo' structure
                                            PhysicalDeviceExternalFenceInfo
                                         -> io (ExternalFenceProperties)
getPhysicalDeviceExternalFenceProperties :: PhysicalDevice
-> PhysicalDeviceExternalFenceInfo -> io ExternalFenceProperties
getPhysicalDeviceExternalFenceProperties physicalDevice :: PhysicalDevice
physicalDevice externalFenceInfo :: PhysicalDeviceExternalFenceInfo
externalFenceInfo = IO ExternalFenceProperties -> io ExternalFenceProperties
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExternalFenceProperties -> io ExternalFenceProperties)
-> (ContT ExternalFenceProperties IO ExternalFenceProperties
    -> IO ExternalFenceProperties)
-> ContT ExternalFenceProperties IO ExternalFenceProperties
-> io ExternalFenceProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ExternalFenceProperties IO ExternalFenceProperties
-> IO ExternalFenceProperties
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ExternalFenceProperties IO ExternalFenceProperties
 -> io ExternalFenceProperties)
-> ContT ExternalFenceProperties IO ExternalFenceProperties
-> io ExternalFenceProperties
forall a b. (a -> b) -> a -> b
$ do
  let vkGetPhysicalDeviceExternalFencePropertiesPtr :: FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
vkGetPhysicalDeviceExternalFencePropertiesPtr = InstanceCmds
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
      -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
      -> IO ())
pVkGetPhysicalDeviceExternalFenceProperties (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
  IO () -> ContT ExternalFenceProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ExternalFenceProperties IO ())
-> IO () -> ContT ExternalFenceProperties IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
vkGetPhysicalDeviceExternalFencePropertiesPtr FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
      -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetPhysicalDeviceExternalFenceProperties is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetPhysicalDeviceExternalFenceProperties' :: Ptr PhysicalDevice_T
-> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ()
vkGetPhysicalDeviceExternalFenceProperties' = FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
-> Ptr PhysicalDevice_T
-> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ()
mkVkGetPhysicalDeviceExternalFenceProperties FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
vkGetPhysicalDeviceExternalFencePropertiesPtr
  "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
pExternalFenceInfo <- ((("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
  -> IO ExternalFenceProperties)
 -> IO ExternalFenceProperties)
-> ContT
     ExternalFenceProperties
     IO
     ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> IO ExternalFenceProperties)
  -> IO ExternalFenceProperties)
 -> ContT
      ExternalFenceProperties
      IO
      ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo))
-> ((("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
     -> IO ExternalFenceProperties)
    -> IO ExternalFenceProperties)
-> ContT
     ExternalFenceProperties
     IO
     ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
forall a b. (a -> b) -> a -> b
$ PhysicalDeviceExternalFenceInfo
-> (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
    -> IO ExternalFenceProperties)
-> IO ExternalFenceProperties
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (PhysicalDeviceExternalFenceInfo
externalFenceInfo)
  "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
pPExternalFenceProperties <- ((("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
  -> IO ExternalFenceProperties)
 -> IO ExternalFenceProperties)
-> ContT
     ExternalFenceProperties
     IO
     ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct ExternalFenceProperties =>
(("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
 -> IO b)
-> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ExternalFenceProperties)
  IO () -> ContT ExternalFenceProperties IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ExternalFenceProperties IO ())
-> IO () -> ContT ExternalFenceProperties IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetPhysicalDeviceExternalFenceProperties" (Ptr PhysicalDevice_T
-> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ()
vkGetPhysicalDeviceExternalFenceProperties' (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)) "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
pExternalFenceInfo ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
pPExternalFenceProperties))
  ExternalFenceProperties
pExternalFenceProperties <- IO ExternalFenceProperties
-> ContT ExternalFenceProperties IO ExternalFenceProperties
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ExternalFenceProperties
 -> ContT ExternalFenceProperties IO ExternalFenceProperties)
-> IO ExternalFenceProperties
-> ContT ExternalFenceProperties IO ExternalFenceProperties
forall a b. (a -> b) -> a -> b
$ ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ExternalFenceProperties
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ExternalFenceProperties "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
pPExternalFenceProperties
  ExternalFenceProperties
-> ContT ExternalFenceProperties IO ExternalFenceProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalFenceProperties
 -> ContT ExternalFenceProperties IO ExternalFenceProperties)
-> ExternalFenceProperties
-> ContT ExternalFenceProperties IO ExternalFenceProperties
forall a b. (a -> b) -> a -> b
$ (ExternalFenceProperties
pExternalFenceProperties)


-- | VkPhysicalDeviceExternalFenceInfo - Structure specifying fence creation
-- parameters.
--
-- = Description
--
-- Note
--
-- Handles of type
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT'
-- generated by the implementation may represent either Linux Sync Files or
-- Android Fences at the implementation’s discretion. Applications /should/
-- only use operations defined for both types of file descriptors, unless
-- they know via means external to Vulkan the type of the file descriptor,
-- or are prepared to deal with the system-defined operation failures
-- resulting from using the wrong type.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getPhysicalDeviceExternalFenceProperties',
-- 'Vulkan.Extensions.VK_KHR_external_fence_capabilities.getPhysicalDeviceExternalFencePropertiesKHR'
data PhysicalDeviceExternalFenceInfo = PhysicalDeviceExternalFenceInfo
  { -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- value indicating an external fence handle type for which capabilities
    -- will be returned.
    --
    -- #VUID-VkPhysicalDeviceExternalFenceInfo-handleType-parameter#
    -- @handleType@ /must/ be a valid
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- value
    PhysicalDeviceExternalFenceInfo -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits }
  deriving (Typeable, PhysicalDeviceExternalFenceInfo
-> PhysicalDeviceExternalFenceInfo -> Bool
(PhysicalDeviceExternalFenceInfo
 -> PhysicalDeviceExternalFenceInfo -> Bool)
-> (PhysicalDeviceExternalFenceInfo
    -> PhysicalDeviceExternalFenceInfo -> Bool)
-> Eq PhysicalDeviceExternalFenceInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceExternalFenceInfo
-> PhysicalDeviceExternalFenceInfo -> Bool
$c/= :: PhysicalDeviceExternalFenceInfo
-> PhysicalDeviceExternalFenceInfo -> Bool
== :: PhysicalDeviceExternalFenceInfo
-> PhysicalDeviceExternalFenceInfo -> Bool
$c== :: PhysicalDeviceExternalFenceInfo
-> PhysicalDeviceExternalFenceInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceExternalFenceInfo)
#endif
deriving instance Show PhysicalDeviceExternalFenceInfo

instance ToCStruct PhysicalDeviceExternalFenceInfo where
  withCStruct :: PhysicalDeviceExternalFenceInfo
-> (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
    -> IO b)
-> IO b
withCStruct x :: PhysicalDeviceExternalFenceInfo
x f :: ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO b
f = Int
-> Int
-> (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
  -> IO b)
 -> IO b)
-> (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> PhysicalDeviceExternalFenceInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p PhysicalDeviceExternalFenceInfo
x (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO b
f "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p)
  pokeCStruct :: ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> PhysicalDeviceExternalFenceInfo -> IO b -> IO b
pokeCStruct p :: "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p PhysicalDeviceExternalFenceInfo{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO b -> IO b
pokeZeroCStruct p :: "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceExternalFenceInfo where
  peekCStruct :: ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO PhysicalDeviceExternalFenceInfo
peekCStruct p :: "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p = do
    ExternalFenceHandleTypeFlagBits
handleType <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlagBits))
    PhysicalDeviceExternalFenceInfo
-> IO PhysicalDeviceExternalFenceInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceExternalFenceInfo
 -> IO PhysicalDeviceExternalFenceInfo)
-> PhysicalDeviceExternalFenceInfo
-> IO PhysicalDeviceExternalFenceInfo
forall a b. (a -> b) -> a -> b
$ ExternalFenceHandleTypeFlagBits -> PhysicalDeviceExternalFenceInfo
PhysicalDeviceExternalFenceInfo
             ExternalFenceHandleTypeFlagBits
handleType

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

instance Zero PhysicalDeviceExternalFenceInfo where
  zero :: PhysicalDeviceExternalFenceInfo
zero = ExternalFenceHandleTypeFlagBits -> PhysicalDeviceExternalFenceInfo
PhysicalDeviceExternalFenceInfo
           ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero


-- | VkExternalFenceProperties - Structure describing supported external
-- fence handle features
--
-- = Description
--
-- If @handleType@ is not supported by the implementation, then
-- 'ExternalFenceProperties'::@externalFenceFeatures@ will be set to zero.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits.ExternalFenceFeatureFlags',
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getPhysicalDeviceExternalFenceProperties',
-- 'Vulkan.Extensions.VK_KHR_external_fence_capabilities.getPhysicalDeviceExternalFencePropertiesKHR'
data ExternalFenceProperties = ExternalFenceProperties
  { -- | @exportFromImportedHandleTypes@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- indicating which types of imported handle @handleType@ /can/ be exported
    -- from.
    ExternalFenceProperties -> ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes :: ExternalFenceHandleTypeFlags
  , -- | @compatibleHandleTypes@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- specifying handle types which /can/ be specified at the same time as
    -- @handleType@ when creating a fence.
    ExternalFenceProperties -> ExternalFenceHandleTypeFlagBits
compatibleHandleTypes :: ExternalFenceHandleTypeFlags
  , -- | @externalFenceFeatures@ is a bitmask of
    -- 'Vulkan.Core11.Enums.ExternalFenceFeatureFlagBits.ExternalFenceFeatureFlagBits'
    -- indicating the features of @handleType@.
    ExternalFenceProperties -> ExternalFenceFeatureFlags
externalFenceFeatures :: ExternalFenceFeatureFlags
  }
  deriving (Typeable, ExternalFenceProperties -> ExternalFenceProperties -> Bool
(ExternalFenceProperties -> ExternalFenceProperties -> Bool)
-> (ExternalFenceProperties -> ExternalFenceProperties -> Bool)
-> Eq ExternalFenceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalFenceProperties -> ExternalFenceProperties -> Bool
$c/= :: ExternalFenceProperties -> ExternalFenceProperties -> Bool
== :: ExternalFenceProperties -> ExternalFenceProperties -> Bool
$c== :: ExternalFenceProperties -> ExternalFenceProperties -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalFenceProperties)
#endif
deriving instance Show ExternalFenceProperties

instance ToCStruct ExternalFenceProperties where
  withCStruct :: ExternalFenceProperties
-> (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
    -> IO b)
-> IO b
withCStruct x :: ExternalFenceProperties
x f :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO b
f = Int
-> Int
-> (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
  -> IO b)
 -> IO b)
-> (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> ExternalFenceProperties -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ExternalFenceProperties
x (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO b
f "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p)
  pokeCStruct :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> ExternalFenceProperties -> IO b -> IO b
pokeCStruct p :: "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ExternalFenceProperties{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
compatibleHandleTypes)
    Ptr ExternalFenceFeatureFlags -> ExternalFenceFeatureFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceFeatureFlags)) (ExternalFenceFeatureFlags
externalFenceFeatures)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO b -> IO b
pokeZeroCStruct p :: "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalFenceProperties where
  peekCStruct :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ExternalFenceProperties
peekCStruct p :: "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p = do
    ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalFenceHandleTypeFlags))
    ExternalFenceHandleTypeFlagBits
compatibleHandleTypes <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr ExternalFenceHandleTypeFlags))
    ExternalFenceFeatureFlags
externalFenceFeatures <- Ptr ExternalFenceFeatureFlags -> IO ExternalFenceFeatureFlags
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceFeatureFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> Int -> Ptr ExternalFenceFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceFeatureFlags))
    ExternalFenceProperties -> IO ExternalFenceProperties
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalFenceProperties -> IO ExternalFenceProperties)
-> ExternalFenceProperties -> IO ExternalFenceProperties
forall a b. (a -> b) -> a -> b
$ ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits
-> ExternalFenceFeatureFlags
-> ExternalFenceProperties
ExternalFenceProperties
             ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes ExternalFenceHandleTypeFlagBits
compatibleHandleTypes ExternalFenceFeatureFlags
externalFenceFeatures

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

instance Zero ExternalFenceProperties where
  zero :: ExternalFenceProperties
zero = ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits
-> ExternalFenceFeatureFlags
-> ExternalFenceProperties
ExternalFenceProperties
           ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero
           ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero
           ExternalFenceFeatureFlags
forall a. Zero a => a
zero