{-# language CPP #-}
-- | = Name
--
-- VK_FUCHSIA_external_semaphore - device extension
--
-- == VK_FUCHSIA_external_semaphore
--
-- [__Name String__]
--     @VK_FUCHSIA_external_semaphore@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     366
--
-- [__Revision__]
--     1
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires Vulkan 1.0
--
--     -   Requires @VK_KHR_external_semaphore_capabilities@
--
--     -   Requires @VK_KHR_external_semaphore@
--
-- [__Contact__]
--
--     -   John Rosasco
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_FUCHSIA_external_semaphore] @rosasco%0A<<Here describe the issue or question you have about the VK_FUCHSIA_external_semaphore extension>> >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2021-03-08
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Craig Stout, Google
--
--     -   John Bauman, Google
--
--     -   John Rosasco, Google
--
-- == Description
--
-- An application using external memory may wish to synchronize access to
-- that memory using semaphores. This extension enables an application to
-- export semaphore payload to and import semaphore payload from Zircon
-- event handles.
--
-- == New Commands
--
-- -   'getSemaphoreZirconHandleFUCHSIA'
--
-- -   'importSemaphoreZirconHandleFUCHSIA'
--
-- == New Structures
--
-- -   'ImportSemaphoreZirconHandleInfoFUCHSIA'
--
-- -   'SemaphoreGetZirconHandleInfoFUCHSIA'
--
-- == New Enum Constants
--
-- -   'FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME'
--
-- -   'FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION'
--
-- -   Extending
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits':
--
--     -   'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA'
--
-- == Issues
--
-- 1) Does the application need to close the Zircon event handle returned
-- by 'getSemaphoreZirconHandleFUCHSIA'?
--
-- __RESOLVED__: Yes, unless it is passed back in to a driver instance to
-- import the semaphore. A successful get call transfers ownership of the
-- Zircon event handle to the application, and a successful import
-- transfers it back to the driver. Destroying the original semaphore
-- object will not close the Zircon event handle nor remove its reference
-- to the underlying semaphore resource associated with it.
--
-- == Version History
--
-- -   Revision 1, 2021-03-08 (John Rosasco)
--
--     -   Initial revision
--
-- == See Also
--
-- 'ImportSemaphoreZirconHandleInfoFUCHSIA',
-- 'SemaphoreGetZirconHandleInfoFUCHSIA',
-- 'getSemaphoreZirconHandleFUCHSIA', 'importSemaphoreZirconHandleFUCHSIA'
--
-- == Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_FUCHSIA_external_semaphore Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_FUCHSIA_external_semaphore  ( getSemaphoreZirconHandleFUCHSIA
                                                        , importSemaphoreZirconHandleFUCHSIA
                                                        , ImportSemaphoreZirconHandleInfoFUCHSIA(..)
                                                        , SemaphoreGetZirconHandleInfoFUCHSIA(..)
                                                        , FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION
                                                        , pattern FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION
                                                        , FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME
                                                        , pattern FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME
                                                        , Zx_handle_t
                                                        ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import 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.NamedType ((:::))
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetSemaphoreZirconHandleFUCHSIA))
import Vulkan.Dynamic (DeviceCmds(pVkImportSemaphoreZirconHandleFUCHSIA))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits (ExternalSemaphoreHandleTypeFlagBits)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Semaphore)
import Vulkan.Core11.Enums.SemaphoreImportFlagBits (SemaphoreImportFlags)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Extensions.VK_FUCHSIA_imagepipe_surface (Zx_handle_t)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.VK_FUCHSIA_imagepipe_surface (Zx_handle_t)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetSemaphoreZirconHandleFUCHSIA
  :: FunPtr (Ptr Device_T -> Ptr SemaphoreGetZirconHandleInfoFUCHSIA -> Ptr Zx_handle_t -> IO Result) -> Ptr Device_T -> Ptr SemaphoreGetZirconHandleInfoFUCHSIA -> Ptr Zx_handle_t -> IO Result

-- | vkGetSemaphoreZirconHandleFUCHSIA - Get a Zircon event handle for a
-- semaphore
--
-- = Description
--
-- Each call to 'getSemaphoreZirconHandleFUCHSIA' /must/ create a Zircon
-- event handle and transfer ownership of it to the application. To avoid
-- leaking resources, the application /must/ release ownership of the
-- Zircon event handle when it is no longer needed.
--
-- Note
--
-- Ownership can be released in many ways. For example, the application can
-- call zx_handle_close() on the file descriptor, or transfer ownership
-- back to Vulkan by using the file descriptor to import a semaphore
-- payload.
--
-- Exporting a Zircon event handle from a semaphore /may/ have side effects
-- depending on the transference of the specified handle type, as described
-- in
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore 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_FUCHSIA_external_semaphore VK_FUCHSIA_external_semaphore>,
-- 'Vulkan.Core10.Handles.Device', 'SemaphoreGetZirconHandleInfoFUCHSIA'
getSemaphoreZirconHandleFUCHSIA :: forall io
                                 . (MonadIO io)
                                => -- | @device@ is the logical device that created the semaphore being
                                   -- exported.
                                   --
                                   -- #VUID-vkGetSemaphoreZirconHandleFUCHSIA-device-parameter# @device@
                                   -- /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                                   Device
                                -> -- | @pGetZirconHandleInfo@ is a pointer to a
                                   -- 'SemaphoreGetZirconHandleInfoFUCHSIA' structure containing parameters of
                                   -- the export operation.
                                   --
                                   -- #VUID-vkGetSemaphoreZirconHandleFUCHSIA-pGetZirconHandleInfo-parameter#
                                   -- @pGetZirconHandleInfo@ /must/ be a valid pointer to a valid
                                   -- 'SemaphoreGetZirconHandleInfoFUCHSIA' structure
                                   SemaphoreGetZirconHandleInfoFUCHSIA
                                -> io (("zirconHandle" ::: Zx_handle_t))
getSemaphoreZirconHandleFUCHSIA :: Device
-> SemaphoreGetZirconHandleInfoFUCHSIA
-> io ("zirconHandle" ::: Zx_handle_t)
getSemaphoreZirconHandleFUCHSIA Device
device SemaphoreGetZirconHandleInfoFUCHSIA
getZirconHandleInfo = IO ("zirconHandle" ::: Zx_handle_t)
-> io ("zirconHandle" ::: Zx_handle_t)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("zirconHandle" ::: Zx_handle_t)
 -> io ("zirconHandle" ::: Zx_handle_t))
-> (ContT
      ("zirconHandle" ::: Zx_handle_t)
      IO
      ("zirconHandle" ::: Zx_handle_t)
    -> IO ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
-> io ("zirconHandle" ::: Zx_handle_t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("zirconHandle" ::: Zx_handle_t)
  IO
  ("zirconHandle" ::: Zx_handle_t)
-> IO ("zirconHandle" ::: Zx_handle_t)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("zirconHandle" ::: Zx_handle_t)
   IO
   ("zirconHandle" ::: Zx_handle_t)
 -> io ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
-> io ("zirconHandle" ::: Zx_handle_t)
forall a b. (a -> b) -> a -> b
$ do
  let vkGetSemaphoreZirconHandleFUCHSIAPtr :: FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO Result)
vkGetSemaphoreZirconHandleFUCHSIAPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pGetZirconHandleInfo"
          ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
      -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
      -> IO Result)
pVkGetSemaphoreZirconHandleFUCHSIA (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT ("zirconHandle" ::: Zx_handle_t) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("zirconHandle" ::: Zx_handle_t) IO ())
-> IO () -> ContT ("zirconHandle" ::: Zx_handle_t) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO Result)
vkGetSemaphoreZirconHandleFUCHSIAPtr FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pGetZirconHandleInfo"
          ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
      -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> 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 String
"" String
"The function pointer for vkGetSemaphoreZirconHandleFUCHSIA is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetSemaphoreZirconHandleFUCHSIA' :: Ptr Device_T
-> ("pGetZirconHandleInfo"
    ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> IO Result
vkGetSemaphoreZirconHandleFUCHSIA' = FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO Result)
-> Ptr Device_T
-> ("pGetZirconHandleInfo"
    ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> IO Result
mkVkGetSemaphoreZirconHandleFUCHSIA FunPtr
  (Ptr Device_T
   -> ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO Result)
vkGetSemaphoreZirconHandleFUCHSIAPtr
  "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
pGetZirconHandleInfo <- ((("pGetZirconHandleInfo"
   ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
  -> IO ("zirconHandle" ::: Zx_handle_t))
 -> IO ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("pGetZirconHandleInfo"
      ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pGetZirconHandleInfo"
    ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
   -> IO ("zirconHandle" ::: Zx_handle_t))
  -> IO ("zirconHandle" ::: Zx_handle_t))
 -> ContT
      ("zirconHandle" ::: Zx_handle_t)
      IO
      ("pGetZirconHandleInfo"
       ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA))
-> ((("pGetZirconHandleInfo"
      ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
     -> IO ("zirconHandle" ::: Zx_handle_t))
    -> IO ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("pGetZirconHandleInfo"
      ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
forall a b. (a -> b) -> a -> b
$ SemaphoreGetZirconHandleInfoFUCHSIA
-> (("pGetZirconHandleInfo"
     ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
    -> IO ("zirconHandle" ::: Zx_handle_t))
-> IO ("zirconHandle" ::: Zx_handle_t)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SemaphoreGetZirconHandleInfoFUCHSIA
getZirconHandleInfo)
  "pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
pPZirconHandle <- ((("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
  -> IO ("zirconHandle" ::: Zx_handle_t))
 -> IO ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
   -> IO ("zirconHandle" ::: Zx_handle_t))
  -> IO ("zirconHandle" ::: Zx_handle_t))
 -> ContT
      ("zirconHandle" ::: Zx_handle_t)
      IO
      ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)))
-> ((("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
     -> IO ("zirconHandle" ::: Zx_handle_t))
    -> IO ("zirconHandle" ::: Zx_handle_t))
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
forall a b. (a -> b) -> a -> b
$ IO ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> (("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
    -> IO ())
-> (("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
    -> IO ("zirconHandle" ::: Zx_handle_t))
-> IO ("zirconHandle" ::: Zx_handle_t)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
forall a. Int -> IO (Ptr a)
callocBytes @Zx_handle_t Int
4) ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT ("zirconHandle" ::: Zx_handle_t) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("zirconHandle" ::: Zx_handle_t) IO Result)
-> IO Result -> ContT ("zirconHandle" ::: Zx_handle_t) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetSemaphoreZirconHandleFUCHSIA" (Ptr Device_T
-> ("pGetZirconHandleInfo"
    ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> IO Result
vkGetSemaphoreZirconHandleFUCHSIA' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
pGetZirconHandleInfo ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
pPZirconHandle))
  IO () -> ContT ("zirconHandle" ::: Zx_handle_t) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("zirconHandle" ::: Zx_handle_t) IO ())
-> IO () -> ContT ("zirconHandle" ::: Zx_handle_t) 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))
  "zirconHandle" ::: Zx_handle_t
pZirconHandle <- IO ("zirconHandle" ::: Zx_handle_t)
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("zirconHandle" ::: Zx_handle_t)
 -> ContT
      ("zirconHandle" ::: Zx_handle_t)
      IO
      ("zirconHandle" ::: Zx_handle_t))
-> IO ("zirconHandle" ::: Zx_handle_t)
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
forall a b. (a -> b) -> a -> b
$ ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> IO ("zirconHandle" ::: Zx_handle_t)
forall a. Storable a => Ptr a -> IO a
peek @Zx_handle_t "pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
pPZirconHandle
  ("zirconHandle" ::: Zx_handle_t)
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("zirconHandle" ::: Zx_handle_t)
 -> ContT
      ("zirconHandle" ::: Zx_handle_t)
      IO
      ("zirconHandle" ::: Zx_handle_t))
-> ("zirconHandle" ::: Zx_handle_t)
-> ContT
     ("zirconHandle" ::: Zx_handle_t)
     IO
     ("zirconHandle" ::: Zx_handle_t)
forall a b. (a -> b) -> a -> b
$ ("zirconHandle" ::: Zx_handle_t
pZirconHandle)


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

-- | vkImportSemaphoreZirconHandleFUCHSIA - Import a semaphore from a Zircon
-- event handle
--
-- = Description
--
-- Importing a semaphore payload from a Zircon event handle transfers
-- ownership of the handle from the application to the Vulkan
-- implementation. The application /must/ not perform any operations on the
-- handle after a successful import.
--
-- Applications /can/ import the same semaphore payload into multiple
-- instances of Vulkan, into the same instance from which it was exported,
-- and multiple times into a given Vulkan instance.
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INVALID_EXTERNAL_HANDLE'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_FUCHSIA_external_semaphore VK_FUCHSIA_external_semaphore>,
-- 'Vulkan.Core10.Handles.Device', 'ImportSemaphoreZirconHandleInfoFUCHSIA'
importSemaphoreZirconHandleFUCHSIA :: forall io
                                    . (MonadIO io)
                                   => -- | @device@ is the logical device that created the semaphore.
                                      --
                                      -- #VUID-vkImportSemaphoreZirconHandleFUCHSIA-device-parameter# @device@
                                      -- /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                                      Device
                                   -> -- | @pImportSemaphoreZirconHandleInfo@ is a pointer to a
                                      -- 'ImportSemaphoreZirconHandleInfoFUCHSIA' structure specifying the
                                      -- semaphore and import parameters.
                                      --
                                      -- #VUID-vkImportSemaphoreZirconHandleFUCHSIA-pImportSemaphoreZirconHandleInfo-parameter#
                                      -- @pImportSemaphoreZirconHandleInfo@ /must/ be a valid pointer to a valid
                                      -- 'ImportSemaphoreZirconHandleInfoFUCHSIA' structure
                                      ImportSemaphoreZirconHandleInfoFUCHSIA
                                   -> io ()
importSemaphoreZirconHandleFUCHSIA :: Device -> ImportSemaphoreZirconHandleInfoFUCHSIA -> io ()
importSemaphoreZirconHandleFUCHSIA Device
device ImportSemaphoreZirconHandleInfoFUCHSIA
importSemaphoreZirconHandleInfo = 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 vkImportSemaphoreZirconHandleFUCHSIAPtr :: FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO Result)
vkImportSemaphoreZirconHandleFUCHSIAPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pImportSemaphoreZirconHandleInfo"
          ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
      -> IO Result)
pVkImportSemaphoreZirconHandleFUCHSIA (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  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
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO Result)
vkImportSemaphoreZirconHandleFUCHSIAPtr FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pImportSemaphoreZirconHandleInfo"
          ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> 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 String
"" String
"The function pointer for vkImportSemaphoreZirconHandleFUCHSIA is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkImportSemaphoreZirconHandleFUCHSIA' :: Ptr Device_T
-> ("pImportSemaphoreZirconHandleInfo"
    ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO Result
vkImportSemaphoreZirconHandleFUCHSIA' = FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO Result)
-> Ptr Device_T
-> ("pImportSemaphoreZirconHandleInfo"
    ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO Result
mkVkImportSemaphoreZirconHandleFUCHSIA FunPtr
  (Ptr Device_T
   -> ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO Result)
vkImportSemaphoreZirconHandleFUCHSIAPtr
  "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
pImportSemaphoreZirconHandleInfo <- ((("pImportSemaphoreZirconHandleInfo"
   ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
  -> IO ())
 -> IO ())
-> ContT
     ()
     IO
     ("pImportSemaphoreZirconHandleInfo"
      ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pImportSemaphoreZirconHandleInfo"
    ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
   -> IO ())
  -> IO ())
 -> ContT
      ()
      IO
      ("pImportSemaphoreZirconHandleInfo"
       ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA))
-> ((("pImportSemaphoreZirconHandleInfo"
      ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
     -> IO ())
    -> IO ())
-> ContT
     ()
     IO
     ("pImportSemaphoreZirconHandleInfo"
      ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
forall a b. (a -> b) -> a -> b
$ ImportSemaphoreZirconHandleInfoFUCHSIA
-> (("pImportSemaphoreZirconHandleInfo"
     ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
    -> IO ())
-> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (ImportSemaphoreZirconHandleInfoFUCHSIA
importSemaphoreZirconHandleInfo)
  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 String
"vkImportSemaphoreZirconHandleFUCHSIA" (Ptr Device_T
-> ("pImportSemaphoreZirconHandleInfo"
    ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO Result
vkImportSemaphoreZirconHandleFUCHSIA' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
pImportSemaphoreZirconHandleInfo)
  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))


-- | VkImportSemaphoreZirconHandleInfoFUCHSIA - Structure specifying Zircon
-- event handle to import to a semaphore
--
-- = Description
--
-- The handle types supported by @handleType@ are:
--
-- +-------------------------------------------------------------------------------------------------------------------+------------------+---------------------+
-- | Handle Type                                                                                                       | Transference     | Permanence          |
-- |                                                                                                                   |                  | Supported           |
-- +===================================================================================================================+==================+=====================+
-- | 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA' | Reference        | Temporary,Permanent |
-- +-------------------------------------------------------------------------------------------------------------------+------------------+---------------------+
--
-- Handle Types Supported by 'ImportSemaphoreZirconHandleInfoFUCHSIA'
--
-- == Valid Usage
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-handleType-04765#
--     @handleType@ /must/ be a value included in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphore-handletypes-fuchsia Handle Types Supported by >
--     table
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-zirconHandle-04766#
--     @zirconHandle@ /must/ obey any requirements listed for @handleType@
--     in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-semaphore-handle-types-compatibility external semaphore handle types compatibility>
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-zirconHandle-04767#
--     @zirconHandle@ /must/ have @ZX_RIGHTS_BASIC@ and @ZX_RIGHTS_SIGNAL@
--     rights
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-semaphoreType-04768#
--     The
--     'Vulkan.Core12.Promoted_From_VK_KHR_timeline_semaphore.SemaphoreTypeCreateInfo'::@semaphoreType@
--     field /must/ not be
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_TIMELINE'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA'
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-pNext-pNext# @pNext@
--     /must/ be @NULL@
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-semaphore-parameter#
--     @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-flags-parameter#
--     @flags@ /must/ be a valid combination of
--     'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlagBits'
--     values
--
-- -   #VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-handleType-parameter#
--     @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
--     value
--
-- == Host Synchronization
--
-- -   Host access to @semaphore@ /must/ be externally synchronized
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_FUCHSIA_external_semaphore VK_FUCHSIA_external_semaphore>,
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'importSemaphoreZirconHandleFUCHSIA'
data ImportSemaphoreZirconHandleInfoFUCHSIA = ImportSemaphoreZirconHandleInfoFUCHSIA
  { -- | @semaphore@ is the semaphore into which the payload will be imported.
    ImportSemaphoreZirconHandleInfoFUCHSIA -> Semaphore
semaphore :: Semaphore
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core11.Enums.SemaphoreImportFlagBits.SemaphoreImportFlagBits'
    -- specifying additional parameters for the semaphore payload import
    -- operation.
    ImportSemaphoreZirconHandleInfoFUCHSIA -> SemaphoreImportFlags
flags :: SemaphoreImportFlags
  , -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
    -- value specifying the type of @zirconHandle@.
    ImportSemaphoreZirconHandleInfoFUCHSIA
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
  , -- | @zirconHandle@ is the external handle to import.
    ImportSemaphoreZirconHandleInfoFUCHSIA
-> "zirconHandle" ::: Zx_handle_t
zirconHandle :: Zx_handle_t
  }
  deriving (Typeable, ImportSemaphoreZirconHandleInfoFUCHSIA
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool
(ImportSemaphoreZirconHandleInfoFUCHSIA
 -> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool)
-> (ImportSemaphoreZirconHandleInfoFUCHSIA
    -> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool)
-> Eq ImportSemaphoreZirconHandleInfoFUCHSIA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool
$c/= :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool
== :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool
$c== :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportSemaphoreZirconHandleInfoFUCHSIA)
#endif
deriving instance Show ImportSemaphoreZirconHandleInfoFUCHSIA

instance ToCStruct ImportSemaphoreZirconHandleInfoFUCHSIA where
  withCStruct :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> (("pImportSemaphoreZirconHandleInfo"
     ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
withCStruct ImportSemaphoreZirconHandleInfoFUCHSIA
x ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO b
f = Int
-> (("pImportSemaphoreZirconHandleInfo"
     ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((("pImportSemaphoreZirconHandleInfo"
   ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
  -> IO b)
 -> IO b)
-> (("pImportSemaphoreZirconHandleInfo"
     ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \"pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p -> ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ImportSemaphoreZirconHandleInfoFUCHSIA
x (("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO b
f "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p)
  pokeCStruct :: ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> ImportSemaphoreZirconHandleInfoFUCHSIA -> IO b -> IO b
pokeCStruct "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ImportSemaphoreZirconHandleInfoFUCHSIA{"zirconHandle" ::: Zx_handle_t
Semaphore
SemaphoreImportFlags
ExternalSemaphoreHandleTypeFlagBits
zirconHandle :: "zirconHandle" ::: Zx_handle_t
handleType :: ExternalSemaphoreHandleTypeFlagBits
flags :: SemaphoreImportFlags
semaphore :: Semaphore
$sel:zirconHandle:ImportSemaphoreZirconHandleInfoFUCHSIA :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> "zirconHandle" ::: Zx_handle_t
$sel:handleType:ImportSemaphoreZirconHandleInfoFUCHSIA :: ImportSemaphoreZirconHandleInfoFUCHSIA
-> ExternalSemaphoreHandleTypeFlagBits
$sel:flags:ImportSemaphoreZirconHandleInfoFUCHSIA :: ImportSemaphoreZirconHandleInfoFUCHSIA -> SemaphoreImportFlags
$sel:semaphore:ImportSemaphoreZirconHandleInfoFUCHSIA :: ImportSemaphoreZirconHandleInfoFUCHSIA -> Semaphore
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
    Ptr SemaphoreImportFlags -> SemaphoreImportFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr SemaphoreImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SemaphoreImportFlags)) (SemaphoreImportFlags
flags)
    Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
    ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> ("zirconHandle" ::: Zx_handle_t) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> "pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Zx_handle_t)) ("zirconHandle" ::: Zx_handle_t
zirconHandle)
    IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO b -> IO b
pokeZeroCStruct "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
    Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero)
    ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> ("zirconHandle" ::: Zx_handle_t) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> "pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Zx_handle_t)) ("zirconHandle" ::: Zx_handle_t
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImportSemaphoreZirconHandleInfoFUCHSIA where
  peekCStruct :: ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> IO ImportSemaphoreZirconHandleInfoFUCHSIA
peekCStruct "pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p = do
    Semaphore
semaphore <- Ptr Semaphore -> IO Semaphore
forall a. Storable a => Ptr a -> IO a
peek @Semaphore (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore))
    SemaphoreImportFlags
flags <- Ptr SemaphoreImportFlags -> IO SemaphoreImportFlags
forall a. Storable a => Ptr a -> IO a
peek @SemaphoreImportFlags (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr SemaphoreImportFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SemaphoreImportFlags))
    ExternalSemaphoreHandleTypeFlagBits
handleType <- Ptr ExternalSemaphoreHandleTypeFlagBits
-> IO ExternalSemaphoreHandleTypeFlagBits
forall a. Storable a => Ptr a -> IO a
peek @ExternalSemaphoreHandleTypeFlagBits (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr ExternalSemaphoreHandleTypeFlagBits))
    "zirconHandle" ::: Zx_handle_t
zirconHandle <- ("pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t))
-> IO ("zirconHandle" ::: Zx_handle_t)
forall a. Storable a => Ptr a -> IO a
peek @Zx_handle_t (("pImportSemaphoreZirconHandleInfo"
::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA
p ("pImportSemaphoreZirconHandleInfo"
 ::: Ptr ImportSemaphoreZirconHandleInfoFUCHSIA)
-> Int -> "pZirconHandle" ::: Ptr ("zirconHandle" ::: Zx_handle_t)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Zx_handle_t))
    ImportSemaphoreZirconHandleInfoFUCHSIA
-> IO ImportSemaphoreZirconHandleInfoFUCHSIA
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportSemaphoreZirconHandleInfoFUCHSIA
 -> IO ImportSemaphoreZirconHandleInfoFUCHSIA)
-> ImportSemaphoreZirconHandleInfoFUCHSIA
-> IO ImportSemaphoreZirconHandleInfoFUCHSIA
forall a b. (a -> b) -> a -> b
$ Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> ("zirconHandle" ::: Zx_handle_t)
-> ImportSemaphoreZirconHandleInfoFUCHSIA
ImportSemaphoreZirconHandleInfoFUCHSIA
             Semaphore
semaphore SemaphoreImportFlags
flags ExternalSemaphoreHandleTypeFlagBits
handleType "zirconHandle" ::: Zx_handle_t
zirconHandle

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

instance Zero ImportSemaphoreZirconHandleInfoFUCHSIA where
  zero :: ImportSemaphoreZirconHandleInfoFUCHSIA
zero = Semaphore
-> SemaphoreImportFlags
-> ExternalSemaphoreHandleTypeFlagBits
-> ("zirconHandle" ::: Zx_handle_t)
-> ImportSemaphoreZirconHandleInfoFUCHSIA
ImportSemaphoreZirconHandleInfoFUCHSIA
           Semaphore
forall a. Zero a => a
zero
           SemaphoreImportFlags
forall a. Zero a => a
zero
           ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero
           "zirconHandle" ::: Zx_handle_t
forall a. Zero a => a
zero


-- | VkSemaphoreGetZirconHandleInfoFUCHSIA - Structure describing a Zircon
-- event handle semaphore export operation
--
-- = Description
--
-- The properties of the Zircon event handle returned depend on the value
-- of @handleType@. See
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
-- for a description of the properties of the defined external semaphore
-- handle types.
--
-- == Valid Usage
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04758#
--     @handleType@ /must/ have been included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore.ExportSemaphoreCreateInfo'::@handleTypes@
--     when @semaphore@’s current payload was created
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-semaphore-04759#
--     @semaphore@ /must/ not currently have its payload replaced by an
--     imported payload as described below in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>
--     unless that imported payload’s handle type was included in
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_semaphore_capabilities.ExternalSemaphoreProperties'::@exportFromImportedHandleTypes@
--     for @handleType@
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04760# If
--     @handleType@ refers to a handle type with copy payload transference
--     semantics, as defined below in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-importing Importing Semaphore Payloads>,
--     there /must/ be no queue waiting on @semaphore@
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04761# If
--     @handleType@ refers to a handle type with copy payload transference
--     semantics, @semaphore@ /must/ be signaled, or have an associated
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-semaphores-signaling semaphore signal operation>
--     pending execution
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04762#
--     @handleType@ /must/ be defined as a Zircon event handle
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-semaphore-04763#
--     @semaphore@ /must/ have been created with a
--     'Vulkan.Core12.Enums.SemaphoreType.SemaphoreType' of
--     'Vulkan.Core12.Enums.SemaphoreType.SEMAPHORE_TYPE_BINARY'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA'
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-pNext-pNext# @pNext@
--     /must/ be @NULL@
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-semaphore-parameter#
--     @semaphore@ /must/ be a valid 'Vulkan.Core10.Handles.Semaphore'
--     handle
--
-- -   #VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-parameter#
--     @handleType@ /must/ be a valid
--     'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
--     value
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_FUCHSIA_external_semaphore VK_FUCHSIA_external_semaphore>,
-- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits',
-- 'Vulkan.Core10.Handles.Semaphore',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getSemaphoreZirconHandleFUCHSIA'
data SemaphoreGetZirconHandleInfoFUCHSIA = SemaphoreGetZirconHandleInfoFUCHSIA
  { -- | @semaphore@ is the semaphore from which state will be exported.
    SemaphoreGetZirconHandleInfoFUCHSIA -> Semaphore
semaphore :: Semaphore
  , -- | @handleType@ is a
    -- 'Vulkan.Core11.Enums.ExternalSemaphoreHandleTypeFlagBits.ExternalSemaphoreHandleTypeFlagBits'
    -- value specifying the type of handle requested.
    SemaphoreGetZirconHandleInfoFUCHSIA
-> ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
  }
  deriving (Typeable, SemaphoreGetZirconHandleInfoFUCHSIA
-> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool
(SemaphoreGetZirconHandleInfoFUCHSIA
 -> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool)
-> (SemaphoreGetZirconHandleInfoFUCHSIA
    -> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool)
-> Eq SemaphoreGetZirconHandleInfoFUCHSIA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SemaphoreGetZirconHandleInfoFUCHSIA
-> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool
$c/= :: SemaphoreGetZirconHandleInfoFUCHSIA
-> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool
== :: SemaphoreGetZirconHandleInfoFUCHSIA
-> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool
$c== :: SemaphoreGetZirconHandleInfoFUCHSIA
-> SemaphoreGetZirconHandleInfoFUCHSIA -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SemaphoreGetZirconHandleInfoFUCHSIA)
#endif
deriving instance Show SemaphoreGetZirconHandleInfoFUCHSIA

instance ToCStruct SemaphoreGetZirconHandleInfoFUCHSIA where
  withCStruct :: SemaphoreGetZirconHandleInfoFUCHSIA
-> (("pGetZirconHandleInfo"
     ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
withCStruct SemaphoreGetZirconHandleInfoFUCHSIA
x ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> IO b
f = Int
-> (("pGetZirconHandleInfo"
     ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((("pGetZirconHandleInfo"
   ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
  -> IO b)
 -> IO b)
-> (("pGetZirconHandleInfo"
     ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \"pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p -> ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> SemaphoreGetZirconHandleInfoFUCHSIA -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p SemaphoreGetZirconHandleInfoFUCHSIA
x (("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> IO b
f "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p)
  pokeCStruct :: ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> SemaphoreGetZirconHandleInfoFUCHSIA -> IO b -> IO b
pokeCStruct "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p SemaphoreGetZirconHandleInfoFUCHSIA{Semaphore
ExternalSemaphoreHandleTypeFlagBits
handleType :: ExternalSemaphoreHandleTypeFlagBits
semaphore :: Semaphore
$sel:handleType:SemaphoreGetZirconHandleInfoFUCHSIA :: SemaphoreGetZirconHandleInfoFUCHSIA
-> ExternalSemaphoreHandleTypeFlagBits
$sel:semaphore:SemaphoreGetZirconHandleInfoFUCHSIA :: SemaphoreGetZirconHandleInfoFUCHSIA -> Semaphore
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
semaphore)
    Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
handleType)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> IO b -> IO b
pokeZeroCStruct "pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Semaphore -> Semaphore -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr Semaphore
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Semaphore)) (Semaphore
forall a. Zero a => a
zero)
    Ptr ExternalSemaphoreHandleTypeFlagBits
-> ExternalSemaphoreHandleTypeFlagBits -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pGetZirconHandleInfo" ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA
p ("pGetZirconHandleInfo"
 ::: Ptr SemaphoreGetZirconHandleInfoFUCHSIA)
-> Int -> Ptr ExternalSemaphoreHandleTypeFlagBits
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr ExternalSemaphoreHandleTypeFlagBits)) (ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero)
    IO b
f

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

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

instance Zero SemaphoreGetZirconHandleInfoFUCHSIA where
  zero :: SemaphoreGetZirconHandleInfoFUCHSIA
zero = Semaphore
-> ExternalSemaphoreHandleTypeFlagBits
-> SemaphoreGetZirconHandleInfoFUCHSIA
SemaphoreGetZirconHandleInfoFUCHSIA
           Semaphore
forall a. Zero a => a
zero
           ExternalSemaphoreHandleTypeFlagBits
forall a. Zero a => a
zero


type FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION"
pattern FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION :: forall a . Integral a => a
pattern $bFUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION :: a
$mFUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION = 1


type FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME = "VK_FUCHSIA_external_semaphore"

-- No documentation found for TopLevel "VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME"
pattern FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bFUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME :: a
$mFUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME = "VK_FUCHSIA_external_semaphore"