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