{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_external_fence_fd ( getFenceFdKHR
, importFenceFdKHR
, ImportFenceFdInfoKHR(..)
, FenceGetFdInfoKHR(..)
, KHR_EXTERNAL_FENCE_FD_SPEC_VERSION
, pattern KHR_EXTERNAL_FENCE_FD_SPEC_VERSION
, KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME
, pattern KHR_EXTERNAL_FENCE_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 (allocaBytes)
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 Data.Coerce (coerce)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Foreign.C.Types (CInt(..))
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.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CInt)
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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetFenceFdKHR))
import Vulkan.Dynamic (DeviceCmds(pVkImportFenceFdKHR))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits)
import Vulkan.Core10.Handles (Fence)
import Vulkan.Core11.Enums.FenceImportFlagBits (FenceImportFlags)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetFenceFdKHR
:: FunPtr (Ptr Device_T -> Ptr FenceGetFdInfoKHR -> Ptr CInt -> IO Result) -> Ptr Device_T -> Ptr FenceGetFdInfoKHR -> Ptr CInt -> IO Result
getFenceFdKHR :: forall io
. (MonadIO io)
=>
Device
->
FenceGetFdInfoKHR
-> io (("fd" ::: Int32))
getFenceFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> FenceGetFdInfoKHR -> io ("fd" ::: Int32)
getFenceFdKHR Device
device FenceGetFdInfoKHR
getFdInfo = 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 vkGetFenceFdKHRPtr :: FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetFenceFdKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
pVkGetFenceFdKHR (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
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 Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetFenceFdKHRPtr 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 vkGetFenceFdKHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkGetFenceFdKHR' :: Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetFenceFdKHR' = FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
mkVkGetFenceFdKHR FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetFenceFdKHRPtr
"pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
pGetFdInfo <- 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 (FenceGetFdInfoKHR
getFdInfo)
"pFd" ::: Ptr CInt
pPFd <- 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 c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @CInt Int
4) forall a. Ptr a -> IO ()
free
Result
r <- 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
"vkGetFenceFdKHR" (Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetFenceFdKHR'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
pGetFdInfo
("pFd" ::: Ptr CInt
pPFd))
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 ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
CInt
pFd <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @CInt "pFd" ::: Ptr CInt
pPFd
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ((coerce :: forall a b. Coercible a b => a -> b
coerce @CInt @Int32 CInt
pFd))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkImportFenceFdKHR
:: FunPtr (Ptr Device_T -> Ptr ImportFenceFdInfoKHR -> IO Result) -> Ptr Device_T -> Ptr ImportFenceFdInfoKHR -> IO Result
importFenceFdKHR :: forall io
. (MonadIO io)
=>
Device
->
ImportFenceFdInfoKHR
-> io ()
importFenceFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> ImportFenceFdInfoKHR -> io ()
importFenceFdKHR Device
device ImportFenceFdInfoKHR
importFenceFdInfo = 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 vkImportFenceFdKHRPtr :: FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
vkImportFenceFdKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
pVkImportFenceFdKHR (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
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 Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
vkImportFenceFdKHRPtr 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 vkImportFenceFdKHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkImportFenceFdKHR' :: Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO Result
vkImportFenceFdKHR' = FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
-> Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result
mkVkImportFenceFdKHR FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
vkImportFenceFdKHRPtr
"pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
pImportFenceFdInfo <- 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 (ImportFenceFdInfoKHR
importFenceFdInfo)
Result
r <- 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
"vkImportFenceFdKHR" (Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO Result
vkImportFenceFdKHR'
(Device -> Ptr Device_T
deviceHandle (Device
device))
"pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
pImportFenceFdInfo)
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 ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
data ImportFenceFdInfoKHR = ImportFenceFdInfoKHR
{
ImportFenceFdInfoKHR -> Fence
fence :: Fence
,
ImportFenceFdInfoKHR -> FenceImportFlags
flags :: FenceImportFlags
,
ImportFenceFdInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
,
ImportFenceFdInfoKHR -> "fd" ::: Int32
fd :: Int32
}
deriving (Typeable, ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
$c/= :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
== :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
$c== :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportFenceFdInfoKHR)
#endif
deriving instance Show ImportFenceFdInfoKHR
instance ToCStruct ImportFenceFdInfoKHR where
withCStruct :: forall b.
ImportFenceFdInfoKHR
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b
withCStruct ImportFenceFdInfoKHR
x ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \"pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ImportFenceFdInfoKHR
x (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b
f "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p)
pokeCStruct :: forall b.
("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ImportFenceFdInfoKHR{"fd" ::: Int32
Fence
FenceImportFlags
ExternalFenceHandleTypeFlagBits
fd :: "fd" ::: Int32
handleType :: ExternalFenceHandleTypeFlagBits
flags :: FenceImportFlags
fence :: Fence
$sel:fd:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> "fd" ::: Int32
$sel:handleType:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> ExternalFenceHandleTypeFlagBits
$sel:flags:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> FenceImportFlags
$sel:fence:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> Fence
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
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 (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (Fence
fence)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr FenceImportFlags)) (FenceImportFlags
flags)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
fd))
IO b
f
cStructSize :: Int
cStructSize = Int
40
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
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 (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ImportFenceFdInfoKHR where
peekCStruct :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
peekCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p = do
Fence
fence <- forall a. Storable a => Ptr a -> IO a
peek @Fence (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence))
FenceImportFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @FenceImportFlags (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr FenceImportFlags))
ExternalFenceHandleTypeFlagBits
handleType <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits))
CInt
fd <- forall a. Storable a => Ptr a -> IO a
peek @CInt (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
Fence
fence FenceImportFlags
flags ExternalFenceHandleTypeFlagBits
handleType (coerce :: forall a b. Coercible a b => a -> b
coerce @CInt @Int32 CInt
fd)
instance Storable ImportFenceFdInfoKHR where
sizeOf :: ImportFenceFdInfoKHR -> Int
sizeOf ~ImportFenceFdInfoKHR
_ = Int
40
alignment :: ImportFenceFdInfoKHR -> Int
alignment ~ImportFenceFdInfoKHR
_ = Int
8
peek :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO ()
poke "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
ptr ImportFenceFdInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
ptr ImportFenceFdInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportFenceFdInfoKHR where
zero :: ImportFenceFdInfoKHR
zero = Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
data FenceGetFdInfoKHR = FenceGetFdInfoKHR
{
FenceGetFdInfoKHR -> Fence
fence :: Fence
,
FenceGetFdInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
}
deriving (Typeable, FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
$c/= :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
== :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
$c== :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (FenceGetFdInfoKHR)
#endif
deriving instance Show FenceGetFdInfoKHR
instance ToCStruct FenceGetFdInfoKHR where
withCStruct :: forall b.
FenceGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b) -> IO b
withCStruct FenceGetFdInfoKHR
x ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p FenceGetFdInfoKHR
x (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b
f "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p)
pokeCStruct :: forall b.
("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p FenceGetFdInfoKHR{Fence
ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
fence :: Fence
$sel:handleType:FenceGetFdInfoKHR :: FenceGetFdInfoKHR -> ExternalFenceHandleTypeFlagBits
$sel:fence:FenceGetFdInfoKHR :: FenceGetFdInfoKHR -> Fence
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
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 (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (Fence
fence)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
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 (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (forall a. Zero a => a
zero)
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceHandleTypeFlagBits)) (forall a. Zero a => a
zero)
IO b
f
instance FromCStruct FenceGetFdInfoKHR where
peekCStruct :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO FenceGetFdInfoKHR
peekCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p = do
Fence
fence <- forall a. Storable a => Ptr a -> IO a
peek @Fence (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence))
ExternalFenceHandleTypeFlagBits
handleType <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceHandleTypeFlagBits))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Fence -> ExternalFenceHandleTypeFlagBits -> FenceGetFdInfoKHR
FenceGetFdInfoKHR
Fence
fence ExternalFenceHandleTypeFlagBits
handleType
instance Storable FenceGetFdInfoKHR where
sizeOf :: FenceGetFdInfoKHR -> Int
sizeOf ~FenceGetFdInfoKHR
_ = Int
32
alignment :: FenceGetFdInfoKHR -> Int
alignment ~FenceGetFdInfoKHR
_ = Int
8
peek :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO FenceGetFdInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO ()
poke "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
ptr FenceGetFdInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
ptr FenceGetFdInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero FenceGetFdInfoKHR where
zero :: FenceGetFdInfoKHR
zero = Fence -> ExternalFenceHandleTypeFlagBits -> FenceGetFdInfoKHR
FenceGetFdInfoKHR
forall a. Zero a => a
zero
forall a. Zero a => a
zero
type KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1
pattern KHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall a. Integral a => a
$mKHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1
type KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"
pattern KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mKHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"