{-# language CPP #-}
module Vulkan.Core11.Promoted_From_VK_KHR_external_fence ( ExportFenceCreateInfo(..)
, StructureType(..)
, FenceImportFlagBits(..)
, FenceImportFlags
) where
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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 Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO))
import Vulkan.Core11.Enums.FenceImportFlagBits (FenceImportFlagBits(..))
import Vulkan.Core11.Enums.FenceImportFlagBits (FenceImportFlags)
import Vulkan.Core10.Enums.StructureType (StructureType(..))
data ExportFenceCreateInfo = ExportFenceCreateInfo
{
ExportFenceCreateInfo -> ExternalFenceHandleTypeFlags
handleTypes :: ExternalFenceHandleTypeFlags }
deriving (Typeable, ExportFenceCreateInfo -> ExportFenceCreateInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportFenceCreateInfo -> ExportFenceCreateInfo -> Bool
$c/= :: ExportFenceCreateInfo -> ExportFenceCreateInfo -> Bool
== :: ExportFenceCreateInfo -> ExportFenceCreateInfo -> Bool
$c== :: ExportFenceCreateInfo -> ExportFenceCreateInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExportFenceCreateInfo)
#endif
deriving instance Show ExportFenceCreateInfo
instance ToCStruct ExportFenceCreateInfo where
withCStruct :: forall b.
ExportFenceCreateInfo
-> (Ptr ExportFenceCreateInfo -> IO b) -> IO b
withCStruct ExportFenceCreateInfo
x Ptr ExportFenceCreateInfo -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr ExportFenceCreateInfo
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportFenceCreateInfo
p ExportFenceCreateInfo
x (Ptr ExportFenceCreateInfo -> IO b
f Ptr ExportFenceCreateInfo
p)
pokeCStruct :: forall b.
Ptr ExportFenceCreateInfo -> ExportFenceCreateInfo -> IO b -> IO b
pokeCStruct Ptr ExportFenceCreateInfo
p ExportFenceCreateInfo{ExternalFenceHandleTypeFlags
handleTypes :: ExternalFenceHandleTypeFlags
$sel:handleTypes:ExportFenceCreateInfo :: ExportFenceCreateInfo -> ExternalFenceHandleTypeFlags
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceCreateInfo
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 ((Ptr ExportFenceCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlags)) (ExternalFenceHandleTypeFlags
handleTypes)
IO b
f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr ExportFenceCreateInfo -> IO b -> IO b
pokeZeroCStruct Ptr ExportFenceCreateInfo
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
IO b
f
instance FromCStruct ExportFenceCreateInfo where
peekCStruct :: Ptr ExportFenceCreateInfo -> IO ExportFenceCreateInfo
peekCStruct Ptr ExportFenceCreateInfo
p = do
ExternalFenceHandleTypeFlags
handleTypes <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlags ((Ptr ExportFenceCreateInfo
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ExternalFenceHandleTypeFlags))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ExternalFenceHandleTypeFlags -> ExportFenceCreateInfo
ExportFenceCreateInfo
ExternalFenceHandleTypeFlags
handleTypes
instance Storable ExportFenceCreateInfo where
sizeOf :: ExportFenceCreateInfo -> Int
sizeOf ~ExportFenceCreateInfo
_ = Int
24
alignment :: ExportFenceCreateInfo -> Int
alignment ~ExportFenceCreateInfo
_ = Int
8
peek :: Ptr ExportFenceCreateInfo -> IO ExportFenceCreateInfo
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ExportFenceCreateInfo -> ExportFenceCreateInfo -> IO ()
poke Ptr ExportFenceCreateInfo
ptr ExportFenceCreateInfo
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportFenceCreateInfo
ptr ExportFenceCreateInfo
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ExportFenceCreateInfo where
zero :: ExportFenceCreateInfo
zero = ExternalFenceHandleTypeFlags -> ExportFenceCreateInfo
ExportFenceCreateInfo
forall a. Zero a => a
zero