{-# language CPP #-}
-- | = Name
--
-- VK_KHR_external_semaphore_win32 - device extension
--
-- == VK_KHR_external_semaphore_win32
--
-- [__Name String__]
--     @VK_KHR_external_semaphore_win32@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     79
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore VK_KHR_external_semaphore>
--
-- [__Contact__]
--
--     -   James Jones
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_KHR_external_semaphore_win32] @cubanismo%0A*Here describe the issue or question you have about the VK_KHR_external_semaphore_win32 extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2016-10-21
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   James Jones, NVIDIA
--
--     -   Jeff Juliano, NVIDIA
--
--     -   Carsten Rohde, NVIDIA
--
-- == Description
--
-- An application using external memory may wish to synchronize access to
-- that memory using semaphores. This extension enables an application to
-- export semaphore payload to and import semaphore payload from Windows
-- handles.
--
-- == New Commands
--
-- -   'getSemaphoreWin32HandleKHR'
--
-- -   'importSemaphoreWin32HandleKHR'
--
-- == New Structures
--
-- -   'ImportSemaphoreWin32HandleInfoKHR'
--
-- -   'SemaphoreGetWin32HandleInfoKHR'
--
-- -   Extending 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo':
--
--     -   'ExportSemaphoreWin32HandleInfoKHR'
--
-- -   Extending 'Vulkan.Core10.Queue.SubmitInfo':
--
--     -   'D3D12FenceSubmitInfoKHR'
--
-- == New Enum Constants
--
-- -   'KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME'
--
-- -   'KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR'
--
-- == Issues
--
-- 1) Do applications need to call @CloseHandle@() on the values returned
-- from 'getSemaphoreWin32HandleKHR' when @handleType@ is
-- 'Vulkan.Extensions.VK_KHR_external_semaphore_capabilities.EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR'?
--
-- __RESOLVED__: Yes, unless it is passed back in to another driver
-- instance to import the object. A successful get call transfers ownership
-- of the handle to the application. Destroying the semaphore object will
-- not destroy the handle or the handle’s reference to the underlying
-- semaphore resource.
--
-- 2) Should the language regarding KMT\/Windows 7 handles be moved to a
-- separate extension so that it can be deprecated over time?
--
-- __RESOLVED__: No. Support for them can be deprecated by drivers if they
-- choose, by no longer returning them in the supported handle types of the
-- instance level queries.
--
-- 3) Should applications be allowed to specify additional object
-- attributes for shared handles?
--
-- __RESOLVED__: Yes. Applications will be allowed to provide similar
-- attributes to those they would to any other handle creation API.
--
-- 4) How do applications communicate the desired fence values to use with
-- @D3D12_FENCE@-based Vulkan semaphores?
--
-- __RESOLVED__: There are a couple of options. The values for the signaled
-- and reset states could be communicated up front when creating the object
-- and remain static for the life of the Vulkan semaphore, or they could be
-- specified using auxiliary structures when submitting semaphore signal
-- and wait operations, similar to what is done with the keyed mutex
-- extensions. The latter is more flexible and consistent with the keyed
-- mutex usage, but the former is a much simpler API.
--
-- Since Vulkan tends to favor flexibility and consistency over simplicity,
-- a new structure specifying D3D12 fence acquire and release values is
-- added to the 'Vulkan.Core10.Queue.queueSubmit' function.
--
-- == Version History
--
-- -   Revision 1, 2016-10-21 (James Jones)
--
--     -   Initial revision
--
-- == See Also
--
-- 'D3D12FenceSubmitInfoKHR', 'ExportSemaphoreWin32HandleInfoKHR',
-- 'ImportSemaphoreWin32HandleInfoKHR', 'SemaphoreGetWin32HandleInfoKHR',
-- 'getSemaphoreWin32HandleKHR', 'importSemaphoreWin32HandleKHR'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
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 (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import 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 Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.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.Core10.Handles (Device(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.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.Exception (VulkanException(..))
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://registry.khronos.org/vulkan/specs/1.3-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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- 'Vulkan.Core10.Handles.Device', 'SemaphoreGetWin32HandleInfoKHR'
getSemaphoreWin32HandleKHR :: forall io
                            . (MonadIO io)
                           => -- | @device@ is the logical device that created the semaphore being
                              -- exported.
                              --
                              -- #VUID-vkGetSemaphoreWin32HandleKHR-device-parameter# @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.
                              --
                              -- #VUID-vkGetSemaphoreWin32HandleKHR-pGetWin32HandleInfo-parameter#
                              -- @pGetWin32HandleInfo@ /must/ be a valid pointer to a valid
                              -- 'SemaphoreGetWin32HandleInfoKHR' structure
                              SemaphoreGetWin32HandleInfoKHR
                           -> io (HANDLE)
getSemaphoreWin32HandleKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> SemaphoreGetWin32HandleInfoKHR -> io HANDLE
getSemaphoreWin32HandleKHR Device
device SemaphoreGetWin32HandleInfoKHR
getWin32HandleInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let 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 (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
vkGetSemaphoreWin32HandleKHRPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetSemaphoreWin32HandleKHR is null" forall a. Maybe a
Nothing 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 <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SemaphoreGetWin32HandleInfoKHR
getWin32HandleInfo)
  "pHandle" ::: Ptr HANDLE
pPHandle <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @HANDLE Int
8) forall a. Ptr a -> IO ()
free
  Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"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))
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  HANDLE
pHandle <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek @HANDLE "pHandle" ::: Ptr HANDLE
pPHandle
  forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- 'Vulkan.Core10.Handles.Device', 'ImportSemaphoreWin32HandleInfoKHR'
importSemaphoreWin32HandleKHR :: forall io
                               . (MonadIO io)
                              => -- | @device@ is the logical device that created the semaphore.
                                 --
                                 -- #VUID-vkImportSemaphoreWin32HandleKHR-device-parameter# @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.
                                 --
                                 -- #VUID-vkImportSemaphoreWin32HandleKHR-pImportSemaphoreWin32HandleInfo-parameter#
                                 -- @pImportSemaphoreWin32HandleInfo@ /must/ be a valid pointer to a valid
                                 -- 'ImportSemaphoreWin32HandleInfoKHR' structure
                                 ImportSemaphoreWin32HandleInfoKHR
                              -> io ()
importSemaphoreWin32HandleKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> ImportSemaphoreWin32HandleInfoKHR -> io ()
importSemaphoreWin32HandleKHR Device
device
                                ImportSemaphoreWin32HandleInfoKHR
importSemaphoreWin32HandleInfo = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkImportSemaphoreWin32HandleKHRPtr :: FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreWin32HandleInfo"
       ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
   -> IO Result)
vkImportSemaphoreWin32HandleKHRPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pImportSemaphoreWin32HandleInfo"
          ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
      -> IO Result)
pVkImportSemaphoreWin32HandleKHR (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreWin32HandleInfo"
       ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
   -> IO Result)
vkImportSemaphoreWin32HandleKHRPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkImportSemaphoreWin32HandleKHR is null" forall a. Maybe a
Nothing 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 <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImportSemaphoreWin32HandleInfoKHR
importSemaphoreWin32HandleInfo)
  Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkImportSemaphoreWin32HandleKHR" (Ptr Device_T
-> ("pImportSemaphoreWin32HandleInfo"
    ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO Result
vkImportSemaphoreWin32HandleKHR'
                                                                    (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                                    "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
pImportSemaphoreWin32HandleInfo)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))


-- | 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
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01140#
--     @handleType@ /must/ be a value included in the
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-semaphore-handletypes-win32 Handle Types Supported by >
--     table
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01466# 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@
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01467# If
--     @handle@ is @NULL@, @name@ /must/ name a valid synchronization
--     primitive of the type specified by @handleType@
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01468# If
--     @name@ is @NULL@, @handle@ /must/ be a valid handle of the type
--     specified by @handleType@
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handle-01469# If @handle@
--     is not @NULL@, @name@ /must/ be @NULL@
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handle-01542# If @handle@
--     is not @NULL@, it /must/ obey any requirements listed for
--     @handleType@ in
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility external semaphore handle types compatibility>
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-name-01543# If @name@ is
--     not @NULL@, it /must/ obey any requirements listed for @handleType@
--     in
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility external semaphore handle types compatibility>
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-03261# 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
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-03262# 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
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-flags-03322# 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)
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-pNext-pNext# @pNext@
--     /must/ be @NULL@
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-semaphore-parameter#
--     @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   #VUID-VkImportSemaphoreWin32HandleInfoKHR-flags-parameter# @flags@
--     /must/ be a valid combination of
--     'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlagBits'
--     values
--
-- == Host Synchronization
--
-- -   Host access to @semaphore@ /must/ be externally synchronized
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- '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@ is a
    -- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
    -- value specifying the type of @handle@.
    ImportSemaphoreWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
  , -- | @handle@ is @NULL@ or the external handle to import.
    ImportSemaphoreWin32HandleInfoKHR -> HANDLE
handle :: HANDLE
  , -- | @name@ is @NULL@ or a null-terminated UTF-16 string naming the
    -- underlying synchronization primitive to import.
    ImportSemaphoreWin32HandleInfoKHR -> LPCWSTR
name :: LPCWSTR
  }
  deriving (Typeable, ImportSemaphoreWin32HandleInfoKHR
-> ImportSemaphoreWin32HandleInfoKHR -> Bool
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 :: forall b.
ImportSemaphoreWin32HandleInfoKHR
-> (("pImportSemaphoreWin32HandleInfo"
     ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
    -> IO b)
-> IO b
withCStruct ImportSemaphoreWin32HandleInfoKHR
x ("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 forall a b. (a -> b) -> a -> b
$ \"pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p -> 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 :: forall b.
("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p ImportSemaphoreWin32HandleInfoKHR{HANDLE
LPCWSTR
Semaphore
SemaphoreImportFlags
ExternalSemaphoreHandleTypeFlagBits
name :: LPCWSTR
handle :: HANDLE
handleType :: ExternalSemaphoreHandleTypeFlagBits
flags :: SemaphoreImportFlags
semaphore :: Semaphore
$sel:name:ImportSemaphoreWin32HandleInfoKHR :: ImportSemaphoreWin32HandleInfoKHR -> LPCWSTR
$sel:handle:ImportSemaphoreWin32HandleInfoKHR :: ImportSemaphoreWin32HandleInfoKHR -> HANDLE
$sel:handleType:ImportSemaphoreWin32HandleInfoKHR :: ImportSemaphoreWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
$sel:flags:ImportSemaphoreWin32HandleInfoKHR :: ImportSemaphoreWin32HandleInfoKHR -> SemaphoreImportFlags
$sel:semaphore:ImportSemaphoreWin32HandleInfoKHR :: ImportSemaphoreWin32HandleInfoKHR -> Semaphore
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SemaphoreImportFlags)) (SemaphoreImportFlags
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr HANDLE)) (HANDLE
handle)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr LPCWSTR)) (LPCWSTR
name)
    IO b
f
  cStructSize :: Int
cStructSize = Int
48
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImportSemaphoreWin32HandleInfoKHR where
  peekCStruct :: ("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ImportSemaphoreWin32HandleInfoKHR
peekCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p = do
    Semaphore
semaphore <- forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore))
    SemaphoreImportFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @SemaphoreImportFlags (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SemaphoreImportFlags))
    ExternalSemaphoreHandleTypeFlagBits
handleType <- forall a. Storable a => Ptr a -> IO a
peek @ExternalSemaphoreHandleTypeFlagBits (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
    HANDLE
handle <- forall a. Storable a => Ptr a -> IO a
peek @HANDLE (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr HANDLE))
    LPCWSTR
name <- forall a. Storable a => Ptr a -> IO a
peek @LPCWSTR (("pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr LPCWSTR))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
_ = Int
48
  alignment :: ImportSemaphoreWin32HandleInfoKHR -> Int
alignment ~ImportSemaphoreWin32HandleInfoKHR
_ = Int
8
  peek :: ("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> IO ImportSemaphoreWin32HandleInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pImportSemaphoreWin32HandleInfo"
 ::: Ptr ImportSemaphoreWin32HandleInfoKHR)
-> ImportSemaphoreWin32HandleInfoKHR -> IO ()
poke "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
ptr ImportSemaphoreWin32HandleInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportSemaphoreWin32HandleInfo"
::: Ptr ImportSemaphoreWin32HandleInfoKHR
ptr ImportSemaphoreWin32HandleInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero ImportSemaphoreWin32HandleInfoKHR where
  zero :: ImportSemaphoreWin32HandleInfoKHR
zero = Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> HANDLE
-> LPCWSTR
-> ImportSemaphoreWin32HandleInfoKHR
ImportSemaphoreWin32HandleInfoKHR
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           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 included in the same @pNext@ chain, this structure is ignored.
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'
-- is included in the @pNext@ chain of
-- 'Vulkan.Core10.QueueSemaphore.SemaphoreCreateInfo' with a Windows
-- @handleType@, but either 'ExportSemaphoreWin32HandleInfoKHR' is not
-- included in the @pNext@ chain, or it is included 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
--
-- -   #VUID-VkExportSemaphoreWin32HandleInfoKHR-handleTypes-01125# 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)
--
-- -   #VUID-VkExportSemaphoreWin32HandleInfoKHR-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkExportSemaphoreWin32HandleInfoKHR-pAttributes-parameter# 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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- '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
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 :: forall b.
ExportSemaphoreWin32HandleInfoKHR
-> (Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b) -> IO b
withCStruct ExportSemaphoreWin32HandleInfoKHR
x Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \Ptr ExportSemaphoreWin32HandleInfoKHR
p -> 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 :: forall b.
Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
p ExportSemaphoreWin32HandleInfoKHR{DWORD
LPCWSTR
Ptr SECURITY_ATTRIBUTES
name :: LPCWSTR
dwAccess :: DWORD
attributes :: Ptr SECURITY_ATTRIBUTES
$sel:name:ExportSemaphoreWin32HandleInfoKHR :: ExportSemaphoreWin32HandleInfoKHR -> LPCWSTR
$sel:dwAccess:ExportSemaphoreWin32HandleInfoKHR :: ExportSemaphoreWin32HandleInfoKHR -> DWORD
$sel:attributes:ExportSemaphoreWin32HandleInfoKHR :: ExportSemaphoreWin32HandleInfoKHR -> Ptr SECURITY_ATTRIBUTES
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr SECURITY_ATTRIBUTES))) (Ptr SECURITY_ATTRIBUTES
attributes)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DWORD)) (DWORD
dwAccess)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr LPCWSTR)) (LPCWSTR
name)
    IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ExportSemaphoreWin32HandleInfoKHR -> IO b -> IO b
pokeZeroCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DWORD)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr LPCWSTR)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExportSemaphoreWin32HandleInfoKHR where
  peekCStruct :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
peekCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
p = do
    Ptr SECURITY_ATTRIBUTES
pAttributes <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr SECURITY_ATTRIBUTES) ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr SECURITY_ATTRIBUTES)))
    DWORD
dwAccess <- forall a. Storable a => Ptr a -> IO a
peek @DWORD ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr DWORD))
    LPCWSTR
name <- forall a. Storable a => Ptr a -> IO a
peek @LPCWSTR ((Ptr ExportSemaphoreWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr LPCWSTR))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
_ = Int
40
  alignment :: ExportSemaphoreWin32HandleInfoKHR -> Int
alignment ~ExportSemaphoreWin32HandleInfoKHR
_ = Int
8
  peek :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> IO ExportSemaphoreWin32HandleInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr ExportSemaphoreWin32HandleInfoKHR
-> ExportSemaphoreWin32HandleInfoKHR -> IO ()
poke Ptr ExportSemaphoreWin32HandleInfoKHR
ptr ExportSemaphoreWin32HandleInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportSemaphoreWin32HandleInfoKHR
ptr ExportSemaphoreWin32HandleInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero ExportSemaphoreWin32HandleInfoKHR where
  zero :: ExportSemaphoreWin32HandleInfoKHR
zero = Ptr SECURITY_ATTRIBUTES
-> DWORD -> LPCWSTR -> ExportSemaphoreWin32HandleInfoKHR
ExportSemaphoreWin32HandleInfoKHR
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           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://registry.khronos.org/vulkan/specs/1.3-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
--
-- -   #VUID-VkD3D12FenceSubmitInfoKHR-waitSemaphoreValuesCount-00079#
--     @waitSemaphoreValuesCount@ /must/ be the same value as
--     'Vulkan.Core10.Queue.SubmitInfo'::@waitSemaphoreCount@, where this
--     structure is in the @pNext@ chain of a
--     'Vulkan.Core10.Queue.SubmitInfo' structure
--
-- -   #VUID-VkD3D12FenceSubmitInfoKHR-signalSemaphoreValuesCount-00080#
--     @signalSemaphoreValuesCount@ /must/ be the same value as
--     'Vulkan.Core10.Queue.SubmitInfo'::@signalSemaphoreCount@, where this
--     structure is in the @pNext@ chain of a
--     'Vulkan.Core10.Queue.SubmitInfo' structure
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkD3D12FenceSubmitInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR'
--
-- -   #VUID-VkD3D12FenceSubmitInfoKHR-pWaitSemaphoreValues-parameter# If
--     @waitSemaphoreValuesCount@ is not @0@, and @pWaitSemaphoreValues@ is
--     not @NULL@, @pWaitSemaphoreValues@ /must/ be a valid pointer to an
--     array of @waitSemaphoreValuesCount@ @uint64_t@ values
--
-- -   #VUID-VkD3D12FenceSubmitInfoKHR-pSignalSemaphoreValues-parameter# 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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- '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 :: forall b.
D3D12FenceSubmitInfoKHR
-> (Ptr D3D12FenceSubmitInfoKHR -> IO b) -> IO b
withCStruct D3D12FenceSubmitInfoKHR
x Ptr D3D12FenceSubmitInfoKHR -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 forall a b. (a -> b) -> a -> b
$ \Ptr D3D12FenceSubmitInfoKHR
p -> 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 :: forall b.
Ptr D3D12FenceSubmitInfoKHR
-> D3D12FenceSubmitInfoKHR -> IO b -> IO b
pokeCStruct Ptr D3D12FenceSubmitInfoKHR
p D3D12FenceSubmitInfoKHR{DWORD
Vector Word64
signalSemaphoreValues :: Vector Word64
signalSemaphoreValuesCount :: DWORD
waitSemaphoreValues :: Vector Word64
waitSemaphoreValuesCount :: DWORD
$sel:signalSemaphoreValues:D3D12FenceSubmitInfoKHR :: D3D12FenceSubmitInfoKHR -> Vector Word64
$sel:signalSemaphoreValuesCount:D3D12FenceSubmitInfoKHR :: D3D12FenceSubmitInfoKHR -> DWORD
$sel:waitSemaphoreValues:D3D12FenceSubmitInfoKHR :: D3D12FenceSubmitInfoKHR -> Vector Word64
$sel:waitSemaphoreValuesCount:D3D12FenceSubmitInfoKHR :: D3D12FenceSubmitInfoKHR -> DWORD
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Word64
waitSemaphoreValues)
    DWORD
waitSemaphoreValuesCount'' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ if (DWORD
waitSemaphoreValuesCount) forall a. Eq a => a -> a -> Bool
== DWORD
0
      then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength
      else do
        forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pWaitSemaphoreValuesLength forall a. Eq a => a -> a -> Bool
== (DWORD
waitSemaphoreValuesCount) Bool -> Bool -> Bool
|| Int
pWaitSemaphoreValuesLength forall a. Eq a => a -> a -> Bool
== Int
0) forall a b. (a -> b) -> a -> b
$
          forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pWaitSemaphoreValues must be empty or have 'waitSemaphoreValuesCount' elements" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
        forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD
waitSemaphoreValuesCount)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (DWORD
waitSemaphoreValuesCount'')
    Ptr Word64
pWaitSemaphoreValues'' <- if forall a. Vector a -> Bool
Data.Vector.null (Vector Word64
waitSemaphoreValues)
      then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
      else do
        Ptr Word64
pPWaitSemaphoreValues <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Word64 (((forall a. Vector a -> Int
Data.Vector.length (Vector Word64
waitSemaphoreValues))) forall a. Num a => a -> a -> a
* Int
8)
        forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Word64
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word64
pPWaitSemaphoreValues forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) (Word64
e)) ((Vector Word64
waitSemaphoreValues))
        forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Ptr Word64
pPWaitSemaphoreValues
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word64))) Ptr Word64
pWaitSemaphoreValues''
    let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Word64
signalSemaphoreValues)
    DWORD
signalSemaphoreValuesCount'' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ if (DWORD
signalSemaphoreValuesCount) forall a. Eq a => a -> a -> Bool
== DWORD
0
      then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength
      else do
        forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pSignalSemaphoreValuesLength forall a. Eq a => a -> a -> Bool
== (DWORD
signalSemaphoreValuesCount) Bool -> Bool -> Bool
|| Int
pSignalSemaphoreValuesLength forall a. Eq a => a -> a -> Bool
== Int
0) forall a b. (a -> b) -> a -> b
$
          forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pSignalSemaphoreValues must be empty or have 'signalSemaphoreValuesCount' elements" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
        forall (f :: * -> *) a. Applicative f => a -> f a
pure (DWORD
signalSemaphoreValuesCount)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Word32)) (DWORD
signalSemaphoreValuesCount'')
    Ptr Word64
pSignalSemaphoreValues'' <- if forall a. Vector a -> Bool
Data.Vector.null (Vector Word64
signalSemaphoreValues)
      then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
      else do
        Ptr Word64
pPSignalSemaphoreValues <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Word64 (((forall a. Vector a -> Int
Data.Vector.length (Vector Word64
signalSemaphoreValues))) forall a. Num a => a -> a -> a
* Int
8)
        forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Word64
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word64
pPSignalSemaphoreValues forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) (Word64
e)) ((Vector Word64
signalSemaphoreValues))
        forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Ptr Word64
pPSignalSemaphoreValues
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr (Ptr Word64))) Ptr Word64
pSignalSemaphoreValues''
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
48
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr D3D12FenceSubmitInfoKHR -> IO b -> IO b
pokeZeroCStruct Ptr D3D12FenceSubmitInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct D3D12FenceSubmitInfoKHR where
  peekCStruct :: Ptr D3D12FenceSubmitInfoKHR -> IO D3D12FenceSubmitInfoKHR
peekCStruct Ptr D3D12FenceSubmitInfoKHR
p = do
    DWORD
waitSemaphoreValuesCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Ptr Word64
pWaitSemaphoreValues <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word64)))
    let pWaitSemaphoreValuesLength :: Int
pWaitSemaphoreValuesLength = if Ptr Word64
pWaitSemaphoreValues forall a. Eq a => a -> a -> Bool
== forall a. Ptr a
nullPtr then Int
0 else (forall a b. (Integral a, Num b) => a -> b
fromIntegral DWORD
waitSemaphoreValuesCount)
    Vector Word64
pWaitSemaphoreValues' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pWaitSemaphoreValuesLength (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr Word64
pWaitSemaphoreValues forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    DWORD
signalSemaphoreValuesCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Word32))
    Ptr Word64
pSignalSemaphoreValues <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr D3D12FenceSubmitInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr (Ptr Word64)))
    let pSignalSemaphoreValuesLength :: Int
pSignalSemaphoreValuesLength = if Ptr Word64
pSignalSemaphoreValues forall a. Eq a => a -> a -> Bool
== forall a. Ptr a
nullPtr then Int
0 else (forall a b. (Integral a, Num b) => a -> b
fromIntegral DWORD
signalSemaphoreValuesCount)
    Vector Word64
pSignalSemaphoreValues' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pSignalSemaphoreValuesLength (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr Word64
pSignalSemaphoreValues forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure 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
           forall a. Zero a => a
zero
           forall a. Monoid a => a
mempty
           forall a. Zero a => a
zero
           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
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01126#
--     @handleType@ /must/ have been included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'::@handleTypes@
--     when the @semaphore@’s current payload was created
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01127# 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@
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-semaphore-01128# @semaphore@
--     /must/ not currently have its payload replaced by an imported
--     payload as described below in
--     <https://registry.khronos.org/vulkan/specs/1.3-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@
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01129# If
--     @handleType@ refers to a handle type with copy payload transference
--     semantics, as defined below in
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>,
--     there /must/ be no queue waiting on @semaphore@
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01130# If
--     @handleType@ refers to a handle type with copy payload transference
--     semantics, @semaphore@ /must/ be signaled, or have an associated
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-semaphores-signaling semaphore signal operation>
--     pending execution
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01131#
--     @handleType@ /must/ be defined as an NT handle or a global share
--     handle
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-sType-sType# @sType@ /must/
--     be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-pNext-pNext# @pNext@ /must/
--     be @NULL@
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-semaphore-parameter#
--     @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   #VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-parameter#
--     @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_semaphore_win32 VK_KHR_external_semaphore_win32>,
-- '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 a
    -- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
    -- value specifying the type of handle requested.
    SemaphoreGetWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
  }
  deriving (Typeable, SemaphoreGetWin32HandleInfoKHR
-> SemaphoreGetWin32HandleInfoKHR -> Bool
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 :: forall b.
SemaphoreGetWin32HandleInfoKHR
-> (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
    -> IO b)
-> IO b
withCStruct SemaphoreGetWin32HandleInfoKHR
x ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p -> 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 :: forall b.
("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p SemaphoreGetWin32HandleInfoKHR{Semaphore
ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
semaphore :: Semaphore
$sel:handleType:SemaphoreGetWin32HandleInfoKHR :: SemaphoreGetWin32HandleInfoKHR
-> ExternalSemaphoreHandleTypeFlagBits
$sel:semaphore:SemaphoreGetWin32HandleInfoKHR :: SemaphoreGetWin32HandleInfoKHR -> Semaphore
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct SemaphoreGetWin32HandleInfoKHR where
  peekCStruct :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO SemaphoreGetWin32HandleInfoKHR
peekCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p = do
    Semaphore
semaphore <- forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore))
    ExternalSemaphoreHandleTypeFlagBits
handleType <- forall a. Storable a => Ptr a -> IO a
peek @ExternalSemaphoreHandleTypeFlagBits (("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Semaphore
-> ExternalSemaphoreHandleTypeFlagBits
-> SemaphoreGetWin32HandleInfoKHR
SemaphoreGetWin32HandleInfoKHR
             Semaphore
semaphore ExternalSemaphoreHandleTypeFlagBits
handleType

instance Storable SemaphoreGetWin32HandleInfoKHR where
  sizeOf :: SemaphoreGetWin32HandleInfoKHR -> Int
sizeOf ~SemaphoreGetWin32HandleInfoKHR
_ = Int
32
  alignment :: SemaphoreGetWin32HandleInfoKHR -> Int
alignment ~SemaphoreGetWin32HandleInfoKHR
_ = Int
8
  peek :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> IO SemaphoreGetWin32HandleInfoKHR
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR)
-> SemaphoreGetWin32HandleInfoKHR -> IO ()
poke "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
ptr SemaphoreGetWin32HandleInfoKHR
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetWin32HandleInfo" ::: Ptr SemaphoreGetWin32HandleInfoKHR
ptr SemaphoreGetWin32HandleInfoKHR
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero SemaphoreGetWin32HandleInfoKHR where
  zero :: SemaphoreGetWin32HandleInfoKHR
zero = Semaphore
-> ExternalSemaphoreHandleTypeFlagBits
-> SemaphoreGetWin32HandleInfoKHR
SemaphoreGetWin32HandleInfoKHR
           forall a. Zero a => a
zero
           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 :: forall a. Integral a => a
$mKHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> 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 :: forall a. (Eq a, IsString a) => a
$mKHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME = "VK_KHR_external_semaphore_win32"