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