{-# 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 (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.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(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.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_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 :: Device -> FenceGetFdInfoKHR -> io ("fd" ::: Int32)
getFenceFdKHR device :: Device
device getFdInfo :: FenceGetFdInfoKHR
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 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 (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 FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
vkGetFenceFdKHRPtr FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("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 vkGetFenceFdKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
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 <- ((("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR))
-> ((("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT
("fd" ::: Int32) IO ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
forall a b. (a -> b) -> a -> b
$ FenceGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (FenceGetFdInfoKHR
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 "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))
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" 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 :: Device -> ImportFenceFdInfoKHR -> io ()
importFenceFdKHR device :: Device
device importFenceFdInfo :: ImportFenceFdInfoKHR
importFenceFdInfo = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
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 (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
vkImportFenceFdKHRPtr FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> 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 vkImportFenceFdKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
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 <- ((("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO ())
-> IO ())
-> ContT () IO ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO ())
-> IO ())
-> ContT () IO ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR))
-> ((("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO ())
-> IO ())
-> ContT () IO ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
forall a b. (a -> b) -> a -> b
$ ImportFenceFdInfoKHR
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO ())
-> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImportFenceFdInfoKHR
importFenceFdInfo)
Result
r <- IO Result -> ContT () IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT () IO Result)
-> IO Result -> ContT () IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkImportFenceFdKHR" (Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO Result
vkImportFenceFdKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
pImportFenceFdInfo)
IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () 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))
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
(ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool)
-> (ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool)
-> Eq ImportFenceFdInfoKHR
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 :: ImportFenceFdInfoKHR
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b
withCStruct x :: ImportFenceFdInfoKHR
x f :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b
f = Int
-> Int
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b)
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO b -> IO b
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 :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO b -> IO b
pokeCStruct p :: "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ImportFenceFdInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
fence)
Ptr FenceImportFlags -> FenceImportFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr FenceImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr FenceImportFlags)) (FenceImportFlags
flags)
Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
("pFd" ::: Ptr CInt) -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
fd))
IO b
f
cStructSize :: Int
cStructSize = 40
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct p :: "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
forall a. Zero a => a
zero)
Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
("pFd" ::: Ptr CInt) -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ImportFenceFdInfoKHR where
peekCStruct :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
peekCStruct p :: "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p = do
Fence
fence <- Ptr Fence -> IO Fence
forall a. Storable a => Ptr a -> IO a
peek @Fence (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence))
FenceImportFlags
flags <- Ptr FenceImportFlags -> IO FenceImportFlags
forall a. Storable a => Ptr a -> IO a
peek @FenceImportFlags (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr FenceImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr FenceImportFlags))
ExternalFenceHandleTypeFlagBits
handleType <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalFenceHandleTypeFlagBits))
CInt
fd <- ("pFd" ::: Ptr CInt) -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek @CInt (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> Int -> "pFd" ::: Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr CInt))
ImportFenceFdInfoKHR -> IO ImportFenceFdInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportFenceFdInfoKHR -> IO ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO ImportFenceFdInfoKHR
forall a b. (a -> b) -> a -> b
$ Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
Fence
fence FenceImportFlags
flags ExternalFenceHandleTypeFlagBits
handleType ((\(CInt a :: "fd" ::: Int32
a) -> "fd" ::: Int32
a) CInt
fd)
instance Storable ImportFenceFdInfoKHR where
sizeOf :: ImportFenceFdInfoKHR -> Int
sizeOf ~ImportFenceFdInfoKHR
_ = 40
alignment :: ImportFenceFdInfoKHR -> Int
alignment ~ImportFenceFdInfoKHR
_ = 8
peek :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
peek = ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO ()
poke ptr :: "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
ptr poked :: ImportFenceFdInfoKHR
poked = ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
ptr ImportFenceFdInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportFenceFdInfoKHR where
zero :: ImportFenceFdInfoKHR
zero = Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
Fence
forall a. Zero a => a
zero
FenceImportFlags
forall a. Zero a => a
zero
ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero
"fd" ::: Int32
forall a. Zero a => a
zero
data FenceGetFdInfoKHR = FenceGetFdInfoKHR
{
FenceGetFdInfoKHR -> Fence
fence :: Fence
,
FenceGetFdInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
}
deriving (Typeable, FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
(FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool)
-> (FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool)
-> Eq FenceGetFdInfoKHR
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 :: FenceGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b) -> IO b
withCStruct x :: FenceGetFdInfoKHR
x f :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b
f = Int
-> Int
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b) -> IO b)
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO b -> IO b
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 :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO b -> IO b
pokeCStruct p :: "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p FenceGetFdInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
fence)
Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
IO b
f
cStructSize :: Int
cStructSize = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct p :: "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
forall a. Zero a => a
zero)
Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct FenceGetFdInfoKHR where
peekCStruct :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO FenceGetFdInfoKHR
peekCStruct p :: "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p = do
Fence
fence <- Ptr Fence -> IO Fence
forall a. Storable a => Ptr a -> IO a
peek @Fence (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence))
ExternalFenceHandleTypeFlagBits
handleType <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceHandleTypeFlagBits))
FenceGetFdInfoKHR -> IO FenceGetFdInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (FenceGetFdInfoKHR -> IO FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO FenceGetFdInfoKHR
forall a b. (a -> b) -> a -> b
$ Fence -> ExternalFenceHandleTypeFlagBits -> FenceGetFdInfoKHR
FenceGetFdInfoKHR
Fence
fence ExternalFenceHandleTypeFlagBits
handleType
instance Storable FenceGetFdInfoKHR where
sizeOf :: FenceGetFdInfoKHR -> Int
sizeOf ~FenceGetFdInfoKHR
_ = 32
alignment :: FenceGetFdInfoKHR -> Int
alignment ~FenceGetFdInfoKHR
_ = 8
peek :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO FenceGetFdInfoKHR
peek = ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO FenceGetFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO ()
poke ptr :: "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
ptr poked :: FenceGetFdInfoKHR
poked = ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
ptr FenceGetFdInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero FenceGetFdInfoKHR where
zero :: FenceGetFdInfoKHR
zero = Fence -> ExternalFenceHandleTypeFlagBits -> FenceGetFdInfoKHR
FenceGetFdInfoKHR
Fence
forall a. Zero a => a
zero
ExternalFenceHandleTypeFlagBits
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 :: a
$mKHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> 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 :: a
$mKHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"