{-# language CPP #-}
-- | = Name
--
-- VK_KHR_external_fence_fd - device extension
--
-- == VK_KHR_external_fence_fd
--
-- [__Name String__]
--     @VK_KHR_external_fence_fd@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     116
--
-- [__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_fence VK_KHR_external_fence>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Version 1.1>
--
-- [__Contact__]
--
--     -   Jesse Hall
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_KHR_external_fence_fd] @critsec%0A*Here describe the issue or question you have about the VK_KHR_external_fence_fd extension* >
--
-- == 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_fd@
--
-- == 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 POSIX file
-- descriptors.
--
-- == New Commands
--
-- -   'getFenceFdKHR'
--
-- -   'importFenceFdKHR'
--
-- == New Structures
--
-- -   'FenceGetFdInfoKHR'
--
-- -   'ImportFenceFdInfoKHR'
--
-- == New Enum Constants
--
-- -   'KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME'
--
-- -   'KHR_EXTERNAL_FENCE_FD_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR'
--
-- == Issues
--
-- This extension borrows concepts, semantics, and language from
-- @VK_KHR_external_semaphore_fd@. That extension’s issues apply equally to
-- this extension.
--
-- == Version History
--
-- -   Revision 1, 2017-05-08 (Jesse Hall)
--
--     -   Initial revision
--
-- == See Also
--
-- 'FenceGetFdInfoKHR', 'ImportFenceFdInfoKHR', 'getFenceFdKHR',
-- 'importFenceFdKHR'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_KHR_external_fence_fd 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_fd  ( getFenceFdKHR
                                                   , importFenceFdKHR
                                                   , ImportFenceFdInfoKHR(..)
                                                   , FenceGetFdInfoKHR(..)
                                                   , KHR_EXTERNAL_FENCE_FD_SPEC_VERSION
                                                   , pattern KHR_EXTERNAL_FENCE_FD_SPEC_VERSION
                                                   , KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME
                                                   , pattern KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME
                                                   ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.Coerce (coerce)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Foreign.C.Types (CInt(..))
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CInt)
import Foreign.C.Types (CInt(..))
import Foreign.C.Types (CInt(CInt))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetFenceFdKHR))
import Vulkan.Dynamic (DeviceCmds(pVkImportFenceFdKHR))
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.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetFenceFdKHR
  :: FunPtr (Ptr Device_T -> Ptr FenceGetFdInfoKHR -> Ptr CInt -> IO Result) -> Ptr Device_T -> Ptr FenceGetFdInfoKHR -> Ptr CInt -> IO Result

-- | vkGetFenceFdKHR - Get a POSIX file descriptor handle for a fence
--
-- = Description
--
-- Each call to 'getFenceFdKHR' /must/ create a new file descriptor and
-- transfer ownership of it to the application. To avoid leaking resources,
-- the application /must/ release ownership of the file descriptor when it
-- is no longer needed.
--
-- Note
--
-- Ownership can be released in many ways. For example, the application can
-- call @close@() on the file descriptor, or transfer ownership back to
-- Vulkan by using the file descriptor to import a fence payload.
--
-- If @pGetFdInfo->handleType@ is
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT'
-- and the fence is signaled at the time 'getFenceFdKHR' is called, @pFd@
-- /may/ return the value @-1@ instead of a valid file descriptor.
--
-- Where supported by the operating system, the implementation /must/ set
-- the file descriptor to be closed automatically when an @execve@ system
-- call is made.
--
-- Exporting a file descriptor from a fence /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-fences-importing Importing Fence State>.
--
-- == 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_fence_fd VK_KHR_external_fence_fd>,
-- 'Vulkan.Core10.Handles.Device', 'FenceGetFdInfoKHR'
getFenceFdKHR :: forall io
               . (MonadIO io)
              => -- | @device@ is the logical device that created the fence being exported.
                 --
                 -- #VUID-vkGetFenceFdKHR-device-parameter# @device@ /must/ be a valid
                 -- 'Vulkan.Core10.Handles.Device' handle
                 Device
              -> -- | @pGetFdInfo@ is a pointer to a 'FenceGetFdInfoKHR' structure containing
                 -- parameters of the export operation.
                 --
                 -- #VUID-vkGetFenceFdKHR-pGetFdInfo-parameter# @pGetFdInfo@ /must/ be a
                 -- valid pointer to a valid 'FenceGetFdInfoKHR' structure
                 FenceGetFdInfoKHR
              -> io (("fd" ::: Int32))
getFenceFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> FenceGetFdInfoKHR -> io ("fd" ::: Int32)
getFenceFdKHR Device
device FenceGetFdInfoKHR
getFdInfo = 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 vkGetFenceFdKHRPtr :: FunPtr
  (Ptr Device_T
   -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
   -> ("pFd" ::: Ptr CInt)
   -> IO Result)
vkGetFenceFdKHRPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
      -> ("pFd" ::: Ptr CInt)
      -> IO Result)
pVkGetFenceFdKHR (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
   -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
   -> ("pFd" ::: Ptr CInt)
   -> IO Result)
vkGetFenceFdKHRPtr 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 vkGetFenceFdKHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkGetFenceFdKHR' :: Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetFenceFdKHR' = FunPtr
  (Ptr Device_T
   -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
   -> ("pFd" ::: Ptr CInt)
   -> IO Result)
-> Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
mkVkGetFenceFdKHR FunPtr
  (Ptr Device_T
   -> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
   -> ("pFd" ::: Ptr CInt)
   -> IO Result)
vkGetFenceFdKHRPtr
  "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
pGetFdInfo <- 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 (FenceGetFdInfoKHR
getFdInfo)
  "pFd" ::: Ptr CInt
pPFd <- 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 @CInt Int
4) 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
"vkGetFenceFdKHR" (Ptr Device_T
-> ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> ("pFd" ::: Ptr CInt)
-> IO Result
vkGetFenceFdKHR'
                                                    (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                    "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
pGetFdInfo
                                                    ("pFd" ::: Ptr CInt
pPFd))
  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))
  CInt
pFd <- 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 @CInt "pFd" ::: Ptr CInt
pPFd
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ((coerce :: forall a b. Coercible a b => a -> b
coerce @CInt @Int32 CInt
pFd))


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkImportFenceFdKHR
  :: FunPtr (Ptr Device_T -> Ptr ImportFenceFdInfoKHR -> IO Result) -> Ptr Device_T -> Ptr ImportFenceFdInfoKHR -> IO Result

-- | vkImportFenceFdKHR - Import a fence from a POSIX file descriptor
--
-- = Description
--
-- Importing a fence payload from a file descriptor transfers ownership of
-- the file descriptor from the application to the Vulkan implementation.
-- The application /must/ not perform any operations on the file descriptor
-- after a successful import.
--
-- 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
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_fence_fd VK_KHR_external_fence_fd>,
-- 'Vulkan.Core10.Handles.Device', 'ImportFenceFdInfoKHR'
importFenceFdKHR :: forall io
                  . (MonadIO io)
                 => -- | @device@ is the logical device that created the fence.
                    --
                    -- #VUID-vkImportFenceFdKHR-device-parameter# @device@ /must/ be a valid
                    -- 'Vulkan.Core10.Handles.Device' handle
                    Device
                 -> -- | @pImportFenceFdInfo@ is a pointer to a 'ImportFenceFdInfoKHR' structure
                    -- specifying the fence and import parameters.
                    --
                    -- #VUID-vkImportFenceFdKHR-pImportFenceFdInfo-parameter#
                    -- @pImportFenceFdInfo@ /must/ be a valid pointer to a valid
                    -- 'ImportFenceFdInfoKHR' structure
                    ImportFenceFdInfoKHR
                 -> io ()
importFenceFdKHR :: forall (io :: * -> *).
MonadIO io =>
Device -> ImportFenceFdInfoKHR -> io ()
importFenceFdKHR Device
device ImportFenceFdInfoKHR
importFenceFdInfo = 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 vkImportFenceFdKHRPtr :: FunPtr
  (Ptr Device_T
   -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
   -> IO Result)
vkImportFenceFdKHRPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
      -> IO Result)
pVkImportFenceFdKHR (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
   -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
   -> IO Result)
vkImportFenceFdKHRPtr 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 vkImportFenceFdKHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkImportFenceFdKHR' :: Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO Result
vkImportFenceFdKHR' = FunPtr
  (Ptr Device_T
   -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
   -> IO Result)
-> Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO Result
mkVkImportFenceFdKHR FunPtr
  (Ptr Device_T
   -> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
   -> IO Result)
vkImportFenceFdKHRPtr
  "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
pImportFenceFdInfo <- 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 (ImportFenceFdInfoKHR
importFenceFdInfo)
  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
"vkImportFenceFdKHR" (Ptr Device_T
-> ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO Result
vkImportFenceFdKHR'
                                                       (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                       "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
pImportFenceFdInfo)
  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))


-- | VkImportFenceFdInfoKHR - (None)
--
-- = Description
--
-- The handle types supported by @handleType@ are:
--
-- +------------------------------------------------------------------------------------------------+------------------+---------------------+
-- | Handle Type                                                                                    | Transference     | Permanence          |
-- |                                                                                                |                  | Supported           |
-- +================================================================================================+==================+=====================+
-- | 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT' | Reference        | Temporary,Permanent |
-- +------------------------------------------------------------------------------------------------+------------------+---------------------+
-- | 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT'   | Copy             | Temporary           |
-- +------------------------------------------------------------------------------------------------+------------------+---------------------+
--
-- Handle Types Supported by 'ImportFenceFdInfoKHR'
--
-- == Valid Usage
--
-- -   #VUID-VkImportFenceFdInfoKHR-handleType-01464# @handleType@ /must/
--     be a value included in the
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-fence-handletypes-fd Handle Types Supported by >
--     table
--
-- -   #VUID-VkImportFenceFdInfoKHR-fd-01541# @fd@ /must/ obey any
--     requirements listed for @handleType@ in
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#external-fence-handle-types-compatibility external fence handle types compatibility>
--
-- -   #VUID-VkImportFenceFdInfoKHR-handleType-07306# If @handleType@
--     refers to a handle type with copy payload transference semantics,
--     @flags@ /must/ contain
--     'Vulkan.Core11.Enums.FenceImportFlagBits.FENCE_IMPORT_TEMPORARY_BIT'
--
-- If @handleType@ is
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT',
-- the special value @-1@ for @fd@ is treated like a valid sync file
-- descriptor referring to an object that has already signaled. The import
-- operation will succeed and the 'Vulkan.Core10.Handles.Fence' will have a
-- temporarily imported payload as if a valid file descriptor had been
-- provided.
--
-- Note
--
-- This special behavior for importing an invalid sync file descriptor
-- allows easier interoperability with other system APIs which use the
-- convention that an invalid sync file descriptor represents work that has
-- already completed and does not need to be waited for. It is consistent
-- with the option for implementations to return a @-1@ file descriptor
-- when exporting a
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT'
-- from a 'Vulkan.Core10.Handles.Fence' which is signaled.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImportFenceFdInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR'
--
-- -   #VUID-VkImportFenceFdInfoKHR-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkImportFenceFdInfoKHR-fence-parameter# @fence@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Fence' handle
--
-- -   #VUID-VkImportFenceFdInfoKHR-flags-parameter# @flags@ /must/ be a
--     valid combination of
--     'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlagBits' values
--
-- -   #VUID-VkImportFenceFdInfoKHR-handleType-parameter# @handleType@
--     /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
--     value
--
-- == Host Synchronization
--
-- -   Host access to @fence@ /must/ be externally synchronized
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_fence_fd VK_KHR_external_fence_fd>,
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Fence',
-- 'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'importFenceFdKHR'
data ImportFenceFdInfoKHR = ImportFenceFdInfoKHR
  { -- | @fence@ is the fence into which the payload will be imported.
    ImportFenceFdInfoKHR -> Fence
fence :: Fence
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core11.Enums.FenceImportFlagBits.FenceImportFlagBits' specifying
    -- additional parameters for the fence payload import operation.
    ImportFenceFdInfoKHR -> FenceImportFlags
flags :: FenceImportFlags
  , -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- value specifying the type of @fd@.
    ImportFenceFdInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
  , -- | @fd@ is the external handle to import.
    ImportFenceFdInfoKHR -> "fd" ::: Int32
fd :: Int32
  }
  deriving (Typeable, ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
$c/= :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
== :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
$c== :: ImportFenceFdInfoKHR -> ImportFenceFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportFenceFdInfoKHR)
#endif
deriving instance Show ImportFenceFdInfoKHR

instance ToCStruct ImportFenceFdInfoKHR where
  withCStruct :: forall b.
ImportFenceFdInfoKHR
-> (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b)
-> IO b
withCStruct ImportFenceFdInfoKHR
x ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \"pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ImportFenceFdInfoKHR
x (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b
f "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p)
  pokeCStruct :: forall b.
("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> ImportFenceFdInfoKHR -> IO b -> IO b
pokeCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p ImportFenceFdInfoKHR{"fd" ::: Int32
Fence
FenceImportFlags
ExternalFenceHandleTypeFlagBits
fd :: "fd" ::: Int32
handleType :: ExternalFenceHandleTypeFlagBits
flags :: FenceImportFlags
fence :: Fence
$sel:fd:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> "fd" ::: Int32
$sel:handleType:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> ExternalFenceHandleTypeFlagBits
$sel:flags:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> FenceImportFlags
$sel:fence:ImportFenceFdInfoKHR :: ImportFenceFdInfoKHR -> Fence
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
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 (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (Fence
fence)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr FenceImportFlags)) (FenceImportFlags
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt ("fd" ::: Int32
fd))
    IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
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 (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt)) (("fd" ::: Int32) -> CInt
CInt (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct ImportFenceFdInfoKHR where
  peekCStruct :: ("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR)
-> IO ImportFenceFdInfoKHR
peekCStruct "pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p = do
    Fence
fence <- forall a. Storable a => Ptr a -> IO a
peek @Fence (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence))
    FenceImportFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @FenceImportFlags (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr FenceImportFlags))
    ExternalFenceHandleTypeFlagBits
handleType <- forall a. Storable a => Ptr a -> IO a
peek @ExternalFenceHandleTypeFlagBits (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalFenceHandleTypeFlagBits))
    CInt
fd <- forall a. Storable a => Ptr a -> IO a
peek @CInt (("pImportFenceFdInfo" ::: Ptr ImportFenceFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr CInt))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
             Fence
fence FenceImportFlags
flags ExternalFenceHandleTypeFlagBits
handleType (coerce :: forall a b. Coercible a b => a -> b
coerce @CInt @Int32 CInt
fd)

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

instance Zero ImportFenceFdInfoKHR where
  zero :: ImportFenceFdInfoKHR
zero = Fence
-> FenceImportFlags
-> ExternalFenceHandleTypeFlagBits
-> ("fd" ::: Int32)
-> ImportFenceFdInfoKHR
ImportFenceFdInfoKHR
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkFenceGetFdInfoKHR - Structure describing a POSIX FD fence export
-- operation
--
-- = Description
--
-- The properties of the file descriptor 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-VkFenceGetFdInfoKHR-handleType-01453# @handleType@ /must/ have
--     been included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_fence.ExportFenceCreateInfo'::@handleTypes@
--     when @fence@’s current payload was created
--
-- -   #VUID-VkFenceGetFdInfoKHR-handleType-01454# If @handleType@ refers
--     to a handle type with copy payload transference semantics, @fence@
--     /must/ be signaled, or have an associated
--     <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-fences-signaling fence signal operation>
--     pending execution
--
-- -   #VUID-VkFenceGetFdInfoKHR-fence-01455# @fence@ /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-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-VkFenceGetFdInfoKHR-handleType-01456# @handleType@ /must/ be
--     defined as a POSIX file descriptor handle
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkFenceGetFdInfoKHR-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR'
--
-- -   #VUID-VkFenceGetFdInfoKHR-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkFenceGetFdInfoKHR-fence-parameter# @fence@ /must/ be a valid
--     'Vulkan.Core10.Handles.Fence' handle
--
-- -   #VUID-VkFenceGetFdInfoKHR-handleType-parameter# @handleType@ /must/
--     be a valid
--     'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_external_fence_fd VK_KHR_external_fence_fd>,
-- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Fence',
-- 'Vulkan.Core10.Enums.StructureType.StructureType', 'getFenceFdKHR'
data FenceGetFdInfoKHR = FenceGetFdInfoKHR
  { -- | @fence@ is the fence from which state will be exported.
    FenceGetFdInfoKHR -> Fence
fence :: Fence
  , -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalFenceHandleTypeFlagBits.ExternalFenceHandleTypeFlagBits'
    -- value specifying the type of handle requested.
    FenceGetFdInfoKHR -> ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
  }
  deriving (Typeable, FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
$c/= :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
== :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
$c== :: FenceGetFdInfoKHR -> FenceGetFdInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (FenceGetFdInfoKHR)
#endif
deriving instance Show FenceGetFdInfoKHR

instance ToCStruct FenceGetFdInfoKHR where
  withCStruct :: forall b.
FenceGetFdInfoKHR
-> (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b) -> IO b
withCStruct FenceGetFdInfoKHR
x ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p FenceGetFdInfoKHR
x (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b
f "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p)
  pokeCStruct :: forall b.
("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR)
-> FenceGetFdInfoKHR -> IO b -> IO b
pokeCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p FenceGetFdInfoKHR{Fence
ExternalFenceHandleTypeFlagBits
handleType :: ExternalFenceHandleTypeFlagBits
fence :: Fence
$sel:handleType:FenceGetFdInfoKHR :: FenceGetFdInfoKHR -> ExternalFenceHandleTypeFlagBits
$sel:fence:FenceGetFdInfoKHR :: FenceGetFdInfoKHR -> Fence
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
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 (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (Fence
fence)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceHandleTypeFlagBits)) (ExternalFenceHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. ("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
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 (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Fence)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetFdInfo" ::: Ptr FenceGetFdInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalFenceHandleTypeFlagBits)) (forall a. Zero a => a
zero)
    IO b
f

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

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

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


type KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION"
pattern KHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall a. Integral a => a
$mKHR_EXTERNAL_FENCE_FD_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1


type KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"

-- No documentation found for TopLevel "VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME"
pattern KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mKHR_EXTERNAL_FENCE_FD_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd"