{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_external_semaphore_fd ( getSemaphoreFdKHR
, importSemaphoreFdKHR
, ImportSemaphoreFdInfoKHR(..)
, SemaphoreGetFdInfoKHR(..)
, KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION
, pattern KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION
, KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME
, pattern KHR_EXTERNAL_SEMAPHORE_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(pVkGetSemaphoreFdKHR))
import Vulkan.Dynamic (DeviceCmds(pVkImportSemaphoreFdKHR))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits (ExternalSemaphoreHandleTypeFlagBits)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Semaphore)
import Vulkan.Core11.Enums.SemaphoreImportFlagBits (SemaphoreImportFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetSemaphoreFdKHR
:: FunPtr (Ptr Device_T -> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result) -> Ptr Device_T -> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result
getSemaphoreFdKHR :: forall io
. (MonadIO io)
=>
Device
->
SemaphoreGetFdInfoKHR
-> io (("fd" ::: Int32))
getSemaphoreFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> SemaphoreGetFdInfoKHR -> io ("fd" ::: Int32)
getSemaphoreFdKHR Device
device SemaphoreGetFdInfoKHR
getFdInfo = IO ("fd" ::: Int32) -> io ("fd" ::: Int32)
forall a. IO a -> io a
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 vkGetSemaphoreFdKHRPtr :: FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
vkGetSemaphoreFdKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
pVkGetSemaphoreFdKHR (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT ("fd" ::: Int32) IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT ("fd" ::: Int32) m a
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
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
vkGetSemaphoreFdKHRPtr FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
-> FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> 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. (HasCallStack, 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 String
"" String
"The function pointer for vkGetSemaphoreFdKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetSemaphoreFdKHR' :: Ptr Device_T -> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result
vkGetSemaphoreFdKHR' = FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
-> Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR
-> Ptr CInt
-> IO Result
mkVkGetSemaphoreFdKHR FunPtr
(Ptr Device_T
-> Ptr SemaphoreGetFdInfoKHR -> Ptr CInt -> IO Result)
vkGetSemaphoreFdKHRPtr
pGetFdInfo <- ((Ptr SemaphoreGetFdInfoKHR -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO (Ptr SemaphoreGetFdInfoKHR)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SemaphoreGetFdInfoKHR -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO (Ptr SemaphoreGetFdInfoKHR))
-> ((Ptr SemaphoreGetFdInfoKHR -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32))
-> ContT ("fd" ::: Int32) IO (Ptr SemaphoreGetFdInfoKHR)
forall a b. (a -> b) -> a -> b
$ SemaphoreGetFdInfoKHR
-> (Ptr SemaphoreGetFdInfoKHR -> IO ("fd" ::: Int32))
-> IO ("fd" ::: Int32)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
SemaphoreGetFdInfoKHR
-> (Ptr SemaphoreGetFdInfoKHR -> IO b) -> IO b
withCStruct (SemaphoreGetFdInfoKHR
getFdInfo)
pPFd <- ContT $ bracket (callocBytes @CInt 4) free
r <- lift $ traceAroundEvent "vkGetSemaphoreFdKHR" (vkGetSemaphoreFdKHR'
(deviceHandle (device))
pGetFdInfo
(pPFd))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
pFd <- lift $ peek @CInt pPFd
pure $ ((coerce @CInt @Int32 pFd))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkImportSemaphoreFdKHR
:: FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result) -> Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result
importSemaphoreFdKHR :: forall io
. (MonadIO io)
=>
Device
->
ImportSemaphoreFdInfoKHR
-> io ()
importSemaphoreFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> ImportSemaphoreFdInfoKHR -> io ()
importSemaphoreFdKHR Device
device ImportSemaphoreFdInfoKHR
importSemaphoreFdInfo = IO () -> io ()
forall a. IO a -> io a
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 vkImportSemaphoreFdKHRPtr :: FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
vkImportSemaphoreFdKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
pVkImportSemaphoreFdKHR (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
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 -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
vkImportSemaphoreFdKHRPtr FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
-> FunPtr
(Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, 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 String
"" String
"The function pointer for vkImportSemaphoreFdKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkImportSemaphoreFdKHR' :: Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result
vkImportSemaphoreFdKHR' = FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
-> Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result
mkVkImportSemaphoreFdKHR FunPtr (Ptr Device_T -> Ptr ImportSemaphoreFdInfoKHR -> IO Result)
vkImportSemaphoreFdKHRPtr
pImportSemaphoreFdInfo <- ((Ptr ImportSemaphoreFdInfoKHR -> IO ()) -> IO ())
-> ContT () IO (Ptr ImportSemaphoreFdInfoKHR)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr ImportSemaphoreFdInfoKHR -> IO ()) -> IO ())
-> ContT () IO (Ptr ImportSemaphoreFdInfoKHR))
-> ((Ptr ImportSemaphoreFdInfoKHR -> IO ()) -> IO ())
-> ContT () IO (Ptr ImportSemaphoreFdInfoKHR)
forall a b. (a -> b) -> a -> b
$ ImportSemaphoreFdInfoKHR
-> (Ptr ImportSemaphoreFdInfoKHR -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
ImportSemaphoreFdInfoKHR
-> (Ptr ImportSemaphoreFdInfoKHR -> IO b) -> IO b
withCStruct (ImportSemaphoreFdInfoKHR
importSemaphoreFdInfo)
r <- lift $ traceAroundEvent "vkImportSemaphoreFdKHR" (vkImportSemaphoreFdKHR'
(deviceHandle (device))
pImportSemaphoreFdInfo)
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
data ImportSemaphoreFdInfoKHR = ImportSemaphoreFdInfoKHR
{
ImportSemaphoreFdInfoKHR -> Semaphore
semaphore :: Semaphore
,
ImportSemaphoreFdInfoKHR -> SemaphoreImportFlags
flags :: SemaphoreImportFlags
,
ImportSemaphoreFdInfoKHR -> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
,
ImportSemaphoreFdInfoKHR -> "fd" ::: Int32
fd :: Int32
}
deriving (Typeable, ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool
(ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool)
-> (ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool)
-> Eq ImportSemaphoreFdInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool
== :: ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool
$c/= :: ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool
/= :: ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportSemaphoreFdInfoKHR)
#endif
deriving instance Show ImportSemaphoreFdInfoKHR
instance ToCStruct ImportSemaphoreFdInfoKHR where
withCStruct :: forall b.
ImportSemaphoreFdInfoKHR
-> (Ptr ImportSemaphoreFdInfoKHR -> IO b) -> IO b
withCStruct ImportSemaphoreFdInfoKHR
x Ptr ImportSemaphoreFdInfoKHR -> IO b
f = Int -> (Ptr ImportSemaphoreFdInfoKHR -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((Ptr ImportSemaphoreFdInfoKHR -> IO b) -> IO b)
-> (Ptr ImportSemaphoreFdInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ImportSemaphoreFdInfoKHR
p -> Ptr ImportSemaphoreFdInfoKHR
-> ImportSemaphoreFdInfoKHR -> IO b -> IO b
forall b.
Ptr ImportSemaphoreFdInfoKHR
-> ImportSemaphoreFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportSemaphoreFdInfoKHR
p ImportSemaphoreFdInfoKHR
x (Ptr ImportSemaphoreFdInfoKHR -> IO b
f Ptr ImportSemaphoreFdInfoKHR
p)
pokeCStruct :: forall b.
Ptr ImportSemaphoreFdInfoKHR
-> ImportSemaphoreFdInfoKHR -> IO b -> IO b
pokeCStruct Ptr ImportSemaphoreFdInfoKHR
p ImportSemaphoreFdInfoKHR{"fd" ::: Int32
SemaphoreImportFlags
ExternalSemaphoreHandleTypeFlagBits
Semaphore
semaphore :: ImportSemaphoreFdInfoKHR -> Semaphore
flags :: ImportSemaphoreFdInfoKHR -> SemaphoreImportFlags
handleType :: ImportSemaphoreFdInfoKHR -> ExternalSemaphoreHandleTypeFlagBits
fd :: ImportSemaphoreFdInfoKHR -> "fd" ::: Int32
semaphore :: Semaphore
flags :: SemaphoreImportFlags
handleType :: ExternalSemaphoreHandleTypeFlagBits
fd :: "fd" ::: Int32
..} IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
Ptr SemaphoreImportFlags -> SemaphoreImportFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr SemaphoreImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SemaphoreImportFlags)) (SemaphoreImportFlags
flags)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr CInt
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. Ptr ImportSemaphoreFdInfoKHR -> IO b -> IO b
pokeZeroCStruct Ptr ImportSemaphoreFdInfoKHR
p IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero)
Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ImportSemaphoreFdInfoKHR where
peekCStruct :: Ptr ImportSemaphoreFdInfoKHR -> IO ImportSemaphoreFdInfoKHR
peekCStruct Ptr ImportSemaphoreFdInfoKHR
p = do
semaphore <- forall a. Storable a => Ptr a -> IO a
peek @Semaphore ((Ptr ImportSemaphoreFdInfoKHR
p Ptr ImportSemaphoreFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore))
flags <- peek @SemaphoreImportFlags ((p `plusPtr` 24 :: Ptr SemaphoreImportFlags))
handleType <- peek @ExternalSemaphoreHandleTypeFlagBits ((p `plusPtr` 28 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
fd <- peek @CInt ((p `plusPtr` 32 :: Ptr CInt))
pure $ ImportSemaphoreFdInfoKHR
semaphore flags handleType (coerce @CInt @Int32 fd)
instance Storable ImportSemaphoreFdInfoKHR where
sizeOf :: ImportSemaphoreFdInfoKHR -> Int
sizeOf ~ImportSemaphoreFdInfoKHR
_ = Int
40
alignment :: ImportSemaphoreFdInfoKHR -> Int
alignment ~ImportSemaphoreFdInfoKHR
_ = Int
8
peek :: Ptr ImportSemaphoreFdInfoKHR -> IO ImportSemaphoreFdInfoKHR
peek = Ptr ImportSemaphoreFdInfoKHR -> IO ImportSemaphoreFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ImportSemaphoreFdInfoKHR -> ImportSemaphoreFdInfoKHR -> IO ()
poke Ptr ImportSemaphoreFdInfoKHR
ptr ImportSemaphoreFdInfoKHR
poked = Ptr ImportSemaphoreFdInfoKHR
-> ImportSemaphoreFdInfoKHR -> IO () -> IO ()
forall b.
Ptr ImportSemaphoreFdInfoKHR
-> ImportSemaphoreFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportSemaphoreFdInfoKHR
ptr ImportSemaphoreFdInfoKHR
poked (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportSemaphoreFdInfoKHR where
zero :: ImportSemaphoreFdInfoKHR
zero = Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportSemaphoreFdInfoKHR
ImportSemaphoreFdInfoKHR
Semaphore
forall a. Zero a => a
zero
SemaphoreImportFlags
forall a. Zero a => a
zero
ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero
"fd" ::: Int32
forall a. Zero a => a
zero
data SemaphoreGetFdInfoKHR = SemaphoreGetFdInfoKHR
{
SemaphoreGetFdInfoKHR -> Semaphore
semaphore :: Semaphore
,
SemaphoreGetFdInfoKHR -> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
}
deriving (Typeable, SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool
(SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool)
-> (SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool)
-> Eq SemaphoreGetFdInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool
== :: SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool
$c/= :: SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool
/= :: SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreGetFdInfoKHR)
#endif
deriving instance Show SemaphoreGetFdInfoKHR
instance ToCStruct SemaphoreGetFdInfoKHR where
withCStruct :: forall b.
SemaphoreGetFdInfoKHR
-> (Ptr SemaphoreGetFdInfoKHR -> IO b) -> IO b
withCStruct SemaphoreGetFdInfoKHR
x Ptr SemaphoreGetFdInfoKHR -> IO b
f = Int -> (Ptr SemaphoreGetFdInfoKHR -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr SemaphoreGetFdInfoKHR -> IO b) -> IO b)
-> (Ptr SemaphoreGetFdInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr SemaphoreGetFdInfoKHR
p -> Ptr SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> IO b -> IO b
forall b.
Ptr SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SemaphoreGetFdInfoKHR
p SemaphoreGetFdInfoKHR
x (Ptr SemaphoreGetFdInfoKHR -> IO b
f Ptr SemaphoreGetFdInfoKHR
p)
pokeCStruct :: forall b.
Ptr SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> IO b -> IO b
pokeCStruct Ptr SemaphoreGetFdInfoKHR
p SemaphoreGetFdInfoKHR{ExternalSemaphoreHandleTypeFlagBits
Semaphore
semaphore :: SemaphoreGetFdInfoKHR -> Semaphore
handleType :: SemaphoreGetFdInfoKHR -> ExternalSemaphoreHandleTypeFlagBits
semaphore :: Semaphore
handleType :: ExternalSemaphoreHandleTypeFlagBits
..} IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr SemaphoreGetFdInfoKHR -> IO b -> IO b
pokeZeroCStruct Ptr SemaphoreGetFdInfoKHR
p IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct SemaphoreGetFdInfoKHR where
peekCStruct :: Ptr SemaphoreGetFdInfoKHR -> IO SemaphoreGetFdInfoKHR
peekCStruct Ptr SemaphoreGetFdInfoKHR
p = do
semaphore <- forall a. Storable a => Ptr a -> IO a
peek @Semaphore ((Ptr SemaphoreGetFdInfoKHR
p Ptr SemaphoreGetFdInfoKHR -> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore))
handleType <- peek @ExternalSemaphoreHandleTypeFlagBits ((p `plusPtr` 24 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
pure $ SemaphoreGetFdInfoKHR
semaphore handleType
instance Storable SemaphoreGetFdInfoKHR where
sizeOf :: SemaphoreGetFdInfoKHR -> Int
sizeOf ~SemaphoreGetFdInfoKHR
_ = Int
32
alignment :: SemaphoreGetFdInfoKHR -> Int
alignment ~SemaphoreGetFdInfoKHR
_ = Int
8
peek :: Ptr SemaphoreGetFdInfoKHR -> IO SemaphoreGetFdInfoKHR
peek = Ptr SemaphoreGetFdInfoKHR -> IO SemaphoreGetFdInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> IO ()
poke Ptr SemaphoreGetFdInfoKHR
ptr SemaphoreGetFdInfoKHR
poked = Ptr SemaphoreGetFdInfoKHR
-> SemaphoreGetFdInfoKHR -> IO () -> IO ()
forall b.
Ptr SemaphoreGetFdInfoKHR -> SemaphoreGetFdInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SemaphoreGetFdInfoKHR
ptr SemaphoreGetFdInfoKHR
poked (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero SemaphoreGetFdInfoKHR where
zero :: SemaphoreGetFdInfoKHR
zero = Semaphore
-> ExternalSemaphoreHandleTypeFlagBits -> SemaphoreGetFdInfoKHR
SemaphoreGetFdInfoKHR
Semaphore
forall a. Zero a => a
zero
ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero
type KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1
pattern KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION :: forall a . Integral a => a
pattern $mKHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bKHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION :: forall a. Integral a => a
KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1
type KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = "VK_KHR_external_semaphore_fd"
pattern KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mKHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bKHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = "VK_KHR_external_semaphore_fd"