{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_external_memory_fd ( getMemoryFdKHR
, getMemoryFdPropertiesKHR
, ImportMemoryFdInfoKHR(..)
, MemoryFdPropertiesKHR(..)
, MemoryGetFdInfoKHR(..)
, KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION
, pattern KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION
, KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME
, pattern KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
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 Foreign.C.Types (CInt(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CInt)
import Foreign.C.Types (CInt(CInt))
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 Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetMemoryFdKHR))
import Vulkan.Dynamic (DeviceCmds(pVkGetMemoryFdPropertiesKHR))
import Vulkan.Core10.Handles (DeviceMemory)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlagBits)
import Vulkan.Core11.Enums.ExternalMemoryHandleTypeFlagBits (ExternalMemoryHandleTypeFlagBits(..))
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetMemoryFdKHR
:: FunPtr (Ptr Device_T -> Ptr MemoryGetFdInfoKHR -> Ptr CInt -> IO Result) -> Ptr Device_T -> Ptr MemoryGetFdInfoKHR -> Ptr CInt -> IO Result
getMemoryFdKHR :: forall io
. (MonadIO io)
=>
Device
->
MemoryGetFdInfoKHR
-> io (("fd" ::: Int32))
getMemoryFdKHR :: Device -> MemoryGetFdInfoKHR -> io ("fd" ::: Int32)
getMemoryFdKHR device :: Device
device getFdInfo :: MemoryGetFdInfoKHR
getFdInfo = IO ("fd" ::: Int32) -> io ("fd" ::: Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("fd" ::: Int32) -> io ("fd" ::: Int32))
-> (ContT ("fd" ::: Int32) IO ("fd" ::: Int32)
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO ("fd" ::: Int32)
-> io ("fd" ::: Int32)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT ("fd" ::: Int32) IO ("fd" ::: Int32) -> IO ("fd" ::: Int32)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT ("fd" ::: Int32) IO ("fd" ::: Int32) -> io ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO ("fd" ::: Int32)
-> io ("fd" ::: Int32)
forall a b. (a -> b) -> a -> b
$ do
let vkGetMemoryFdKHRPtr :: FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetMemoryFdKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
pVkGetMemoryFdKHR (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT ("fd" ::: Int32) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("fd" ::: Int32) IO ())
-> IO () -> ContT ("fd" ::: Int32) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetMemoryFdKHRPtr FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
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 vkGetMemoryFdKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetMemoryFdKHR' :: Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetMemoryFdKHR' = FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
mkVkGetMemoryFdKHR FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetMemoryFdKHRPtr
"pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
pGetFdInfo <- ((("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR))
-> ((("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
forall a b. (a -> b) -> a -> b
$ MemoryGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (MemoryGetFdInfoKHR
getFdInfo)
"pFd" ::: Ptr CInt
pPFd <- ((("pFd" ::: Ptr CInt) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO ("pFd" ::: Ptr CInt)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pFd" ::: Ptr CInt) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO ("pFd" ::: Ptr CInt))
-> ((("pFd" ::: Ptr CInt) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO ("pFd" ::: Ptr CInt)
forall a b. (a -> b) -> a -> b
$ IO ("pFd" ::: Ptr CInt)
-> (("pFd" ::: Ptr CInt) -> IO ())
-> (("pFd" ::: Ptr CInt) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pFd" ::: Ptr CInt)
forall a. Int -> IO (Ptr a)
callocBytes @CInt 4) ("pFd" ::: Ptr CInt) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT ("fd" ::: Int32) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("fd" ::: Int32) IO Result)
-> IO Result -> ContT ("fd" ::: Int32) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetMemoryFdKHR" (Ptr Device_T
-> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetMemoryFdKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
pGetFdInfo ("pFd" ::: Ptr CInt
pPFd))
IO () -> ContT ("fd" ::: Int32) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("fd" ::: Int32) IO ())
-> IO () -> ContT ("fd" ::: Int32) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
CInt
pFd <- IO CInt -> ContT ("fd" ::: Int32) IO CInt
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO CInt -> ContT ("fd" ::: Int32) IO CInt)
-> IO CInt -> ContT ("fd" ::: Int32) IO CInt
forall a b. (a -> b) -> a -> b
$ ("pFd" ::: Ptr CInt) -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek @CInt "pFd" ::: Ptr CInt
pPFd
("fd" ::: Int32) -> ContT ("fd" ::: Int32) IO ("fd" ::: Int32)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("fd" ::: Int32) -> ContT ("fd" ::: Int32) IO ("fd" ::: Int32))
-> ("fd" ::: Int32) -> ContT ("fd" ::: Int32) IO ("fd" ::: Int32)
forall a b. (a -> b) -> a -> b
$ (((\(CInt a :: "fd" ::: Int32
a) -> "fd" ::: Int32
a) CInt
pFd))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetMemoryFdPropertiesKHR
:: FunPtr (Ptr Device_T -> ExternalMemoryHandleTypeFlagBits -> CInt -> Ptr MemoryFdPropertiesKHR -> IO Result) -> Ptr Device_T -> ExternalMemoryHandleTypeFlagBits -> CInt -> Ptr MemoryFdPropertiesKHR -> IO Result
getMemoryFdPropertiesKHR :: forall io
. (MonadIO io)
=>
Device
->
ExternalMemoryHandleTypeFlagBits
->
("fd" ::: Int32)
-> io (MemoryFdPropertiesKHR)
getMemoryFdPropertiesKHR :: Device
-> ExternalMemoryHandleTypeFlagBits
-> ("fd" ::: Int32)
-> io MemoryFdPropertiesKHR
getMemoryFdPropertiesKHR device :: Device
device handleType :: ExternalMemoryHandleTypeFlagBits
handleType fd :: "fd" ::: Int32
fd = IO MemoryFdPropertiesKHR -> io MemoryFdPropertiesKHR
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryFdPropertiesKHR -> io MemoryFdPropertiesKHR)
-> (ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
-> IO MemoryFdPropertiesKHR)
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
-> io MemoryFdPropertiesKHR
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
-> IO MemoryFdPropertiesKHR
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
-> io MemoryFdPropertiesKHR)
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
-> io MemoryFdPropertiesKHR
forall a b. (a -> b) -> a -> b
$ do
let vkGetMemoryFdPropertiesKHRPtr :: FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
vkGetMemoryFdPropertiesKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
pVkGetMemoryFdPropertiesKHR (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT MemoryFdPropertiesKHR IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT MemoryFdPropertiesKHR IO ())
-> IO () -> ContT MemoryFdPropertiesKHR IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
vkGetMemoryFdPropertiesKHRPtr FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
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 vkGetMemoryFdPropertiesKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetMemoryFdPropertiesKHR' :: Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result
vkGetMemoryFdPropertiesKHR' = FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
-> Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result
mkVkGetMemoryFdPropertiesKHR FunPtr
(Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result)
vkGetMemoryFdPropertiesKHRPtr
"pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
pPMemoryFdProperties <- ((("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR)
-> ContT
MemoryFdPropertiesKHR
IO
("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct MemoryFdPropertiesKHR =>
(("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b)
-> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @MemoryFdPropertiesKHR)
Result
r <- IO Result -> ContT MemoryFdPropertiesKHR IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT MemoryFdPropertiesKHR IO Result)
-> IO Result -> ContT MemoryFdPropertiesKHR IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetMemoryFdPropertiesKHR" (Ptr Device_T
-> ExternalMemoryHandleTypeFlagBits
-> CInt
-> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO Result
vkGetMemoryFdPropertiesKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) (ExternalMemoryHandleTypeFlagBits
handleType) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
fd)) ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
pPMemoryFdProperties))
IO () -> ContT MemoryFdPropertiesKHR IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT MemoryFdPropertiesKHR IO ())
-> IO () -> ContT MemoryFdPropertiesKHR IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
MemoryFdPropertiesKHR
pMemoryFdProperties <- IO MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
forall a b. (a -> b) -> a -> b
$ ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @MemoryFdPropertiesKHR "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
pPMemoryFdProperties
MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR
-> ContT MemoryFdPropertiesKHR IO MemoryFdPropertiesKHR
forall a b. (a -> b) -> a -> b
$ (MemoryFdPropertiesKHR
pMemoryFdProperties)
data ImportMemoryFdInfoKHR = ImportMemoryFdInfoKHR
{
ImportMemoryFdInfoKHR -> ExternalMemoryHandleTypeFlagBits
handleType :: ExternalMemoryHandleTypeFlagBits
,
ImportMemoryFdInfoKHR -> "fd" ::: Int32
fd :: Int32
}
deriving (Typeable, ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool
(ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool)
-> (ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool)
-> Eq ImportMemoryFdInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool
$c/= :: ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool
== :: ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool
$c== :: ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportMemoryFdInfoKHR)
#endif
deriving instance Show ImportMemoryFdInfoKHR
instance ToCStruct ImportMemoryFdInfoKHR where
withCStruct :: ImportMemoryFdInfoKHR
-> (Ptr ImportMemoryFdInfoKHR -> IO b) -> IO b
withCStruct x :: ImportMemoryFdInfoKHR
x f :: Ptr ImportMemoryFdInfoKHR -> IO b
f = Int -> Int -> (Ptr ImportMemoryFdInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr ImportMemoryFdInfoKHR -> IO b) -> IO b)
-> (Ptr ImportMemoryFdInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ImportMemoryFdInfoKHR
p -> Ptr ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportMemoryFdInfoKHR
p ImportMemoryFdInfoKHR
x (Ptr ImportMemoryFdInfoKHR -> IO b
f Ptr ImportMemoryFdInfoKHR
p)
pokeCStruct :: Ptr ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr ImportMemoryFdInfoKHR
p ImportMemoryFdInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr ExternalMemoryHandleTypeFlagBits
-> ExternalMemoryHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR
-> Int -> Ptr ExternalMemoryHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlagBits
handleType)
("pFd" ::: Ptr CInt) -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
fd))
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ImportMemoryFdInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr ImportMemoryFdInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pFd" ::: Ptr CInt) -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ImportMemoryFdInfoKHR where
peekCStruct :: Ptr ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR
peekCStruct p :: Ptr ImportMemoryFdInfoKHR
p = do
ExternalMemoryHandleTypeFlagBits
handleType <- Ptr ExternalMemoryHandleTypeFlagBits
-> IO ExternalMemoryHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlagBits ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR
-> Int -> Ptr ExternalMemoryHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ExternalMemoryHandleTypeFlagBits))
CInt
fd <- ("pFd" ::: Ptr CInt) -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek @CInt ((Ptr ImportMemoryFdInfoKHR
p Ptr ImportMemoryFdInfoKHR -> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr CInt))
ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR)
-> ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR
forall a b. (a -> b) -> a -> b
$ ExternalMemoryHandleTypeFlagBits
-> ("fd" ::: Int32) -> ImportMemoryFdInfoKHR
ImportMemoryFdInfoKHR
ExternalMemoryHandleTypeFlagBits
handleType ((\(CInt a :: "fd" ::: Int32
a) -> "fd" ::: Int32
a) CInt
fd)
instance Storable ImportMemoryFdInfoKHR where
sizeOf :: ImportMemoryFdInfoKHR -> Int
sizeOf ~ImportMemoryFdInfoKHR
_ = 24
alignment :: ImportMemoryFdInfoKHR -> Int
alignment ~ImportMemoryFdInfoKHR
_ = 8
peek :: Ptr ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR
peek = Ptr ImportMemoryFdInfoKHR -> IO ImportMemoryFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ImportMemoryFdInfoKHR -> ImportMemoryFdInfoKHR -> IO ()
poke ptr :: Ptr ImportMemoryFdInfoKHR
ptr poked :: ImportMemoryFdInfoKHR
poked = Ptr ImportMemoryFdInfoKHR
-> ImportMemoryFdInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportMemoryFdInfoKHR
ptr ImportMemoryFdInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportMemoryFdInfoKHR where
zero :: ImportMemoryFdInfoKHR
zero = ExternalMemoryHandleTypeFlagBits
-> ("fd" ::: Int32) -> ImportMemoryFdInfoKHR
ImportMemoryFdInfoKHR
ExternalMemoryHandleTypeFlagBits
forall a. Zero a => a
zero
"fd" ::: Int32
forall a. Zero a => a
zero
data MemoryFdPropertiesKHR = MemoryFdPropertiesKHR
{
MemoryFdPropertiesKHR -> Word32
memoryTypeBits :: Word32 }
deriving (Typeable, MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool
(MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool)
-> (MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool)
-> Eq MemoryFdPropertiesKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool
$c/= :: MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool
== :: MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool
$c== :: MemoryFdPropertiesKHR -> MemoryFdPropertiesKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryFdPropertiesKHR)
#endif
deriving instance Show MemoryFdPropertiesKHR
instance ToCStruct MemoryFdPropertiesKHR where
withCStruct :: MemoryFdPropertiesKHR
-> (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b)
-> IO b
withCStruct x :: MemoryFdPropertiesKHR
x f :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b
f = Int
-> Int
-> (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b)
-> IO b)
-> (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p -> ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p MemoryFdPropertiesKHR
x (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR) -> IO b
f "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p)
pokeCStruct :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR -> IO b -> IO b
pokeCStruct p :: "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p MemoryFdPropertiesKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
memoryTypeBits)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO b -> IO b
pokeZeroCStruct p :: "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct MemoryFdPropertiesKHR where
peekCStruct :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR
peekCStruct p :: "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p = do
Word32
memoryTypeBits <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
p ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
MemoryFdPropertiesKHR -> IO MemoryFdPropertiesKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryFdPropertiesKHR -> IO MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR -> IO MemoryFdPropertiesKHR
forall a b. (a -> b) -> a -> b
$ Word32 -> MemoryFdPropertiesKHR
MemoryFdPropertiesKHR
Word32
memoryTypeBits
instance Storable MemoryFdPropertiesKHR where
sizeOf :: MemoryFdPropertiesKHR -> Int
sizeOf ~MemoryFdPropertiesKHR
_ = 24
alignment :: MemoryFdPropertiesKHR -> Int
alignment ~MemoryFdPropertiesKHR
_ = 8
peek :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR
peek = ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> IO MemoryFdPropertiesKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR -> IO ()
poke ptr :: "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
ptr poked :: MemoryFdPropertiesKHR
poked = ("pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR)
-> MemoryFdPropertiesKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMemoryFdProperties" ::: Ptr MemoryFdPropertiesKHR
ptr MemoryFdPropertiesKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero MemoryFdPropertiesKHR where
zero :: MemoryFdPropertiesKHR
zero = Word32 -> MemoryFdPropertiesKHR
MemoryFdPropertiesKHR
Word32
forall a. Zero a => a
zero
data MemoryGetFdInfoKHR = MemoryGetFdInfoKHR
{
MemoryGetFdInfoKHR -> DeviceMemory
memory :: DeviceMemory
,
MemoryGetFdInfoKHR -> ExternalMemoryHandleTypeFlagBits
handleType :: ExternalMemoryHandleTypeFlagBits
}
deriving (Typeable, MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool
(MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool)
-> (MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool)
-> Eq MemoryGetFdInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool
$c/= :: MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool
== :: MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool
$c== :: MemoryGetFdInfoKHR -> MemoryGetFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryGetFdInfoKHR)
#endif
deriving instance Show MemoryGetFdInfoKHR
instance ToCStruct MemoryGetFdInfoKHR where
withCStruct :: MemoryGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b) -> IO b
withCStruct x :: MemoryGetFdInfoKHR
x f :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b
f = Int
-> Int
-> (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b) -> IO b)
-> (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p -> ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> MemoryGetFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p MemoryGetFdInfoKHR
x (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b
f "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p)
pokeCStruct :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> MemoryGetFdInfoKHR -> IO b -> IO b
pokeCStruct p :: "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p MemoryGetFdInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DeviceMemory -> DeviceMemory -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory)) (DeviceMemory
memory)
Ptr ExternalMemoryHandleTypeFlagBits
-> ExternalMemoryHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr ExternalMemoryHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlagBits
handleType)
IO b
f
cStructSize :: Int
cStructSize = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct p :: "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DeviceMemory -> DeviceMemory -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory)) (DeviceMemory
forall a. Zero a => a
zero)
Ptr ExternalMemoryHandleTypeFlagBits
-> ExternalMemoryHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr ExternalMemoryHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits)) (ExternalMemoryHandleTypeFlagBits
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct MemoryGetFdInfoKHR where
peekCStruct :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO MemoryGetFdInfoKHR
peekCStruct p :: "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p = do
DeviceMemory
memory <- Ptr DeviceMemory -> IO DeviceMemory
forall a. Storable a => Ptr a -> IO a
peek @DeviceMemory (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory))
ExternalMemoryHandleTypeFlagBits
handleType <- Ptr ExternalMemoryHandleTypeFlagBits
-> IO ExternalMemoryHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalMemoryHandleTypeFlagBits (("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> Int -> Ptr ExternalMemoryHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalMemoryHandleTypeFlagBits))
MemoryGetFdInfoKHR -> IO MemoryGetFdInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryGetFdInfoKHR -> IO MemoryGetFdInfoKHR)
-> MemoryGetFdInfoKHR -> IO MemoryGetFdInfoKHR
forall a b. (a -> b) -> a -> b
$ DeviceMemory
-> ExternalMemoryHandleTypeFlagBits -> MemoryGetFdInfoKHR
MemoryGetFdInfoKHR
DeviceMemory
memory ExternalMemoryHandleTypeFlagBits
handleType
instance Storable MemoryGetFdInfoKHR where
sizeOf :: MemoryGetFdInfoKHR -> Int
sizeOf ~MemoryGetFdInfoKHR
_ = 32
alignment :: MemoryGetFdInfoKHR -> Int
alignment ~MemoryGetFdInfoKHR
_ = 8
peek :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO MemoryGetFdInfoKHR
peek = ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR) -> IO MemoryGetFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> MemoryGetFdInfoKHR -> IO ()
poke ptr :: "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
ptr poked :: MemoryGetFdInfoKHR
poked = ("pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR)
-> MemoryGetFdInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr MemoryGetFdInfoKHR
ptr MemoryGetFdInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero MemoryGetFdInfoKHR where
zero :: MemoryGetFdInfoKHR
zero = DeviceMemory
-> ExternalMemoryHandleTypeFlagBits -> MemoryGetFdInfoKHR
MemoryGetFdInfoKHR
DeviceMemory
forall a. Zero a => a
zero
ExternalMemoryHandleTypeFlagBits
forall a. Zero a => a
zero
type KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION = 1
pattern KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_EXTERNAL_MEMORY_FD_SPEC_VERSION :: a
$mKHR_EXTERNAL_MEMORY_FD_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION = 1
type KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME = "VK_KHR_external_memory_fd"
pattern KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME :: a
$mKHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME = "VK_KHR_external_memory_fd"