{-# language CPP #-}
module Vulkan.Extensions.VK_KHR_external_semaphore_win32 ( getSemaphoreWin32HandleKHR
, importSemaphoreWin32HandleKHR
, ImportSemaphoreWin32HandleInfoKHR(..)
, ExportSemaphoreWin32HandleInfoKHR(..)
, D3D12FenceSubmitInfoKHR(..)
, SemaphoreGetWin32HandleInfoKHR(..)
, KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION
, pattern KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION
, KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME
, pattern KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME
, HANDLE
, DWORD
, LPCWSTR
, SECURITY_ATTRIBUTES
) 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 Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import qualified Data.Vector (null)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Extensions.VK_NV_external_memory_win32 (DWORD)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetSemaphoreWin32HandleKHR))
import Vulkan.Dynamic (DeviceCmds(pVkImportSemaphoreWin32HandleKHR))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits (ExternalSemaphoreHandleTypeFlagBits)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Extensions.VK_NV_external_memory_win32 (HANDLE)
import Vulkan.Extensions.VK_KHR_external_memory_win32 (LPCWSTR)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Extensions.VK_NV_external_memory_win32 (SECURITY_ATTRIBUTES)
import Vulkan.Core10.Handles (Semaphore)
import Vulkan.Core11.Enums.SemaphoreImportFlagBits (SemaphoreImportFlags)
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_D3D12_FENCE_SUBMIT_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.VK_NV_external_memory_win32 (DWORD)
import Vulkan.Extensions.VK_NV_external_memory_win32 (HANDLE)
import Vulkan.Extensions.VK_KHR_external_memory_win32 (LPCWSTR)
import Vulkan.Extensions.VK_NV_external_memory_win32 (SECURITY_ATTRIBUTES)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetSemaphoreWin32HandleKHR
:: FunPtr (Ptr Device_T -> Ptr SemaphoreGetWin32HandleInfoKHR -> Ptr HANDLE -> IO Result) -> Ptr Device_T -> Ptr SemaphoreGetWin32HandleInfoKHR -> Ptr HANDLE -> IO Result
getSemaphoreWin32HandleKHR :: forall io
. (MonadIO io)
=>
Device
->
SemaphoreGetWin32HandleInfoKHR
-> io (HANDLE)
getSemaphoreWin32HandleKHR :: Device -> SemaphoreGetWin32HandleInfoKHR -> io HANDLE
getSemaphoreWin32HandleKHR device :: Device
device getWin32HandleInfo :: SemaphoreGetWin32HandleInfoKHR
getWin32HandleInfo = IO HANDLE -> io HANDLE
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO HANDLE -> io HANDLE)
-> (ContT HANDLE IO HANDLE -> IO HANDLE)
-> ContT HANDLE IO HANDLE
-> io HANDLE
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT HANDLE IO HANDLE -> IO HANDLE
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT HANDLE IO HANDLE -> io HANDLE)
-> ContT HANDLE IO HANDLE -> io HANDLE
forall a b. (a -> b) -> a -> b
$ do
let vkGetSemaphoreWin32HandleKHRPtr :: FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
vkGetSemaphoreWin32HandleKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
pVkGetSemaphoreWin32HandleKHR (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT HANDLE IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT HANDLE IO ()) -> IO () -> ContT HANDLE IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
vkGetSemaphoreWin32HandleKHRPtr FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> 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 vkGetSemaphoreWin32HandleKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetSemaphoreWin32HandleKHR' :: Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
vkGetSemaphoreWin32HandleKHR' = FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
-> Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
mkVkGetSemaphoreWin32HandleKHR FunPtr
(Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result)
vkGetSemaphoreWin32HandleKHRPtr
"pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
pGetWin32HandleInfo <- ((("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO HANDLE)
-> IO HANDLE)
-> ContT
HANDLE
IO
("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO HANDLE)
-> IO HANDLE)
-> ContT
HANDLE
IO
("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR))
-> ((("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO HANDLE)
-> IO HANDLE)
-> ContT
HANDLE
IO
("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
forall a b. (a -> b) -> a -> b
$ SemaphoreGetWin32HandleInfoKHR
-> (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO HANDLE)
-> IO HANDLE
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SemaphoreGetWin32HandleInfoKHR
getWin32HandleInfo)
"pHandle" ::: Ptr HANDLE
pPHandle <- ((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
-> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
-> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE))
-> ((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
-> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE)
forall a b. (a -> b) -> a -> b
$ IO ("pHandle" ::: Ptr HANDLE)
-> (("pHandle" ::: Ptr HANDLE) -> IO ())
-> (("pHandle" ::: Ptr HANDLE) -> IO HANDLE)
-> IO HANDLE
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pHandle" ::: Ptr HANDLE)
forall a. Int -> IO (Ptr a)
callocBytes @HANDLE 8) ("pHandle" ::: Ptr HANDLE) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT HANDLE IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT HANDLE IO Result)
-> IO Result -> ContT HANDLE IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetSemaphoreWin32HandleKHR" (Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
vkGetSemaphoreWin32HandleKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
pGetWin32HandleInfo ("pHandle" ::: Ptr HANDLE
pPHandle))
IO () -> ContT HANDLE IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT HANDLE IO ()) -> IO () -> ContT HANDLE 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))
HANDLE
pHandle <- IO HANDLE -> ContT HANDLE IO HANDLE
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO HANDLE -> ContT HANDLE IO HANDLE)
-> IO HANDLE -> ContT HANDLE IO HANDLE
forall a b. (a -> b) -> a -> b
$ ("pHandle" ::: Ptr HANDLE) -> IO HANDLE
forall a. Storable a => Ptr a -> IO a
peek @HANDLE "pHandle" ::: Ptr HANDLE
pPHandle
HANDLE -> ContT HANDLE IO HANDLE
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HANDLE -> ContT HANDLE IO HANDLE)
-> HANDLE -> ContT HANDLE IO HANDLE
forall a b. (a -> b) -> a -> b
$ (HANDLE
pHandle)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkImportSemaphoreWin32HandleKHR
:: FunPtr (Ptr Device_T -> Ptr ImportSemaphoreWin32HandleInfoKHR -> IO Result) -> Ptr Device_T -> Ptr ImportSemaphoreWin32HandleInfoKHR -> IO Result
importSemaphoreWin32HandleKHR :: forall io
. (MonadIO io)
=>
Device
->
ImportSemaphoreWin32HandleInfoKHR
-> io ()
importSemaphoreWin32HandleKHR :: Device -> ImportSemaphoreWin32HandleInfoKHR -> io ()
importSemaphoreWin32HandleKHR device :: Device
device importSemaphoreWin32HandleInfo :: ImportSemaphoreWin32HandleInfoKHR
importSemaphoreWin32HandleInfo = 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 vkImportSemaphoreWin32HandleKHRPtr :: FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
vkImportSemaphoreWin32HandleKHRPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
pVkImportSemaphoreWin32HandleKHR (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
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
vkImportSemaphoreWin32HandleKHRPtr FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> 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 vkImportSemaphoreWin32HandleKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkImportSemaphoreWin32HandleKHR' :: Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result
vkImportSemaphoreWin32HandleKHR' = FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
-> Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result
mkVkImportSemaphoreWin32HandleKHR FunPtr
(Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result)
vkImportSemaphoreWin32HandleKHRPtr
"pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
pImportSemaphoreWin32HandleInfo <- ((("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ())
-> IO ())
-> ContT
()
IO
("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ())
-> IO ())
-> ContT
()
IO
("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR))
-> ((("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ())
-> IO ())
-> ContT
()
IO
("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
forall a b. (a -> b) -> a -> b
$ ImportSemaphoreWin32HandleInfoKHR
-> (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ())
-> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImportSemaphoreWin32HandleInfoKHR
importSemaphoreWin32HandleInfo)
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 "vkImportSemaphoreWin32HandleKHR" (Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result
vkImportSemaphoreWin32HandleKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
pImportSemaphoreWin32HandleInfo)
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 ImportSemaphoreWin32HandleInfoKHR = ImportSemaphoreWin32HandleInfoKHR
{
ImportSemaphoreWin32HandleInfoKHR -> Semaphore
semaphore :: Semaphore
,
ImportSemaphoreWin32HandleInfoKHR -> SemaphoreImportFlags
flags :: SemaphoreImportFlags
,
ImportSemaphoreWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
,
ImportSemaphoreWin32HandleInfoKHR -> HANDLE
handle :: HANDLE
,
ImportSemaphoreWin32HandleInfoKHR -> LPCWSTR
name :: LPCWSTR
}
deriving (Typeable, ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
(ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool)
-> (ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool)
-> Eq ImportSemaphoreWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
$c/= :: ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
== :: ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
$c== :: ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportSemaphoreWin32HandleInfoKHR)
#endif
deriving instance Show ImportSemaphoreWin32HandleInfoKHR
instance ToCStruct ImportSemaphoreWin32HandleInfoKHR where
withCStruct :: ImportSemaphoreWin32HandleInfoKHR
-> (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b)
-> IO b
withCStruct x :: ImportSemaphoreWin32HandleInfoKHR
x f :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b
f = Int
-> Int
-> (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b)
-> IO b)
-> (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p -> ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ImportSemaphoreWin32HandleInfoKHR
x (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b
f "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p)
pokeCStruct :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ImportSemaphoreWin32HandleInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
semaphore)
Ptr SemaphoreImportFlags -> SemaphoreImportFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr SemaphoreImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr SemaphoreImportFlags)) (SemaphoreImportFlags
flags)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr HANDLE)) (HANDLE
handle)
Ptr LPCWSTR -> LPCWSTR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr LPCWSTR)) (LPCWSTR
name)
IO b
f
cStructSize :: Int
cStructSize = 48
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct p :: "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct ImportSemaphoreWin32HandleInfoKHR where
peekCStruct :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ImportSemaphoreWin32HandleInfoKHR
peekCStruct p :: "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p = do
Semaphore
semaphore <- Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore))
SemaphoreImportFlags
flags <- Ptr SemaphoreImportFlags -> IO SemaphoreImportFlags
forall a. Storable a => Ptr a -> IO a
peek @SemaphoreImportFlags (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr SemaphoreImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr SemaphoreImportFlags))
ExternalSemaphoreHandleTypeFlagBits
handleType <- Ptr ExternalSemaphoreHandleTypeFlagBits
-> IO ExternalSemaphoreHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalSemaphoreHandleTypeFlagBits (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
HANDLE
handle <- ("pHandle" ::: Ptr HANDLE) -> IO HANDLE
forall a. Storable a => Ptr a -> IO a
peek @HANDLE (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr HANDLE))
LPCWSTR
name <- Ptr LPCWSTR -> IO LPCWSTR
forall a. Storable a => Ptr a -> IO a
peek @LPCWSTR (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr LPCWSTR))
ImportSemaphoreWin32HandleInfoKHR
-> IO ImportSemaphoreWin32HandleInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportSemaphoreWin32HandleInfoKHR
-> IO ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR
-> IO ImportSemaphoreWin32HandleInfoKHR
forall a b. (a -> b) -> a -> b
$ Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> HANDLE
-> LPCWSTR
-> ImportSemaphoreWin32HandleInfoKHR
ImportSemaphoreWin32HandleInfoKHR
Semaphore
semaphore SemaphoreImportFlags
flags ExternalSemaphoreHandleTypeFlagBits
handleType HANDLE
handle LPCWSTR
name
instance Storable ImportSemaphoreWin32HandleInfoKHR where
sizeOf :: ImportSemaphoreWin32HandleInfoKHR -> Int
sizeOf ~ImportSemaphoreWin32HandleInfoKHR
_ = 48
alignment :: ImportSemaphoreWin32HandleInfoKHR -> Int
alignment ~ImportSemaphoreWin32HandleInfoKHR
_ = 8
peek :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ImportSemaphoreWin32HandleInfoKHR
peek = ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ImportSemaphoreWin32HandleInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO ()
poke ptr :: "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
ptr poked :: ImportSemaphoreWin32HandleInfoKHR
poked = ("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
ptr ImportSemaphoreWin32HandleInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportSemaphoreWin32HandleInfoKHR where
zero :: ImportSemaphoreWin32HandleInfoKHR
zero = Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> HANDLE
-> LPCWSTR
-> ImportSemaphoreWin32HandleInfoKHR
ImportSemaphoreWin32HandleInfoKHR
Semaphore
forall a. Zero a => a
zero
SemaphoreImportFlags
forall a. Zero a => a
zero
ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero
HANDLE
forall a. Zero a => a
zero
LPCWSTR
forall a. Zero a => a
zero
data ExportSemaphoreWin32HandleInfoKHR = ExportSemaphoreWin32HandleInfoKHR
{
ExportSemaphoreWin32HandleInfoKHR -> Ptr SECURITY_ATTRIBUTES
attributes :: Ptr SECURITY_ATTRIBUTES
,
ExportSemaphoreWin32HandleInfoKHR -> DWORD
dwAccess :: DWORD
,
ExportSemaphoreWin32HandleInfoKHR -> LPCWSTR
name :: LPCWSTR
}
deriving (Typeable, ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool
(ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool)
-> (ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool)
-> Eq ExportSemaphoreWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool
$c/= :: ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool
== :: ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool
$c== :: ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExportSemaphoreWin32HandleInfoKHR)
#endif
deriving instance Show ExportSemaphoreWin32HandleInfoKHR
instance ToCStruct ExportSemaphoreWin32HandleInfoKHR where
withCStruct :: ExportSemaphoreWin32HandleInfoKHR
-> (Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b) -> IO b
withCStruct x :: ExportSemaphoreWin32HandleInfoKHR
x f :: Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b
f = Int
-> Int -> (Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b) -> IO b)
-> (Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ExportSemaphoreWin32HandleInfoKHR
p -> Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
p ExportSemaphoreWin32HandleInfoKHR
x (Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b
f Ptr ExportSemaphoreWin32HandleInfoKHR
p)
pokeCStruct :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr ExportSemaphoreWin32HandleInfoKHR
p ExportSemaphoreWin32HandleInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr (Ptr SECURITY_ATTRIBUTES) -> Ptr SECURITY_ATTRIBUTES -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR
-> Int -> Ptr (Ptr SECURITY_ATTRIBUTES)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr SECURITY_ATTRIBUTES))) (Ptr SECURITY_ATTRIBUTES
attributes)
Ptr DWORD -> DWORD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr DWORD)) (DWORD
dwAccess)
Ptr LPCWSTR -> LPCWSTR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr LPCWSTR)) (LPCWSTR
name)
IO b
f
cStructSize :: Int
cStructSize = 40
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr ExportSemaphoreWin32HandleInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr DWORD -> DWORD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr DWORD)) (DWORD
forall a. Zero a => a
zero)
Ptr LPCWSTR -> LPCWSTR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr LPCWSTR)) (LPCWSTR
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct ExportSemaphoreWin32HandleInfoKHR where
peekCStruct :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
peekCStruct p :: Ptr ExportSemaphoreWin32HandleInfoKHR
p = do
Ptr SECURITY_ATTRIBUTES
pAttributes <- Ptr (Ptr SECURITY_ATTRIBUTES) -> IO (Ptr SECURITY_ATTRIBUTES)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr SECURITY_ATTRIBUTES) ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR
-> Int -> Ptr (Ptr SECURITY_ATTRIBUTES)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr SECURITY_ATTRIBUTES)))
DWORD
dwAccess <- Ptr DWORD -> IO DWORD
forall a. Storable a => Ptr a -> IO a
peek @DWORD ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr DWORD))
LPCWSTR
name <- Ptr LPCWSTR -> IO LPCWSTR
forall a. Storable a => Ptr a -> IO a
peek @LPCWSTR ((Ptr ExportSemaphoreWin32HandleInfoKHR
p Ptr ExportSemaphoreWin32HandleInfoKHR -> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr LPCWSTR))
ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR)
-> ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
forall a b. (a -> b) -> a -> b
$ Ptr SECURITY_ATTRIBUTES
-> DWORD -> LPCWSTR -> ExportSemaphoreWin32HandleInfoKHR
ExportSemaphoreWin32HandleInfoKHR
Ptr SECURITY_ATTRIBUTES
pAttributes DWORD
dwAccess LPCWSTR
name
instance Storable ExportSemaphoreWin32HandleInfoKHR where
sizeOf :: ExportSemaphoreWin32HandleInfoKHR -> Int
sizeOf ~ExportSemaphoreWin32HandleInfoKHR
_ = 40
alignment :: ExportSemaphoreWin32HandleInfoKHR -> Int
alignment ~ExportSemaphoreWin32HandleInfoKHR
_ = 8
peek :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
peek = Ptr ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO ()
poke ptr :: Ptr ExportSemaphoreWin32HandleInfoKHR
ptr poked :: ExportSemaphoreWin32HandleInfoKHR
poked = Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
ptr ExportSemaphoreWin32HandleInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ExportSemaphoreWin32HandleInfoKHR where
zero :: ExportSemaphoreWin32HandleInfoKHR
zero = Ptr SECURITY_ATTRIBUTES
-> DWORD -> LPCWSTR -> ExportSemaphoreWin32HandleInfoKHR
ExportSemaphoreWin32HandleInfoKHR
Ptr SECURITY_ATTRIBUTES
forall a. Zero a => a
zero
DWORD
forall a. Zero a => a
zero
LPCWSTR
forall a. Zero a => a
zero
data D3D12FenceSubmitInfoKHR = D3D12FenceSubmitInfoKHR
{
D3D12FenceSubmitInfoKHR -> DWORD
waitSemaphoreValuesCount :: Word32
,
D3D12FenceSubmitInfoKHR -> Vector Word64
waitSemaphoreValues :: Vector Word64
,
D3D12FenceSubmitInfoKHR -> DWORD
signalSemaphoreValuesCount :: Word32
,
D3D12FenceSubmitInfoKHR -> Vector Word64
signalSemaphoreValues :: Vector Word64
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (D3D12FenceSubmitInfoKHR)
#endif
deriving instance Show D3D12FenceSubmitInfoKHR
instance ToCStruct D3D12FenceSubmitInfoKHR where
withCStruct :: D3D12FenceSubmitInfoKHR
-> (Ptr D3D12FenceSubmitInfoKHR -> IO b) -> IO b
withCStruct x :: D3D12FenceSubmitInfoKHR
x f :: Ptr D3D12FenceSubmitInfoKHR -> IO b
f = Int -> Int -> (Ptr D3D12FenceSubmitInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr D3D12FenceSubmitInfoKHR -> IO b) -> IO b)
-> (Ptr D3D12FenceSubmitInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr D3D12FenceSubmitInfoKHR
p -> Ptr D3D12FenceSubmitInfoKHR
-> D3D12FenceSubmitInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr D3D12FenceSubmitInfoKHR
p D3D12FenceSubmitInfoKHR
x (Ptr D3D12FenceSubmitInfoKHR -> IO b
f Ptr D3D12FenceSubmitInfoKHR
p)
pokeCStruct :: Ptr D3D12FenceSubmitInfoKHR
-> D3D12FenceSubmitInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr D3D12FenceSubmitInfoKHR
p D3D12FenceSubmitInfoKHR{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = Vector Word64 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Word64 -> Int) -> Vector Word64 -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Word64
waitSemaphoreValues)
DWORD
waitSemaphoreValuesCount'' <- IO DWORD -> ContT b IO DWORD
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO DWORD -> ContT b IO DWORD) -> IO DWORD -> ContT b IO DWORD
forall a b. (a -> b) -> a -> b
$ if (DWORD
waitSemaphoreValuesCount) DWORD -> DWORD -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then DWORD -> IO DWORD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD -> IO DWORD) -> DWORD -> IO DWORD
forall a b. (a -> b) -> a -> b
$ Int -> DWORD
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength
else do
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> DWORD
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength DWORD -> DWORD -> Bool
forall a. Eq a => a -> a -> Bool
== (DWORD
waitSemaphoreValuesCount) Bool -> Bool -> Bool
|| Int
pWaitSemaphoreValuesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (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 "" "pWaitSemaphoreValues must be empty or have 'waitSemaphoreValuesCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
DWORD -> IO DWORD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD
waitSemaphoreValuesCount)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DWORD -> DWORD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) (DWORD
waitSemaphoreValuesCount'')
Ptr Word64
pWaitSemaphoreValues'' <- if Vector Word64 -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector Word64
waitSemaphoreValues)
then Ptr Word64 -> ContT b IO (Ptr Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr Word64
forall a. Ptr a
nullPtr
else do
Ptr Word64
pPWaitSemaphoreValues <- ((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64))
-> ((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr Word64 -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 (((Vector Word64 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Word64
waitSemaphoreValues))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ (Int -> Word64 -> IO ()) -> Vector Word64 -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Word64
e -> Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word64
pPWaitSemaphoreValues Ptr Word64 -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) (Word64
e)) ((Vector Word64
waitSemaphoreValues))
Ptr Word64 -> ContT b IO (Ptr Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr Word64 -> ContT b IO (Ptr Word64))
-> Ptr Word64 -> ContT b IO (Ptr Word64)
forall a b. (a -> b) -> a -> b
$ Ptr Word64
pPWaitSemaphoreValues
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr Word64) -> Ptr Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr (Ptr Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Word64))) Ptr Word64
pWaitSemaphoreValues''
let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = Vector Word64 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Word64 -> Int) -> Vector Word64 -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Word64
signalSemaphoreValues)
DWORD
signalSemaphoreValuesCount'' <- IO DWORD -> ContT b IO DWORD
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO DWORD -> ContT b IO DWORD) -> IO DWORD -> ContT b IO DWORD
forall a b. (a -> b) -> a -> b
$ if (DWORD
signalSemaphoreValuesCount) DWORD -> DWORD -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then DWORD -> IO DWORD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD -> IO DWORD) -> DWORD -> IO DWORD
forall a b. (a -> b) -> a -> b
$ Int -> DWORD
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength
else do
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> DWORD
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength DWORD -> DWORD -> Bool
forall a. Eq a => a -> a -> Bool
== (DWORD
signalSemaphoreValuesCount) Bool -> Bool -> Bool
|| Int
pSignalSemaphoreValuesLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0) (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 "" "pSignalSemaphoreValues must be empty or have 'signalSemaphoreValuesCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
DWORD -> IO DWORD
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD
signalSemaphoreValuesCount)
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DWORD -> DWORD -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32)) (DWORD
signalSemaphoreValuesCount'')
Ptr Word64
pSignalSemaphoreValues'' <- if Vector Word64 -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector Word64
signalSemaphoreValues)
then Ptr Word64 -> ContT b IO (Ptr Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr Word64
forall a. Ptr a
nullPtr
else do
Ptr Word64
pPSignalSemaphoreValues <- ((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64))
-> ((Ptr Word64 -> IO b) -> IO b) -> ContT b IO (Ptr Word64)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr Word64 -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @Word64 (((Vector Word64 -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Word64
signalSemaphoreValues))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 8
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ (Int -> Word64 -> IO ()) -> Vector Word64 -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: Word64
e -> Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word64
pPSignalSemaphoreValues Ptr Word64 -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) (Word64
e)) ((Vector Word64
signalSemaphoreValues))
Ptr Word64 -> ContT b IO (Ptr Word64)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr Word64 -> ContT b IO (Ptr Word64))
-> Ptr Word64 -> ContT b IO (Ptr Word64)
forall a b. (a -> b) -> a -> b
$ Ptr Word64
pPSignalSemaphoreValues
IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr Word64) -> Ptr Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr (Ptr Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr Word64))) Ptr Word64
pSignalSemaphoreValues''
IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = 48
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr D3D12FenceSubmitInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr D3D12FenceSubmitInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
IO b
f
instance FromCStruct D3D12FenceSubmitInfoKHR where
peekCStruct :: Ptr D3D12FenceSubmitInfoKHR -> IO D3D12FenceSubmitInfoKHR
peekCStruct p :: Ptr D3D12FenceSubmitInfoKHR
p = do
DWORD
waitSemaphoreValuesCount <- Ptr DWORD -> IO DWORD
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
Ptr Word64
pWaitSemaphoreValues <- Ptr (Ptr Word64) -> IO (Ptr Word64)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr (Ptr Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr Word64)))
let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = if Ptr Word64
pWaitSemaphoreValues Ptr Word64 -> Ptr Word64 -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Word64
forall a. Ptr a
nullPtr then 0 else (DWORD -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral DWORD
waitSemaphoreValuesCount)
Vector Word64
pWaitSemaphoreValues' <- Int -> (Int -> IO Word64) -> IO (Vector Word64)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pWaitSemaphoreValuesLength (\i :: Int
i -> Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr Word64
pWaitSemaphoreValues Ptr Word64 -> Int -> Ptr Word64
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
DWORD
signalSemaphoreValuesCount <- Ptr DWORD -> IO DWORD
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr DWORD
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32))
Ptr Word64
pSignalSemaphoreValues <- Ptr (Ptr Word64) -> IO (Ptr Word64)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr D3D12FenceSubmitInfoKHR
p Ptr D3D12FenceSubmitInfoKHR -> Int -> Ptr (Ptr Word64)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr Word64)))
let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = if Ptr Word64
pSignalSemaphoreValues Ptr Word64 -> Ptr Word64 -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Word64
forall a. Ptr a
nullPtr then 0 else (DWORD -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral DWORD
signalSemaphoreValuesCount)
Vector Word64
pSignalSemaphoreValues' <- Int -> (Int -> IO Word64) -> IO (Vector Word64)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pSignalSemaphoreValuesLength (\i :: Int
i -> Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr Word64
pSignalSemaphoreValues Ptr Word64 -> Int -> Ptr Word64
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
D3D12FenceSubmitInfoKHR -> IO D3D12FenceSubmitInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (D3D12FenceSubmitInfoKHR -> IO D3D12FenceSubmitInfoKHR)
-> D3D12FenceSubmitInfoKHR -> IO D3D12FenceSubmitInfoKHR
forall a b. (a -> b) -> a -> b
$ DWORD
-> Vector Word64
-> DWORD
-> Vector Word64
-> D3D12FenceSubmitInfoKHR
D3D12FenceSubmitInfoKHR
DWORD
waitSemaphoreValuesCount Vector Word64
pWaitSemaphoreValues' DWORD
signalSemaphoreValuesCount Vector Word64
pSignalSemaphoreValues'
instance Zero D3D12FenceSubmitInfoKHR where
zero :: D3D12FenceSubmitInfoKHR
zero = DWORD
-> Vector Word64
-> DWORD
-> Vector Word64
-> D3D12FenceSubmitInfoKHR
D3D12FenceSubmitInfoKHR
DWORD
forall a. Zero a => a
zero
Vector Word64
forall a. Monoid a => a
mempty
DWORD
forall a. Zero a => a
zero
Vector Word64
forall a. Monoid a => a
mempty
data SemaphoreGetWin32HandleInfoKHR = SemaphoreGetWin32HandleInfoKHR
{
SemaphoreGetWin32HandleInfoKHR -> Semaphore
semaphore :: Semaphore
,
SemaphoreGetWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
}
deriving (Typeable, SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
(SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool)
-> (SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool)
-> Eq SemaphoreGetWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
$c/= :: SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
== :: SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
$c== :: SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreGetWin32HandleInfoKHR)
#endif
deriving instance Show SemaphoreGetWin32HandleInfoKHR
instance ToCStruct SemaphoreGetWin32HandleInfoKHR where
withCStruct :: SemaphoreGetWin32HandleInfoKHR
-> (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b)
-> IO b
withCStruct x :: SemaphoreGetWin32HandleInfoKHR
x f :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b
f = Int
-> Int
-> (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b)
-> IO b)
-> (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p -> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p SemaphoreGetWin32HandleInfoKHR
x (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b
f "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p)
pokeCStruct :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p SemaphoreGetWin32HandleInfoKHR{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
semaphore)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
IO b
f
cStructSize :: Int
cStructSize = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct p :: "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR)
("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct SemaphoreGetWin32HandleInfoKHR where
peekCStruct :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO SemaphoreGetWin32HandleInfoKHR
peekCStruct p :: "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p = do
Semaphore
semaphore <- Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Semaphore))
ExternalSemaphoreHandleTypeFlagBits
handleType <- Ptr ExternalSemaphoreHandleTypeFlagBits
-> IO ExternalSemaphoreHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalSemaphoreHandleTypeFlagBits (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
SemaphoreGetWin32HandleInfoKHR -> IO SemaphoreGetWin32HandleInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SemaphoreGetWin32HandleInfoKHR
-> IO SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR
-> IO SemaphoreGetWin32HandleInfoKHR
forall a b. (a -> b) -> a -> b
$ Semaphore
-> ExternalSemaphoreHandleTypeFlagBits
-> SemaphoreGetWin32HandleInfoKHR
SemaphoreGetWin32HandleInfoKHR
Semaphore
semaphore ExternalSemaphoreHandleTypeFlagBits
handleType
instance Storable SemaphoreGetWin32HandleInfoKHR where
sizeOf :: SemaphoreGetWin32HandleInfoKHR -> Int
sizeOf ~SemaphoreGetWin32HandleInfoKHR
_ = 32
alignment :: SemaphoreGetWin32HandleInfoKHR -> Int
alignment ~SemaphoreGetWin32HandleInfoKHR
_ = 8
peek :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO SemaphoreGetWin32HandleInfoKHR
peek = ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO SemaphoreGetWin32HandleInfoKHR
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO ()
poke ptr :: "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
ptr poked :: SemaphoreGetWin32HandleInfoKHR
poked = ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
ptr SemaphoreGetWin32HandleInfoKHR
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero SemaphoreGetWin32HandleInfoKHR where
zero :: SemaphoreGetWin32HandleInfoKHR
zero = Semaphore
-> ExternalSemaphoreHandleTypeFlagBits
-> SemaphoreGetWin32HandleInfoKHR
SemaphoreGetWin32HandleInfoKHR
Semaphore
forall a. Zero a => a
zero
ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero
type KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION = 1
pattern KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION :: a
$mKHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION = 1
type KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME = "VK_KHR_external_semaphore_win32"
pattern KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME :: a
$mKHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME = "VK_KHR_external_semaphore_win32"