{-# 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 (allocaBytes)
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 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.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.Dynamic (InstanceCmds(pVkGetPhysicalDeviceExternalFenceProperties))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice(PhysicalDevice))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.StructureType (StructureType)
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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_1 VK_VERSION_1_1>,
-- '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 :: forall (io :: * -> *).
MonadIO io =>
PhysicalDevice
-> PhysicalDeviceExternalFenceInfo -> io ExternalFenceProperties
getPhysicalDeviceExternalFenceProperties PhysicalDevice
physicalDevice
                                           PhysicalDeviceExternalFenceInfo
externalFenceInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT 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 (case PhysicalDevice
physicalDevice of PhysicalDevice{InstanceCmds
$sel:instanceCmds:PhysicalDevice :: PhysicalDevice -> InstanceCmds
instanceCmds :: InstanceCmds
instanceCmds} -> InstanceCmds
instanceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr PhysicalDevice_T
   -> ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
   -> ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
   -> IO ())
vkGetPhysicalDeviceExternalFencePropertiesPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetPhysicalDeviceExternalFenceProperties is null" forall a. Maybe a
Nothing 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 <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (PhysicalDeviceExternalFenceInfo
externalFenceInfo)
  "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
pPExternalFenceProperties <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ExternalFenceProperties)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"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 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ExternalFenceProperties "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
pPExternalFenceProperties
  forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_1 VK_VERSION_1_1>,
-- '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 specifying 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
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 :: forall b.
PhysicalDeviceExternalFenceInfo
-> (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
    -> IO b)
-> IO b
withCStruct PhysicalDeviceExternalFenceInfo
x ("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \"pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p -> 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 :: forall b.
("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> PhysicalDeviceExternalFenceInfo -> IO b -> IO b
pokeCStruct "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p PhysicalDeviceExternalFenceInfo{ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
$sel:handleType:PhysicalDeviceExternalFenceInfo :: PhysicalDeviceExternalFenceInfo -> ExternalFenceHandleTypeFlagBits
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo)
-> IO b -> IO b
pokeZeroCStruct "pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceInfo" ::: Ptr PhysicalDeviceExternalFenceInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlagBits)) (forall a. Zero a => a
zero)
    IO b
f

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

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

instance Zero PhysicalDeviceExternalFenceInfo where
  zero :: PhysicalDeviceExternalFenceInfo
zero = ExternalFenceHandleTypeFlagBits -> PhysicalDeviceExternalFenceInfo
PhysicalDeviceExternalFenceInfo
           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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_VERSION_1_1 VK_VERSION_1_1>,
-- '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
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 :: forall b.
ExternalFenceProperties
-> (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
    -> IO b)
-> IO b
withCStruct ExternalFenceProperties
x ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p -> 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 :: forall b.
("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> ExternalFenceProperties -> IO b -> IO b
pokeCStruct "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p ExternalFenceProperties{ExternalFenceHandleTypeFlagBits
ExternalFenceFeatureFlags
externalFenceFeatures :: ExternalFenceFeatureFlags
compatibleHandleTypes :: ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes :: ExternalFenceHandleTypeFlagBits
$sel:externalFenceFeatures:ExternalFenceProperties :: ExternalFenceProperties -> ExternalFenceFeatureFlags
$sel:compatibleHandleTypes:ExternalFenceProperties :: ExternalFenceProperties -> ExternalFenceHandleTypeFlagBits
$sel:exportFromImportedHandleTypes:ExternalFenceProperties :: ExternalFenceProperties -> ExternalFenceHandleTypeFlagBits
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlagBits
compatibleHandleTypes)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceFeatureFlags)) (ExternalFenceFeatureFlags
externalFenceFeatures)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO b -> IO b
pokeZeroCStruct "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlags)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ExternalFenceHandleTypeFlags)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalFenceProperties where
  peekCStruct :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ExternalFenceProperties
peekCStruct "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p = do
    ExternalFenceHandleTypeFlagBits
exportFromImportedHandleTypes <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlags))
    ExternalFenceHandleTypeFlagBits
compatibleHandleTypes <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr ExternalFenceHandleTypeFlags))
    ExternalFenceFeatureFlags
externalFenceFeatures <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceFeatureFlags (("pExternalFenceProperties" ::: Ptr ExternalFenceProperties
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceFeatureFlags))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
_ = Int
32
  alignment :: ExternalFenceProperties -> Int
alignment ~ExternalFenceProperties
_ = Int
8
  peek :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> IO ExternalFenceProperties
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pExternalFenceProperties" ::: Ptr ExternalFenceProperties)
-> ExternalFenceProperties -> IO ()
poke "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
ptr ExternalFenceProperties
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pExternalFenceProperties" ::: Ptr ExternalFenceProperties
ptr ExternalFenceProperties
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

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