{-# 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 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

-- | vkGetSemaphoreWin32HandleKHR - Get a Windows HANDLE for a semaphore
--
-- = Description
--
-- For handle types defined as NT handles, the handles returned by
-- 'getSemaphoreWin32HandleKHR' are owned by the application. To avoid
-- leaking resources, the application /must/ release ownership of them
-- using the @CloseHandle@ system call when they are no longer needed.
--
-- Exporting a Windows handle from a semaphore /may/ have side effects
-- depending on the transference of the specified handle type, as described
-- in
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_TOO_MANY_OBJECTS'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'SemaphoreGetWin32HandleInfoKHR'
getSemaphoreWin32HandleKHR :: forall io
                            . (MonadIO io)
                           => -- | @device@ is the logical device that created the semaphore being
                              -- exported.
                              --
                              -- @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                              Device
                           -> -- | @pGetWin32HandleInfo@ is a pointer to a 'SemaphoreGetWin32HandleInfoKHR'
                              -- structure containing parameters of the export operation.
                              --
                              -- @pGetWin32HandleInfo@ /must/ be a valid pointer to a valid
                              -- 'SemaphoreGetWin32HandleInfoKHR' structure
                              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
$ 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

-- | vkImportSemaphoreWin32HandleKHR - Import a semaphore from a Windows
-- HANDLE
--
-- = Description
--
-- Importing a semaphore payload from Windows handles does not transfer
-- ownership of the handle to the Vulkan implementation. For handle types
-- defined as NT handles, the application /must/ release ownership using
-- the @CloseHandle@ system call when the handle is no longer needed.
--
-- Applications /can/ import the same semaphore payload into multiple
-- instances of Vulkan, into the same instance from which it was exported,
-- and multiple times into a given Vulkan instance.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INVALID_EXTERNAL_HANDLE'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Device', 'ImportSemaphoreWin32HandleInfoKHR'
importSemaphoreWin32HandleKHR :: forall io
                               . (MonadIO io)
                              => -- | @device@ is the logical device that created the semaphore.
                                 --
                                 -- @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                                 Device
                              -> -- | @pImportSemaphoreWin32HandleInfo@ is a pointer to a
                                 -- 'ImportSemaphoreWin32HandleInfoKHR' structure specifying the semaphore
                                 -- and import parameters.
                                 --
                                 -- @pImportSemaphoreWin32HandleInfo@ /must/ be a valid pointer to a valid
                                 -- 'ImportSemaphoreWin32HandleInfoKHR' structure
                                 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
$ 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))


-- | VkImportSemaphoreWin32HandleInfoKHR - Structure specifying Windows
-- handle to import to a semaphore
--
-- = Description
--
-- The handle types supported by @handleType@ are:
--
-- +---------------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
-- | Handle Type                                                                                                   | Transference         | Permanence Supported  |
-- +===============================================================================================================+======================+=======================+
-- | 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'     | Reference            | Temporary,Permanent   |
-- +---------------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
-- | 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT' | Reference            | Temporary,Permanent   |
-- +---------------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
-- | 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT'      | Reference            | Temporary,Permanent   |
-- +---------------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
--
-- Handle Types Supported by 'ImportSemaphoreWin32HandleInfoKHR'
--
-- == Valid Usage
--
-- -   @handleType@ /must/ be a value included in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphore-handletypes-win32 Handle Types Supported by >
--     table
--
-- -   If @handleType@ is not
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--     or
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT',
--     @name@ /must/ be @NULL@
--
-- -   If @handleType@ is not @0@ and @handle@ is @NULL@, @name@ /must/
--     name a valid synchronization primitive of the type specified by
--     @handleType@
--
-- -   If @handleType@ is not @0@ and @name@ is @NULL@, @handle@ /must/ be
--     a valid handle of the type specified by @handleType@
--
-- -   If @handle@ is not @NULL@, @name@ /must/ be @NULL@
--
-- -   If @handle@ is not @NULL@, it /must/ obey any requirements listed
--     for @handleType@ in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility external semaphore handle types compatibility>
--
-- -   If @name@ is not @NULL@, it /must/ obey any requirements listed for
--     @handleType@ in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility external semaphore handle types compatibility>
--
-- -   If @handleType@ is
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--     or
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT',
--     the 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo'::@flags@
--     field /must/ match that of the semaphore from which @handle@ or
--     @name@ was exported
--
-- -   If @handleType@ is
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--     or
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT',
--     the
--     'Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore.SemaphoreTypeCreateInfo'::@semaphoreType@
--     field /must/ match that of the semaphore from which @handle@ or
--     @name@ was exported
--
-- -   If @flags@ contains
--     'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SEMAPHORE_IMPORT_TEMPORARY_BIT',
--     the
--     'Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore.SemaphoreTypeCreateInfo'::@semaphoreType@
--     field of the semaphore from which @handle@ or @name@ was exported
--     /must/ not be
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
-- -   @pNext@ /must/ be @NULL@
--
-- -   @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   @flags@ /must/ be a valid combination of
--     'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlagBits'
--     values
--
-- -   If @handleType@ is not @0@, @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
--     value
--
-- == Host Synchronization
--
-- -   Host access to @semaphore@ /must/ be externally synchronized
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'importSemaphoreWin32HandleKHR'
data ImportSemaphoreWin32HandleInfoKHR = ImportSemaphoreWin32HandleInfoKHR
  { -- | @semaphore@ is the semaphore into which the payload will be imported.
    ImportSemaphoreWin32HandleInfoKHR -> Semaphore
semaphore :: Semaphore
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlagBits'
    -- specifying additional parameters for the semaphore payload import
    -- operation.
    ImportSemaphoreWin32HandleInfoKHR -> SemaphoreImportFlags
flags :: SemaphoreImportFlags
  , -- | @handleType@ specifies the type of @handle@.
    ImportSemaphoreWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
  , -- | @handle@ is the external handle to import, or @NULL@.
    ImportSemaphoreWin32HandleInfoKHR -> HANDLE
handle :: HANDLE
  , -- | @name@ is a null-terminated UTF-16 string naming the underlying
    -- synchronization primitive to import, or @NULL@.
    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


-- | VkExportSemaphoreWin32HandleInfoKHR - Structure specifying additional
-- attributes of Windows handles exported from a semaphore
--
-- = Description
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'
-- is not present in the same @pNext@ chain, this structure is ignored.
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'
-- is present in the @pNext@ chain of
-- 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo' with a Windows
-- @handleType@, but either 'ExportSemaphoreWin32HandleInfoKHR' is not
-- present in the @pNext@ chain, or if it is but @pAttributes@ is set to
-- @NULL@, default security descriptor values will be used, and child
-- processes created by the application will not inherit the handle, as
-- described in the MSDN documentation for “Synchronization Object Security
-- and Access Rights”1. Further, if the structure is not present, the
-- access rights used depend on the handle type.
--
-- For handles of the following types:
--
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--
-- The implementation /must/ ensure the access rights allow both signal and
-- wait operations on the semaphore.
--
-- For handles of the following types:
--
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT'
--
-- The access rights /must/ be:
--
-- @GENERIC_ALL@
--
-- [1]
--     <https://docs.microsoft.com/en-us/windows/win32/sync/synchronization-object-security-and-access-rights>
--
-- == Valid Usage
--
-- -   If
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'::@handleTypes@
--     does not include
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--     or
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT',
--     'ExportSemaphoreWin32HandleInfoKHR' /must/ not be included in the
--     @pNext@ chain of 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo'
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
-- -   If @pAttributes@ is not @NULL@, @pAttributes@ /must/ be a valid
--     pointer to a valid
--     'Vulkan.Extensions.VK_NV_external_memory_win32.SECURITY_ATTRIBUTES'
--     value
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ExportSemaphoreWin32HandleInfoKHR = ExportSemaphoreWin32HandleInfoKHR
  { -- | @pAttributes@ is a pointer to a Windows
    -- 'Vulkan.Extensions.VK_NV_external_memory_win32.SECURITY_ATTRIBUTES'
    -- structure specifying security attributes of the handle.
    ExportSemaphoreWin32HandleInfoKHR -> Ptr SECURITY_ATTRIBUTES
attributes :: Ptr SECURITY_ATTRIBUTES
  , -- | @dwAccess@ is a 'Vulkan.Extensions.VK_NV_external_memory_win32.DWORD'
    -- specifying access rights of the handle.
    ExportSemaphoreWin32HandleInfoKHR -> DWORD
dwAccess :: DWORD
  , -- | @name@ is a null-terminated UTF-16 string to associate with the
    -- underlying synchronization primitive referenced by NT handles exported
    -- from the created semaphore.
    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


-- | VkD3D12FenceSubmitInfoKHR - Structure specifying values for Direct3D 12
-- fence-backed semaphores
--
-- = Description
--
-- If the semaphore in 'Vulkan.Core10.Queue.SubmitInfo'::@pWaitSemaphores@
-- or 'Vulkan.Core10.Queue.SubmitInfo'::@pSignalSemaphores@ corresponding
-- to an entry in @pWaitSemaphoreValues@ or @pSignalSemaphoreValues@
-- respectively does not currently have a
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-payloads payload>
-- referring to a Direct3D 12 fence, the implementation /must/ ignore the
-- value in the @pWaitSemaphoreValues@ or @pSignalSemaphoreValues@ entry.
--
-- Note
--
-- As the introduction of the external semaphore handle type
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT'
-- predates that of timeline semaphores, support for importing semaphore
-- payloads from external handles of that type into semaphores created
-- (implicitly or explicitly) with a
-- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
-- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_BINARY' is preserved
-- for backwards compatibility. However, applications /should/ prefer
-- importing such handle types into semaphores created with a
-- 'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
-- 'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE', and use the
-- 'Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore.TimelineSemaphoreSubmitInfo'
-- structure instead of the 'D3D12FenceSubmitInfoKHR' structure to specify
-- the values to use when waiting for and signaling such semaphores.
--
-- == Valid Usage
--
-- -   @waitSemaphoreValuesCount@ /must/ be the same value as
--     'Vulkan.Core10.Queue.SubmitInfo'::@waitSemaphoreCount@, where
--     'Vulkan.Core10.Queue.SubmitInfo' is in the @pNext@ chain of this
--     'D3D12FenceSubmitInfoKHR' structure
--
-- -   @signalSemaphoreValuesCount@ /must/ be the same value as
--     'Vulkan.Core10.Queue.SubmitInfo'::@signalSemaphoreCount@, where
--     'Vulkan.Core10.Queue.SubmitInfo' is in the @pNext@ chain of this
--     'D3D12FenceSubmitInfoKHR' structure
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR'
--
-- -   If @waitSemaphoreValuesCount@ is not @0@, and @pWaitSemaphoreValues@
--     is not @NULL@, @pWaitSemaphoreValues@ /must/ be a valid pointer to
--     an array of @waitSemaphoreValuesCount@ @uint64_t@ values
--
-- -   If @signalSemaphoreValuesCount@ is not @0@, and
--     @pSignalSemaphoreValues@ is not @NULL@, @pSignalSemaphoreValues@
--     /must/ be a valid pointer to an array of
--     @signalSemaphoreValuesCount@ @uint64_t@ values
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data D3D12FenceSubmitInfoKHR = D3D12FenceSubmitInfoKHR
  { -- | @waitSemaphoreValuesCount@ is the number of semaphore wait values
    -- specified in @pWaitSemaphoreValues@.
    D3D12FenceSubmitInfoKHR -> DWORD
waitSemaphoreValuesCount :: Word32
  , -- | @pWaitSemaphoreValues@ is a pointer to an array of
    -- @waitSemaphoreValuesCount@ values for the corresponding semaphores in
    -- 'Vulkan.Core10.Queue.SubmitInfo'::@pWaitSemaphores@ to wait for.
    D3D12FenceSubmitInfoKHR -> Vector Word64
waitSemaphoreValues :: Vector Word64
  , -- | @signalSemaphoreValuesCount@ is the number of semaphore signal values
    -- specified in @pSignalSemaphoreValues@.
    D3D12FenceSubmitInfoKHR -> DWORD
signalSemaphoreValuesCount :: Word32
  , -- | @pSignalSemaphoreValues@ is a pointer to an array of
    -- @signalSemaphoreValuesCount@ values for the corresponding semaphores in
    -- 'Vulkan.Core10.Queue.SubmitInfo'::@pSignalSemaphores@ to set when
    -- signaled.
    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


-- | VkSemaphoreGetWin32HandleInfoKHR - Structure describing a Win32 handle
-- semaphore export operation
--
-- = Description
--
-- The properties of the handle returned depend on the value of
-- @handleType@. See
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
-- for a description of the properties of the defined external semaphore
-- handle types.
--
-- == Valid Usage
--
-- -   @handleType@ /must/ have been included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'::@handleTypes@
--     when the @semaphore@’s current payload was created
--
-- -   If @handleType@ is defined as an NT handle,
--     'getSemaphoreWin32HandleKHR' /must/ be called no more than once for
--     each valid unique combination of @semaphore@ and @handleType@
--
-- -   @semaphore@ /must/ not currently have its payload replaced by an
--     imported payload as described below in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>
--     unless that imported payload’s handle type was included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore_capabilities.ExternalSemaphoreProperties'::@exportFromImportedHandleTypes@
--     for @handleType@
--
-- -   If @handleType@ refers to a handle type with copy payload
--     transference semantics, as defined below in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>,
--     there /must/ be no queue waiting on @semaphore@
--
-- -   If @handleType@ refers to a handle type with copy payload
--     transference semantics, @semaphore@ /must/ be signaled, or have an
--     associated
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-signaling semaphore signal operation>
--     pending execution
--
-- -   @handleType@ /must/ be defined as an NT handle or a global share
--     handle
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR'
--
-- -   @pNext@ /must/ be @NULL@
--
-- -   @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getSemaphoreWin32HandleKHR'
data SemaphoreGetWin32HandleInfoKHR = SemaphoreGetWin32HandleInfoKHR
  { -- | @semaphore@ is the semaphore from which state will be exported.
    SemaphoreGetWin32HandleInfoKHR -> Semaphore
semaphore :: Semaphore
  , -- | @handleType@ is the type of handle requested.
    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

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION"
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"

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME"
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"