{-# language CPP #-}
-- | = Name
--
-- VK_KHR_external_fence_win32 - device extension
--
-- == VK_KHR_external_fence_win32
--
-- [__Name String__]
--     @VK_KHR_external_fence_win32@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     115
--
-- [__Revision__]
--     1
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires Vulkan 1.0
--
--     -   Requires @VK_KHR_external_fence@
--
-- [__Contact__]
--
--     -   Jesse Hall
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?title=VK_KHR_external_fence_win32:%20&body=@critsec%20 >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2017-05-08
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Jesse Hall, Google
--
--     -   James Jones, NVIDIA
--
--     -   Jeff Juliano, NVIDIA
--
--     -   Cass Everitt, Oculus
--
--     -   Contributors to @VK_KHR_external_semaphore_win32@
--
-- == Description
--
-- An application using external memory may wish to synchronize access to
-- that memory using fences. This extension enables an application to
-- export fence payload to and import fence payload from Windows handles.
--
-- == New Commands
--
-- -   'getFenceWin32HandleKHR'
--
-- -   'importFenceWin32HandleKHR'
--
-- == New Structures
--
-- -   'FenceGetWin32HandleInfoKHR'
--
-- -   'ImportFenceWin32HandleInfoKHR'
--
-- -   Extending 'Vulkan.Core10.Fence.FenceCreateInfo':
--
--     -   'ExportFenceWin32HandleInfoKHR'
--
-- == New Enum Constants
--
-- -   'KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME'
--
-- -   'KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR'
--
-- == Issues
--
-- This extension borrows concepts, semantics, and language from
-- @VK_KHR_external_semaphore_win32@. That extension’s issues apply equally
-- to this extension.
--
-- 1) Should D3D12 fence handle types be supported, like they are for
-- semaphores?
--
-- __RESOLVED__: No. Doing so would require extending the fence signal and
-- wait operations to provide values to signal \/ wait for, like
-- 'Vulkan.Extensions.VK_KHR_external_semaphore_win32.D3D12FenceSubmitInfoKHR'
-- does. A D3D12 fence can be signaled by importing it into a
-- 'Vulkan.Core10.Handles.Semaphore' instead of a
-- 'Vulkan.Core10.Handles.Fence', and applications can check status or wait
-- on the D3D12 fence using non-Vulkan APIs. The convenience of being able
-- to do these operations on 'Vulkan.Core10.Handles.Fence' objects doesn’t
-- justify the extra API complexity.
--
-- == Version History
--
-- -   Revision 1, 2017-05-08 (Jesse Hall)
--
--     -   Initial revision
--
-- = See Also
--
-- 'ExportFenceWin32HandleInfoKHR', 'FenceGetWin32HandleInfoKHR',
-- 'ImportFenceWin32HandleInfoKHR', 'getFenceWin32HandleKHR',
-- 'importFenceWin32HandleKHR'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_fence_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_fence_win32  ( getFenceWin32HandleKHR
                                                      , importFenceWin32HandleKHR
                                                      , ImportFenceWin32HandleInfoKHR(..)
                                                      , ExportFenceWin32HandleInfoKHR(..)
                                                      , FenceGetWin32HandleInfoKHR(..)
                                                      , KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION
                                                      , pattern KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION
                                                      , KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME
                                                      , pattern KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME
                                                      , HANDLE
                                                      , DWORD
                                                      , LPCWSTR
                                                      , SECURITY_ATTRIBUTES
                                                      ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import 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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Extensions.VK_NV_external_memory_win32 (DWORD)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetFenceWin32HandleKHR))
import Vulkan.Dynamic (DeviceCmds(pVkImportFenceWin32HandleKHR))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits (ExternalFenceHandleTypeFlagBits)
import Vulkan.Core10.Handles (Fence)
import Vulkan.Core11.Enums.FenceImportFlagBits (FenceImportFlags)
import Vulkan.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.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_FENCE_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" mkVkGetFenceWin32HandleKHR
  :: FunPtr (Ptr Device_T -> Ptr FenceGetWin32HandleInfoKHR -> Ptr HANDLE -> IO Result) -> Ptr Device_T -> Ptr FenceGetWin32HandleInfoKHR -> Ptr HANDLE -> IO Result

-- | vkGetFenceWin32HandleKHR - Get a Windows HANDLE for a fence
--
-- = Description
--
-- For handle types defined as NT handles, the handles returned by
-- 'getFenceWin32HandleKHR' 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 fence /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-fences-importing Importing Fence 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', 'FenceGetWin32HandleInfoKHR'
getFenceWin32HandleKHR :: forall io
                        . (MonadIO io)
                       => -- | @device@ is the logical device that created the fence being exported.
                          --
                          -- #VUID-vkGetFenceWin32HandleKHR-device-parameter# @device@ /must/ be a
                          -- valid 'Vulkan.Core10.Handles.Device' handle
                          Device
                       -> -- | @pGetWin32HandleInfo@ is a pointer to a 'FenceGetWin32HandleInfoKHR'
                          -- structure containing parameters of the export operation.
                          --
                          -- #VUID-vkGetFenceWin32HandleKHR-pGetWin32HandleInfo-parameter#
                          -- @pGetWin32HandleInfo@ /must/ be a valid pointer to a valid
                          -- 'FenceGetWin32HandleInfoKHR' structure
                          FenceGetWin32HandleInfoKHR
                       -> io (HANDLE)
getFenceWin32HandleKHR :: Device -> FenceGetWin32HandleInfoKHR -> io HANDLE
getFenceWin32HandleKHR device :: Device
device getWin32HandleInfo :: FenceGetWin32HandleInfoKHR
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 vkGetFenceWin32HandleKHRPtr :: FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
vkGetFenceWin32HandleKHRPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
      -> ("pHandle" ::: Ptr HANDLE)
      -> IO Result)
pVkGetFenceWin32HandleKHR (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 FenceGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
vkGetFenceWin32HandleKHRPtr FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
      -> ("pHandle" ::: Ptr HANDLE)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> ("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 vkGetFenceWin32HandleKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetFenceWin32HandleKHR' :: Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
vkGetFenceWin32HandleKHR' = FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
-> Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
mkVkGetFenceWin32HandleKHR FunPtr
  (Ptr Device_T
   -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> ("pHandle" ::: Ptr HANDLE)
   -> IO Result)
vkGetFenceWin32HandleKHRPtr
  "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
pGetWin32HandleInfo <- ((("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
  -> IO HANDLE)
 -> IO HANDLE)
-> ContT
     HANDLE
     IO
     ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
   -> IO HANDLE)
  -> IO HANDLE)
 -> ContT
      HANDLE
      IO
      ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR))
-> ((("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
     -> IO HANDLE)
    -> IO HANDLE)
-> ContT
     HANDLE
     IO
     ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
forall a b. (a -> b) -> a -> b
$ FenceGetWin32HandleInfoKHR
-> (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
    -> IO HANDLE)
-> IO HANDLE
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (FenceGetWin32HandleInfoKHR
getWin32HandleInfo)
  "pHandle" ::: Ptr HANDLE
pPHandle <- ((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
-> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
 -> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE))
-> ((("pHandle" ::: Ptr HANDLE) -> IO HANDLE) -> IO HANDLE)
-> ContT HANDLE IO ("pHandle" ::: Ptr HANDLE)
forall a b. (a -> b) -> a -> b
$ IO ("pHandle" ::: Ptr HANDLE)
-> (("pHandle" ::: Ptr HANDLE) -> IO ())
-> (("pHandle" ::: Ptr HANDLE) -> IO HANDLE)
-> IO HANDLE
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pHandle" ::: Ptr HANDLE)
forall a. Int -> IO (Ptr a)
callocBytes @HANDLE 8) ("pHandle" ::: Ptr HANDLE) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT HANDLE IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT HANDLE IO Result)
-> IO Result -> ContT HANDLE IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkGetFenceWin32HandleKHR" (Ptr Device_T
-> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> ("pHandle" ::: Ptr HANDLE)
-> IO Result
vkGetFenceWin32HandleKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
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" mkVkImportFenceWin32HandleKHR
  :: FunPtr (Ptr Device_T -> Ptr ImportFenceWin32HandleInfoKHR -> IO Result) -> Ptr Device_T -> Ptr ImportFenceWin32HandleInfoKHR -> IO Result

-- | vkImportFenceWin32HandleKHR - Import a fence from a Windows HANDLE
--
-- = Description
--
-- Importing a fence 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 fence 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', 'ImportFenceWin32HandleInfoKHR'
importFenceWin32HandleKHR :: forall io
                           . (MonadIO io)
                          => -- | @device@ is the logical device that created the fence.
                             --
                             -- #VUID-vkImportFenceWin32HandleKHR-device-parameter# @device@ /must/ be a
                             -- valid 'Vulkan.Core10.Handles.Device' handle
                             Device
                          -> -- | @pImportFenceWin32HandleInfo@ is a pointer to a
                             -- 'ImportFenceWin32HandleInfoKHR' structure specifying the fence and
                             -- import parameters.
                             --
                             -- #VUID-vkImportFenceWin32HandleKHR-pImportFenceWin32HandleInfo-parameter#
                             -- @pImportFenceWin32HandleInfo@ /must/ be a valid pointer to a valid
                             -- 'ImportFenceWin32HandleInfoKHR' structure
                             ImportFenceWin32HandleInfoKHR
                          -> io ()
importFenceWin32HandleKHR :: Device -> ImportFenceWin32HandleInfoKHR -> io ()
importFenceWin32HandleKHR device :: Device
device importFenceWin32HandleInfo :: ImportFenceWin32HandleInfoKHR
importFenceWin32HandleInfo = 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 vkImportFenceWin32HandleKHRPtr :: FunPtr
  (Ptr Device_T
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO Result)
vkImportFenceWin32HandleKHRPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pImportFenceWin32HandleInfo"
          ::: Ptr ImportFenceWin32HandleInfoKHR)
      -> IO Result)
pVkImportFenceWin32HandleKHR (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
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO Result)
vkImportFenceWin32HandleKHRPtr FunPtr
  (Ptr Device_T
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pImportFenceWin32HandleInfo"
          ::: Ptr ImportFenceWin32HandleInfoKHR)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> 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 vkImportFenceWin32HandleKHR is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkImportFenceWin32HandleKHR' :: Ptr Device_T
-> ("pImportFenceWin32HandleInfo"
    ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO Result
vkImportFenceWin32HandleKHR' = FunPtr
  (Ptr Device_T
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO Result)
-> Ptr Device_T
-> ("pImportFenceWin32HandleInfo"
    ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO Result
mkVkImportFenceWin32HandleKHR FunPtr
  (Ptr Device_T
   -> ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO Result)
vkImportFenceWin32HandleKHRPtr
  "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
pImportFenceWin32HandleInfo <- ((("pImportFenceWin32HandleInfo"
   ::: Ptr ImportFenceWin32HandleInfoKHR)
  -> IO ())
 -> IO ())
-> ContT
     ()
     IO
     ("pImportFenceWin32HandleInfo"
      ::: Ptr ImportFenceWin32HandleInfoKHR)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pImportFenceWin32HandleInfo"
    ::: Ptr ImportFenceWin32HandleInfoKHR)
   -> IO ())
  -> IO ())
 -> ContT
      ()
      IO
      ("pImportFenceWin32HandleInfo"
       ::: Ptr ImportFenceWin32HandleInfoKHR))
-> ((("pImportFenceWin32HandleInfo"
      ::: Ptr ImportFenceWin32HandleInfoKHR)
     -> IO ())
    -> IO ())
-> ContT
     ()
     IO
     ("pImportFenceWin32HandleInfo"
      ::: Ptr ImportFenceWin32HandleInfoKHR)
forall a b. (a -> b) -> a -> b
$ ImportFenceWin32HandleInfoKHR
-> (("pImportFenceWin32HandleInfo"
     ::: Ptr ImportFenceWin32HandleInfoKHR)
    -> IO ())
-> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImportFenceWin32HandleInfoKHR
importFenceWin32HandleInfo)
  Result
r <- IO Result -> ContT () IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT () IO Result)
-> IO Result -> ContT () IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "vkImportFenceWin32HandleKHR" (Ptr Device_T
-> ("pImportFenceWin32HandleInfo"
    ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO Result
vkImportFenceWin32HandleKHR' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
pImportFenceWin32HandleInfo)
  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))


-- | VkImportFenceWin32HandleInfoKHR - (None)
--
-- = Description
--
-- The handle types supported by @handleType@ are:
--
-- +-------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
-- | Handle Type                                                                                           | Transference         | Permanence Supported  |
-- +=======================================================================================================+======================+=======================+
-- | 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT'     | Reference            | Temporary,Permanent   |
-- +-------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
-- | 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT' | Reference            | Temporary,Permanent   |
-- +-------------------------------------------------------------------------------------------------------+----------------------+-----------------------+
--
-- Handle Types Supported by 'ImportFenceWin32HandleInfoKHR'
--
-- == Valid Usage
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handleType-01457# @handleType@
--     /must/ be a value included in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-fence-handletypes-win32 Handle Types Supported by >
--     table
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handleType-01459# If
--     @handleType@ is not
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT',
--     @name@ /must/ be @NULL@
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handleType-01460# If
--     @handleType@ is not @0@ and @handle@ is @NULL@, @name@ /must/ name a
--     valid synchronization primitive of the type specified by
--     @handleType@
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handleType-01461# If
--     @handleType@ is not @0@ and @name@ is @NULL@, @handle@ /must/ be a
--     valid handle of the type specified by @handleType@
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handle-01462# If @handle@ is
--     not @NULL@, @name@ /must/ be @NULL@
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handle-01539# 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-fence-handle-types-compatibility external fence handle types compatibility>
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-name-01540# 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-fence-handle-types-compatibility external fence handle types compatibility>
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-pNext-pNext# @pNext@ /must/ be
--     @NULL@
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-fence-parameter# @fence@
--     /must/ be a valid 'Vulkan.Core10.Handles.Fence' handle
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-flags-parameter# @flags@
--     /must/ be a valid combination of
--     'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlagBits' values
--
-- -   #VUID-VkImportFenceWin32HandleInfoKHR-handleType-parameter# If
--     @handleType@ is not @0@, @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
--     value
--
-- == Host Synchronization
--
-- -   Host access to @fence@ /must/ be externally synchronized
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Fence',
-- 'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'importFenceWin32HandleKHR'
data ImportFenceWin32HandleInfoKHR = ImportFenceWin32HandleInfoKHR
  { -- | @fence@ is the fence into which the state will be imported.
    ImportFenceWin32HandleInfoKHR -> Fence
fence :: Fence
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlagBits' specifying
    -- additional parameters for the fence payload import operation.
    ImportFenceWin32HandleInfoKHR -> FenceImportFlags
flags :: FenceImportFlags
  , -- | @handleType@ specifies the type of @handle@.
    ImportFenceWin32HandleInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
  , -- | @handle@ is the external handle to import, or @NULL@.
    ImportFenceWin32HandleInfoKHR -> HANDLE
handle :: HANDLE
  , -- | @name@ is a null-terminated UTF-16 string naming the underlying
    -- synchronization primitive to import, or @NULL@.
    ImportFenceWin32HandleInfoKHR -> LPCWSTR
name :: LPCWSTR
  }
  deriving (Typeable, ImportFenceWin32HandleInfoKHR
-> ImportFenceWin32HandleInfoKHR -> Bool
(ImportFenceWin32HandleInfoKHR
 -> ImportFenceWin32HandleInfoKHR -> Bool)
-> (ImportFenceWin32HandleInfoKHR
    -> ImportFenceWin32HandleInfoKHR -> Bool)
-> Eq ImportFenceWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportFenceWin32HandleInfoKHR
-> ImportFenceWin32HandleInfoKHR -> Bool
$c/= :: ImportFenceWin32HandleInfoKHR
-> ImportFenceWin32HandleInfoKHR -> Bool
== :: ImportFenceWin32HandleInfoKHR
-> ImportFenceWin32HandleInfoKHR -> Bool
$c== :: ImportFenceWin32HandleInfoKHR
-> ImportFenceWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportFenceWin32HandleInfoKHR)
#endif
deriving instance Show ImportFenceWin32HandleInfoKHR

instance ToCStruct ImportFenceWin32HandleInfoKHR where
  withCStruct :: ImportFenceWin32HandleInfoKHR
-> (("pImportFenceWin32HandleInfo"
     ::: Ptr ImportFenceWin32HandleInfoKHR)
    -> IO b)
-> IO b
withCStruct x :: ImportFenceWin32HandleInfoKHR
x f :: ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO b
f = Int
-> Int
-> (("pImportFenceWin32HandleInfo"
     ::: Ptr ImportFenceWin32HandleInfoKHR)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((("pImportFenceWin32HandleInfo"
   ::: Ptr ImportFenceWin32HandleInfoKHR)
  -> IO b)
 -> IO b)
-> (("pImportFenceWin32HandleInfo"
     ::: Ptr ImportFenceWin32HandleInfoKHR)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p -> ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> ImportFenceWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ImportFenceWin32HandleInfoKHR
x (("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO b
f "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p)
  pokeCStruct :: ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> ImportFenceWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ImportFenceWin32HandleInfoKHR{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
    Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
fence)
    Ptr FenceImportFlags -> FenceImportFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr FenceImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr FenceImportFlags)) (FenceImportFlags
flags)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> 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 (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> 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 :: ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct p :: "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
    Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImportFenceWin32HandleInfoKHR where
  peekCStruct :: ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> IO ImportFenceWin32HandleInfoKHR
peekCStruct p :: "pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p = do
    Fence
fence <- Ptr Fence -> IO Fence
forall a. Storable a => Ptr a -> IO a
peek @Fence (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence))
    FenceImportFlags
flags <- Ptr FenceImportFlags -> IO FenceImportFlags
forall a. Storable a => Ptr a -> IO a
peek @FenceImportFlags (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr FenceImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr FenceImportFlags))
    ExternalFenceHandleTypeFlagBits
handleType <- Ptr ExternalFenceHandleTypeFlagBits
-> IO ExternalFenceHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr ExternalFenceHandleTypeFlagBits))
    HANDLE
handle <- ("pHandle" ::: Ptr HANDLE) -> IO HANDLE
forall a. Storable a => Ptr a -> IO a
peek @HANDLE (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> 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 (("pImportFenceWin32HandleInfo" ::: Ptr ImportFenceWin32HandleInfoKHR
p ("pImportFenceWin32HandleInfo"
 ::: Ptr ImportFenceWin32HandleInfoKHR)
-> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr LPCWSTR))
    ImportFenceWin32HandleInfoKHR -> IO ImportFenceWin32HandleInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportFenceWin32HandleInfoKHR -> IO ImportFenceWin32HandleInfoKHR)
-> ImportFenceWin32HandleInfoKHR
-> IO ImportFenceWin32HandleInfoKHR
forall a b. (a -> b) -> a -> b
$ Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> HANDLE
-> LPCWSTR
-> ImportFenceWin32HandleInfoKHR
ImportFenceWin32HandleInfoKHR
             Fence
fence FenceImportFlags
flags ExternalFenceHandleTypeFlagBits
handleType HANDLE
handle LPCWSTR
name

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

instance Zero ImportFenceWin32HandleInfoKHR where
  zero :: ImportFenceWin32HandleInfoKHR
zero = Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> HANDLE
-> LPCWSTR
-> ImportFenceWin32HandleInfoKHR
ImportFenceWin32HandleInfoKHR
           Fence
forall a. Zero a => a
zero
           FenceImportFlags
forall a. Zero a => a
zero
           ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero
           HANDLE
forall a. Zero a => a
zero
           LPCWSTR
forall a. Zero a => a
zero


-- | VkExportFenceWin32HandleInfoKHR - Structure specifying additional
-- attributes of Windows handles exported from a fence
--
-- = Description
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_external_fence.ExportFenceCreateInfo'
-- is not present in the same @pNext@ chain, this structure is ignored.
--
-- If
-- 'Vulkan.Core11.Promoted_From_VK_KHR_external_fence.ExportFenceCreateInfo'
-- is present in the @pNext@ chain of 'Vulkan.Core10.Fence.FenceCreateInfo'
-- with a Windows @handleType@, but either 'ExportFenceWin32HandleInfoKHR'
-- 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 will be
--
-- @DXGI_SHARED_RESOURCE_READ@ | @DXGI_SHARED_RESOURCE_WRITE@
--
-- for handles of the following types:
--
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT'
--
-- [1]
--     <https://docs.microsoft.com/en-us/windows/win32/sync/synchronization-object-security-and-access-rights>
--
-- == Valid Usage
--
-- -   #VUID-VkExportFenceWin32HandleInfoKHR-handleTypes-01447# If
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_fence.ExportFenceCreateInfo'::@handleTypes@
--     does not include
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT',
--     a 'ExportFenceWin32HandleInfoKHR' structure /must/ not be included
--     in the @pNext@ chain of 'Vulkan.Core10.Fence.FenceCreateInfo'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkExportFenceWin32HandleInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkExportFenceWin32HandleInfoKHR-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
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ExportFenceWin32HandleInfoKHR = ExportFenceWin32HandleInfoKHR
  { -- | @pAttributes@ is a pointer to a Windows
    -- 'Vulkan.Extensions.VK_NV_external_memory_win32.SECURITY_ATTRIBUTES'
    -- structure specifying security attributes of the handle.
    ExportFenceWin32HandleInfoKHR -> Ptr SECURITY_ATTRIBUTES
attributes :: Ptr SECURITY_ATTRIBUTES
  , -- | @dwAccess@ is a 'Vulkan.Extensions.VK_NV_external_memory_win32.DWORD'
    -- specifying access rights of the handle.
    ExportFenceWin32HandleInfoKHR -> 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 fence.
    ExportFenceWin32HandleInfoKHR -> LPCWSTR
name :: LPCWSTR
  }
  deriving (Typeable, ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> Bool
(ExportFenceWin32HandleInfoKHR
 -> ExportFenceWin32HandleInfoKHR -> Bool)
-> (ExportFenceWin32HandleInfoKHR
    -> ExportFenceWin32HandleInfoKHR -> Bool)
-> Eq ExportFenceWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> Bool
$c/= :: ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> Bool
== :: ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> Bool
$c== :: ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExportFenceWin32HandleInfoKHR)
#endif
deriving instance Show ExportFenceWin32HandleInfoKHR

instance ToCStruct ExportFenceWin32HandleInfoKHR where
  withCStruct :: ExportFenceWin32HandleInfoKHR
-> (Ptr ExportFenceWin32HandleInfoKHR -> IO b) -> IO b
withCStruct x :: ExportFenceWin32HandleInfoKHR
x f :: Ptr ExportFenceWin32HandleInfoKHR -> IO b
f = Int -> Int -> (Ptr ExportFenceWin32HandleInfoKHR -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((Ptr ExportFenceWin32HandleInfoKHR -> IO b) -> IO b)
-> (Ptr ExportFenceWin32HandleInfoKHR -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ExportFenceWin32HandleInfoKHR
p -> Ptr ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExportFenceWin32HandleInfoKHR
p ExportFenceWin32HandleInfoKHR
x (Ptr ExportFenceWin32HandleInfoKHR -> IO b
f Ptr ExportFenceWin32HandleInfoKHR
p)
  pokeCStruct :: Ptr ExportFenceWin32HandleInfoKHR
-> ExportFenceWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: Ptr ExportFenceWin32HandleInfoKHR
p ExportFenceWin32HandleInfoKHR{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR
-> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR
-> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> 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 ExportFenceWin32HandleInfoKHR -> IO b -> IO b
pokeZeroCStruct p :: Ptr ExportFenceWin32HandleInfoKHR
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR
-> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> 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 ExportFenceWin32HandleInfoKHR where
  peekCStruct :: Ptr ExportFenceWin32HandleInfoKHR
-> IO ExportFenceWin32HandleInfoKHR
peekCStruct p :: Ptr ExportFenceWin32HandleInfoKHR
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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR
-> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> 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 ExportFenceWin32HandleInfoKHR
p Ptr ExportFenceWin32HandleInfoKHR -> Int -> Ptr LPCWSTR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr LPCWSTR))
    ExportFenceWin32HandleInfoKHR -> IO ExportFenceWin32HandleInfoKHR
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExportFenceWin32HandleInfoKHR -> IO ExportFenceWin32HandleInfoKHR)
-> ExportFenceWin32HandleInfoKHR
-> IO ExportFenceWin32HandleInfoKHR
forall a b. (a -> b) -> a -> b
$ Ptr SECURITY_ATTRIBUTES
-> DWORD -> LPCWSTR -> ExportFenceWin32HandleInfoKHR
ExportFenceWin32HandleInfoKHR
             Ptr SECURITY_ATTRIBUTES
pAttributes DWORD
dwAccess LPCWSTR
name

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

instance Zero ExportFenceWin32HandleInfoKHR where
  zero :: ExportFenceWin32HandleInfoKHR
zero = Ptr SECURITY_ATTRIBUTES
-> DWORD -> LPCWSTR -> ExportFenceWin32HandleInfoKHR
ExportFenceWin32HandleInfoKHR
           Ptr SECURITY_ATTRIBUTES
forall a. Zero a => a
zero
           DWORD
forall a. Zero a => a
zero
           LPCWSTR
forall a. Zero a => a
zero


-- | VkFenceGetWin32HandleInfoKHR - Structure describing a Win32 handle fence
-- export operation
--
-- = Description
--
-- The properties of the handle returned depend on the value of
-- @handleType@. See
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
-- for a description of the properties of the defined external fence handle
-- types.
--
-- == Valid Usage
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-handleType-01448# @handleType@
--     /must/ have been included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_fence.ExportFenceCreateInfo'::@handleTypes@
--     when the @fence@’s current payload was created
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-handleType-01449# If @handleType@
--     is defined as an NT handle, 'getFenceWin32HandleKHR' /must/ be
--     called no more than once for each valid unique combination of
--     @fence@ and @handleType@
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-fence-01450# @fence@ /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-fences-importing Importing Fence Payloads>
--     unless that imported payload’s handle type was included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_fence_capabilities.ExternalFenceProperties'::@exportFromImportedHandleTypes@
--     for @handleType@
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-handleType-01451# If @handleType@
--     refers to a handle type with copy payload transference semantics,
--     @fence@ /must/ be signaled, or have an associated
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-fences-signaling fence signal operation>
--     pending execution
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-handleType-01452# @handleType@
--     /must/ be defined as an NT handle or a global share handle
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR'
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-pNext-pNext# @pNext@ /must/ be
--     @NULL@
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-fence-parameter# @fence@ /must/
--     be a valid 'Vulkan.Core10.Handles.Fence' handle
--
-- -   #VUID-VkFenceGetWin32HandleInfoKHR-handleType-parameter#
--     @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Fence',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getFenceWin32HandleKHR'
data FenceGetWin32HandleInfoKHR = FenceGetWin32HandleInfoKHR
  { -- | @fence@ is the fence from which state will be exported.
    FenceGetWin32HandleInfoKHR -> Fence
fence :: Fence
  , -- | @handleType@ is the type of handle requested.
    FenceGetWin32HandleInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
  }
  deriving (Typeable, FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool
(FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool)
-> (FenceGetWin32HandleInfoKHR
    -> FenceGetWin32HandleInfoKHR -> Bool)
-> Eq FenceGetWin32HandleInfoKHR
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool
$c/= :: FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool
== :: FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool
$c== :: FenceGetWin32HandleInfoKHR -> FenceGetWin32HandleInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (FenceGetWin32HandleInfoKHR)
#endif
deriving instance Show FenceGetWin32HandleInfoKHR

instance ToCStruct FenceGetWin32HandleInfoKHR where
  withCStruct :: FenceGetWin32HandleInfoKHR
-> (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
    -> IO b)
-> IO b
withCStruct x :: FenceGetWin32HandleInfoKHR
x f :: ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR) -> IO b
f = Int
-> Int
-> (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
  -> IO b)
 -> IO b)
-> (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p -> ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> FenceGetWin32HandleInfoKHR -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p FenceGetWin32HandleInfoKHR
x (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR) -> IO b
f "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p)
  pokeCStruct :: ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> FenceGetWin32HandleInfoKHR -> IO b -> IO b
pokeCStruct p :: "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p FenceGetWin32HandleInfoKHR{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
    Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
fence)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> IO b -> IO b
pokeZeroCStruct p :: "pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR)
    ("pHandle" ::: Ptr HANDLE) -> HANDLE -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> "pHandle" ::: Ptr HANDLE
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (HANDLE
forall a. Ptr a
nullPtr)
    Ptr Fence -> Fence -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr Fence
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Fence)) (Fence
forall a. Zero a => a
zero)
    Ptr ExternalFenceHandleTypeFlagBits
-> ExternalFenceHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR
p ("pGetWin32HandleInfo" ::: Ptr FenceGetWin32HandleInfoKHR)
-> Int -> Ptr ExternalFenceHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero)
    IO b
f

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

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

instance Zero FenceGetWin32HandleInfoKHR where
  zero :: FenceGetWin32HandleInfoKHR
zero = Fence
-> ExternalFenceHandleTypeFlagBits -> FenceGetWin32HandleInfoKHR
FenceGetWin32HandleInfoKHR
           Fence
forall a. Zero a => a
zero
           ExternalFenceHandleTypeFlagBits
forall a. Zero a => a
zero


type KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION"
pattern KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION :: a
$mKHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION = 1


type KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME = "VK_KHR_external_fence_win32"

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME"
pattern KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME :: a
$mKHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME = "VK_KHR_external_fence_win32"