{-# language CPP #-}
-- | = Name
--
-- VK_NV_external_compute_queue - device extension
--
-- = VK_NV_external_compute_queue
--
-- [__Name String__]
--     @VK_NV_external_compute_queue@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     557
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     None
--
-- [__Contact__]
--
--     -   Chris Lentini
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_NV_external_compute_queue] @clentini%0A*Here describe the issue or question you have about the VK_NV_external_compute_queue extension* >
--
-- [__Extension Proposal__]
--     <https://github.com/KhronosGroup/Vulkan-Docs/tree/main/proposals/VK_NV_external_compute_queue.adoc VK_NV_external_compute_queue>
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2025-03-24
--
-- [__Contributors__]
--
--     -   Chris Lentini, NVIDIA
--
--     -   Eric Werness, NVIDIA
--
--     -   James Jones, NVIDIA
--
--     -   Jeff Juliano, NVIDIA
--
--     -   Liam Middlebrook, NVIDIA
--
--     -   Lionel Duc, NVIDIA
--
-- == Description
--
-- This extension gives applications the ability to join compatible
-- external compute APIs to a 'Vulkan.Core10.Handles.Device'. In this way,
-- the extension allows an application to achieve simultaneous execution
-- between work submitted from these compatible external APIs and work that
-- has been submitted through the Vulkan API.
--
-- At device creation time, an application /must/ supply a
-- 'ExternalComputeQueueDeviceCreateInfoNV'. This communicates to the
-- implementation the maximum number of external queues that the
-- application /can/ create at once. This information /may/ be used by the
-- implementation to aid in decisions made during device creation.
--
-- After device creation, the function 'createExternalComputeQueueNV' is
-- used by an application to create a new
-- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV' object. The
-- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV' object holds
-- information and reserves resources necessary for a compatible external
-- API to be able to join a 'Vulkan.Core10.Handles.Device'. This
-- information can be queried through the 'getExternalComputeQueueDataNV'
-- function, returning an opaque blob of data which can be passed to
-- compatible external APIs. The application /must/ finally call
-- 'destroyExternalComputeQueueNV' when it is done in order to release the
-- reserved resources.
--
-- This extension introduces a new properties structure,
-- 'PhysicalDeviceExternalComputeQueuePropertiesNV', which can be queried
-- through
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2'.
-- The structure provides information on functional limits to the extension
-- as well as a way of querying the size of the application allocated
-- memory which /must/ be passed to the 'getExternalComputeQueueDataNV'
-- function.
--
-- When creating a 'Vulkan.Extensions.Handles.ExternalComputeQueueNV'
-- through 'createExternalComputeQueueNV', the
-- 'ExternalComputeQueueCreateInfoNV' structure requires an application to
-- supply a 'Vulkan.Core10.Handles.Queue' to aid in external compute queue
-- creation. The supplied 'Vulkan.Core10.Handles.Queue' is a strong
-- scheduling hint about which queue it expects to submit graphics
-- workloads to and with which it expects simultaneous execution of compute
-- workloads submitted through the external API.
--
-- == New Object Types
--
-- -   'Vulkan.Extensions.Handles.ExternalComputeQueueNV'
--
-- == New Commands
--
-- -   'createExternalComputeQueueNV'
--
-- -   'destroyExternalComputeQueueNV'
--
-- -   'getExternalComputeQueueDataNV'
--
-- == New Structures
--
-- -   'ExternalComputeQueueCreateInfoNV'
--
-- -   'ExternalComputeQueueDataParamsNV'
--
-- -   Extending 'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'ExternalComputeQueueDeviceCreateInfoNV'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceExternalComputeQueuePropertiesNV'
--
-- == New Enum Constants
--
-- -   'NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME'
--
-- -   'NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.ObjectType.ObjectType':
--
--     -   'Vulkan.Core10.Enums.ObjectType.OBJECT_TYPE_EXTERNAL_COMPUTE_QUEUE_NV'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_CREATE_INFO_NV'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DATA_PARAMS_NV'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DEVICE_CREATE_INFO_NV'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_COMPUTE_QUEUE_PROPERTIES_NV'
--
-- While the external queue is now a part of a
-- 'Vulkan.Core10.Handles.Device', idling the device through
-- 'Vulkan.Core10.Queue.deviceWaitIdle' does not wait for the external
-- queue. Draining the work on an external queue /must/ be done through its
-- own external API. External queues /must/ be idled before destroying the
-- associated 'Vulkan.Core10.Handles.Device'.
--
-- In general, synchronization and resource sharing between the external
-- API and Vulkan must still be accomplished via existing cross-API interop
-- mechanisms.
--
-- == Version History
--
-- -   Revision 1, 2024-05-20 (Chris Lentini)
--
--     -   Internal revisions
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_NV_external_compute_queue Vulkan Specification>.
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_NV_external_compute_queue  ( createExternalComputeQueueNV
                                                       , withExternalComputeQueueNV
                                                       , destroyExternalComputeQueueNV
                                                       , getExternalComputeQueueDataNV
                                                       , ExternalComputeQueueDeviceCreateInfoNV(..)
                                                       , ExternalComputeQueueCreateInfoNV(..)
                                                       , ExternalComputeQueueDataParamsNV(..)
                                                       , PhysicalDeviceExternalComputeQueuePropertiesNV(..)
                                                       , NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION
                                                       , pattern NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION
                                                       , NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME
                                                       , pattern NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME
                                                       , ExternalComputeQueueNV(..)
                                                       ) 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.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkCreateExternalComputeQueueNV))
import Vulkan.Dynamic (DeviceCmds(pVkDestroyExternalComputeQueueNV))
import Vulkan.Dynamic (DeviceCmds(pVkGetExternalComputeQueueDataNV))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Extensions.Handles (ExternalComputeQueueNV)
import Vulkan.Extensions.Handles (ExternalComputeQueueNV(..))
import Vulkan.Extensions.Handles (ExternalComputeQueueNV(ExternalComputeQueueNV))
import Vulkan.Extensions.Handles (ExternalComputeQueueNV_T)
import Vulkan.Core10.Handles (Queue_T)
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_EXTERNAL_COMPUTE_QUEUE_CREATE_INFO_NV))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DATA_PARAMS_NV))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DEVICE_CREATE_INFO_NV))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_COMPUTE_QUEUE_PROPERTIES_NV))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.Handles (ExternalComputeQueueNV(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateExternalComputeQueueNV
  :: FunPtr (Ptr Device_T -> Ptr ExternalComputeQueueCreateInfoNV -> Ptr AllocationCallbacks -> Ptr (Ptr ExternalComputeQueueNV_T) -> IO Result) -> Ptr Device_T -> Ptr ExternalComputeQueueCreateInfoNV -> Ptr AllocationCallbacks -> Ptr (Ptr ExternalComputeQueueNV_T) -> IO Result

-- | vkCreateExternalComputeQueueNV - Create an external compute queue for
-- use by a compatible external API.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateExternalComputeQueueNV-device-parameter# @device@
--     /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkCreateExternalComputeQueueNV-pCreateInfo-parameter#
--     @pCreateInfo@ /must/ be a valid pointer to a valid
--     'ExternalComputeQueueCreateInfoNV' structure
--
-- -   #VUID-vkCreateExternalComputeQueueNV-pAllocator-parameter# If
--     @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid pointer
--     to a valid 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks'
--     structure
--
-- -   #VUID-vkCreateExternalComputeQueueNV-pExternalQueue-parameter#
--     @pExternalQueue@ /must/ be a valid pointer to a
--     'Vulkan.Extensions.Handles.ExternalComputeQueueNV' handle
--
-- -   #VUID-vkCreateExternalComputeQueueNV-device-queuecount# The device
--     /must/ have been created with at least @1@ queue
--
-- == 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_TOO_MANY_OBJECTS'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_UNKNOWN'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_VALIDATION_FAILED'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.Device', 'ExternalComputeQueueCreateInfoNV',
-- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV'
createExternalComputeQueueNV :: forall io
                              . (MonadIO io)
                             => -- | @device@ is the VkDevice that the external queue will be a part of.
                                Device
                             -> -- | @pCreateInfo@ is a pointer to a 'ExternalComputeQueueCreateInfoNV'
                                -- structure specifying configuration info for creating the external queue.
                                ExternalComputeQueueCreateInfoNV
                             -> -- | @pAllocator@ controls host memory allocation as described in the
                                -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-allocation Memory Allocation>
                                -- chapter.
                                ("allocator" ::: Maybe AllocationCallbacks)
                             -> io (("externalQueue" ::: ExternalComputeQueueNV))
createExternalComputeQueueNV :: forall (io :: * -> *).
MonadIO io =>
Device
-> ExternalComputeQueueCreateInfoNV
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
createExternalComputeQueueNV Device
device
                               ExternalComputeQueueCreateInfoNV
createInfo
                               "allocator" ::: Maybe AllocationCallbacks
allocator = IO ("externalQueue" ::: ExternalComputeQueueNV)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("externalQueue" ::: ExternalComputeQueueNV)
 -> io ("externalQueue" ::: ExternalComputeQueueNV))
-> (ContT
      ("externalQueue" ::: ExternalComputeQueueNV)
      IO
      ("externalQueue" ::: ExternalComputeQueueNV)
    -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     ("externalQueue" ::: ExternalComputeQueueNV)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("externalQueue" ::: ExternalComputeQueueNV)
  IO
  ("externalQueue" ::: ExternalComputeQueueNV)
-> IO ("externalQueue" ::: ExternalComputeQueueNV)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("externalQueue" ::: ExternalComputeQueueNV)
   IO
   ("externalQueue" ::: ExternalComputeQueueNV)
 -> io ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     ("externalQueue" ::: ExternalComputeQueueNV)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
forall a b. (a -> b) -> a -> b
$ do
  let cmds :: DeviceCmds
cmds = case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds
  let vkCreateExternalComputeQueueNVPtr :: FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
vkCreateExternalComputeQueueNVPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Ptr ExternalComputeQueueCreateInfoNV
      -> Ptr AllocationCallbacks
      -> Ptr (Ptr ExternalComputeQueueNV_T)
      -> IO Result)
pVkCreateExternalComputeQueueNV DeviceCmds
cmds
  IO () -> ContT ("externalQueue" ::: ExternalComputeQueueNV) IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT ("externalQueue" ::: ExternalComputeQueueNV) m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("externalQueue" ::: ExternalComputeQueueNV) IO ())
-> IO ()
-> ContT ("externalQueue" ::: ExternalComputeQueueNV) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
vkCreateExternalComputeQueueNVPtr FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> Ptr ExternalComputeQueueCreateInfoNV
      -> Ptr AllocationCallbacks
      -> Ptr (Ptr ExternalComputeQueueNV_T)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 vkCreateExternalComputeQueueNV is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCreateExternalComputeQueueNV' :: Ptr Device_T
-> Ptr ExternalComputeQueueCreateInfoNV
-> Ptr AllocationCallbacks
-> Ptr (Ptr ExternalComputeQueueNV_T)
-> IO Result
vkCreateExternalComputeQueueNV' = FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
-> Ptr Device_T
-> Ptr ExternalComputeQueueCreateInfoNV
-> Ptr AllocationCallbacks
-> Ptr (Ptr ExternalComputeQueueNV_T)
-> IO Result
mkVkCreateExternalComputeQueueNV FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueCreateInfoNV
   -> Ptr AllocationCallbacks
   -> Ptr (Ptr ExternalComputeQueueNV_T)
   -> IO Result)
vkCreateExternalComputeQueueNVPtr
  pCreateInfo <- ((Ptr ExternalComputeQueueCreateInfoNV
  -> IO ("externalQueue" ::: ExternalComputeQueueNV))
 -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     (Ptr ExternalComputeQueueCreateInfoNV)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr ExternalComputeQueueCreateInfoNV
   -> IO ("externalQueue" ::: ExternalComputeQueueNV))
  -> IO ("externalQueue" ::: ExternalComputeQueueNV))
 -> ContT
      ("externalQueue" ::: ExternalComputeQueueNV)
      IO
      (Ptr ExternalComputeQueueCreateInfoNV))
-> ((Ptr ExternalComputeQueueCreateInfoNV
     -> IO ("externalQueue" ::: ExternalComputeQueueNV))
    -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     (Ptr ExternalComputeQueueCreateInfoNV)
forall a b. (a -> b) -> a -> b
$ ExternalComputeQueueCreateInfoNV
-> (Ptr ExternalComputeQueueCreateInfoNV
    -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> IO ("externalQueue" ::: ExternalComputeQueueNV)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
ExternalComputeQueueCreateInfoNV
-> (Ptr ExternalComputeQueueCreateInfoNV -> IO b) -> IO b
withCStruct (ExternalComputeQueueCreateInfoNV
createInfo)
  pAllocator <- case (allocator) of
    "allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     (Ptr AllocationCallbacks)
forall a.
a -> ContT ("externalQueue" ::: ExternalComputeQueueNV) IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks
  -> IO ("externalQueue" ::: ExternalComputeQueueNV))
 -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks
   -> IO ("externalQueue" ::: ExternalComputeQueueNV))
  -> IO ("externalQueue" ::: ExternalComputeQueueNV))
 -> ContT
      ("externalQueue" ::: ExternalComputeQueueNV)
      IO
      (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks
     -> IO ("externalQueue" ::: ExternalComputeQueueNV))
    -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> ContT
     ("externalQueue" ::: ExternalComputeQueueNV)
     IO
     (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (Ptr AllocationCallbacks
    -> IO ("externalQueue" ::: ExternalComputeQueueNV))
-> IO ("externalQueue" ::: ExternalComputeQueueNV)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  pPExternalQueue <- ContT $ bracket (callocBytes @(Ptr ExternalComputeQueueNV_T) 8) free
  r <- lift $ traceAroundEvent "vkCreateExternalComputeQueueNV" (vkCreateExternalComputeQueueNV'
                                                                   (deviceHandle (device))
                                                                   pCreateInfo
                                                                   pAllocator
                                                                   (pPExternalQueue))
  lift $ when (r < SUCCESS) (throwIO (VulkanException r))
  pExternalQueue <- lift $ peek @(Ptr ExternalComputeQueueNV_T) pPExternalQueue
  pure $ (((\Ptr ExternalComputeQueueNV_T
h -> Ptr ExternalComputeQueueNV_T
-> DeviceCmds -> "externalQueue" ::: ExternalComputeQueueNV
ExternalComputeQueueNV Ptr ExternalComputeQueueNV_T
h DeviceCmds
cmds ) pExternalQueue))

-- | A convenience wrapper to make a compatible pair of calls to
-- 'createExternalComputeQueueNV' and 'destroyExternalComputeQueueNV'
--
-- To ensure that 'destroyExternalComputeQueueNV' is always called: pass
-- 'Control.Exception.bracket' (or the allocate function from your
-- favourite resource management library) as the last argument.
-- To just extract the pair pass '(,)' as the last argument.
--
withExternalComputeQueueNV :: forall io r . MonadIO io => Device -> ExternalComputeQueueCreateInfoNV -> Maybe AllocationCallbacks -> (io ExternalComputeQueueNV -> (ExternalComputeQueueNV -> io ()) -> r) -> r
withExternalComputeQueueNV :: forall (io :: * -> *) r.
MonadIO io =>
Device
-> ExternalComputeQueueCreateInfoNV
-> ("allocator" ::: Maybe AllocationCallbacks)
-> (io ("externalQueue" ::: ExternalComputeQueueNV)
    -> (("externalQueue" ::: ExternalComputeQueueNV) -> io ()) -> r)
-> r
withExternalComputeQueueNV Device
device ExternalComputeQueueCreateInfoNV
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator io ("externalQueue" ::: ExternalComputeQueueNV)
-> (("externalQueue" ::: ExternalComputeQueueNV) -> io ()) -> r
b =
  io ("externalQueue" ::: ExternalComputeQueueNV)
-> (("externalQueue" ::: ExternalComputeQueueNV) -> io ()) -> r
b (Device
-> ExternalComputeQueueCreateInfoNV
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
forall (io :: * -> *).
MonadIO io =>
Device
-> ExternalComputeQueueCreateInfoNV
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ("externalQueue" ::: ExternalComputeQueueNV)
createExternalComputeQueueNV Device
device ExternalComputeQueueCreateInfoNV
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator)
    (\("externalQueue" ::: ExternalComputeQueueNV
o0) -> Device
-> ("externalQueue" ::: ExternalComputeQueueNV)
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
forall (io :: * -> *).
MonadIO io =>
Device
-> ("externalQueue" ::: ExternalComputeQueueNV)
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyExternalComputeQueueNV Device
device "externalQueue" ::: ExternalComputeQueueNV
o0 "allocator" ::: Maybe AllocationCallbacks
pAllocator)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkDestroyExternalComputeQueueNV
  :: FunPtr (Ptr Device_T -> Ptr ExternalComputeQueueNV_T -> Ptr AllocationCallbacks -> IO ()) -> Ptr Device_T -> Ptr ExternalComputeQueueNV_T -> Ptr AllocationCallbacks -> IO ()

-- | vkDestroyExternalComputeQueueNV - Destroys an external queue.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkDestroyExternalComputeQueueNV-device-parameter# @device@
--     /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkDestroyExternalComputeQueueNV-externalQueue-parameter#
--     @externalQueue@ /must/ be a valid
--     'Vulkan.Extensions.Handles.ExternalComputeQueueNV' handle
--
-- -   #VUID-vkDestroyExternalComputeQueueNV-pAllocator-parameter# If
--     @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid pointer
--     to a valid 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks'
--     structure
--
-- -   #VUID-vkDestroyExternalComputeQueueNV-externalQueue-parent#
--     @externalQueue@ /must/ have been created, allocated, or retrieved
--     from @device@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.Device',
-- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV'
destroyExternalComputeQueueNV :: forall io
                               . (MonadIO io)
                              => -- | @device@ is the logical device that destroys the external queue.
                                 Device
                              -> -- | @externalQueue@ is the
                                 -- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV' to destroy.
                                 ("externalQueue" ::: ExternalComputeQueueNV)
                              -> -- | @pAllocator@ controls host memory allocation as described in the
                                 -- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#memory-allocation Memory Allocation>
                                 -- chapter.
                                 ("allocator" ::: Maybe AllocationCallbacks)
                              -> io ()
destroyExternalComputeQueueNV :: forall (io :: * -> *).
MonadIO io =>
Device
-> ("externalQueue" ::: ExternalComputeQueueNV)
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyExternalComputeQueueNV Device
device
                                "externalQueue" ::: ExternalComputeQueueNV
externalQueue
                                "allocator" ::: Maybe AllocationCallbacks
allocator = IO () -> io ()
forall a. IO a -> io a
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 vkDestroyExternalComputeQueueNVPtr :: FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
vkDestroyExternalComputeQueueNVPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Ptr ExternalComputeQueueNV_T
      -> Ptr AllocationCallbacks
      -> IO ())
pVkDestroyExternalComputeQueueNV (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
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
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
vkDestroyExternalComputeQueueNVPtr FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> Ptr ExternalComputeQueueNV_T
      -> Ptr AllocationCallbacks
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 vkDestroyExternalComputeQueueNV is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkDestroyExternalComputeQueueNV' :: Ptr Device_T
-> Ptr ExternalComputeQueueNV_T -> Ptr AllocationCallbacks -> IO ()
vkDestroyExternalComputeQueueNV' = FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
-> Ptr Device_T
-> Ptr ExternalComputeQueueNV_T
-> Ptr AllocationCallbacks
-> IO ()
mkVkDestroyExternalComputeQueueNV FunPtr
  (Ptr Device_T
   -> Ptr ExternalComputeQueueNV_T
   -> Ptr AllocationCallbacks
   -> IO ())
vkDestroyExternalComputeQueueNVPtr
  pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks -> ContT () IO (Ptr AllocationCallbacks)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO ()) -> IO ())
 -> ContT () IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks -> (Ptr AllocationCallbacks -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  lift $ traceAroundEvent "vkDestroyExternalComputeQueueNV" (vkDestroyExternalComputeQueueNV'
                                                               (deviceHandle (device))
                                                               (externalComputeQueueNVHandle (externalQueue))
                                                               pAllocator)
  pure $ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetExternalComputeQueueDataNV
  :: FunPtr (Ptr ExternalComputeQueueNV_T -> Ptr ExternalComputeQueueDataParamsNV -> Ptr () -> IO ()) -> Ptr ExternalComputeQueueNV_T -> Ptr ExternalComputeQueueDataParamsNV -> Ptr () -> IO ()

-- | vkGetExternalComputeQueueDataNV - Retrieves data necessary for
-- compatible external API initialization
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'ExternalComputeQueueDataParamsNV',
-- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV'
getExternalComputeQueueDataNV :: forall io
                               . (MonadIO io)
                              => -- | @externalQueue@ is the
                                 -- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV' to query the data
                                 -- for.
                                 --
                                 -- #VUID-vkGetExternalComputeQueueDataNV-externalQueue-parameter#
                                 -- @externalQueue@ /must/ be a valid
                                 -- 'Vulkan.Extensions.Handles.ExternalComputeQueueNV' handle
                                 ("externalQueue" ::: ExternalComputeQueueNV)
                              -> -- | @pData@ is a pointer to application-allocated memory in which the
                                 -- requested data will be returned.
                                 --
                                 -- #VUID-vkGetExternalComputeQueueDataNV-pData-08134# @pData@ /must/ be at
                                 -- least the size specified by the externalDataSize field in the
                                 -- 'PhysicalDeviceExternalComputeQueuePropertiesNV' structure
                                 --
                                 -- #VUID-vkGetExternalComputeQueueDataNV-pData-parameter# @pData@ /must/ be
                                 -- a pointer value
                                 ("data" ::: Ptr ())
                              -> io (ExternalComputeQueueDataParamsNV)
getExternalComputeQueueDataNV :: forall (io :: * -> *).
MonadIO io =>
("externalQueue" ::: ExternalComputeQueueNV)
-> ("data" ::: Ptr ()) -> io ExternalComputeQueueDataParamsNV
getExternalComputeQueueDataNV "externalQueue" ::: ExternalComputeQueueNV
externalQueue "data" ::: Ptr ()
data' = IO ExternalComputeQueueDataParamsNV
-> io ExternalComputeQueueDataParamsNV
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExternalComputeQueueDataParamsNV
 -> io ExternalComputeQueueDataParamsNV)
-> (ContT
      ExternalComputeQueueDataParamsNV
      IO
      ExternalComputeQueueDataParamsNV
    -> IO ExternalComputeQueueDataParamsNV)
-> ContT
     ExternalComputeQueueDataParamsNV
     IO
     ExternalComputeQueueDataParamsNV
-> io ExternalComputeQueueDataParamsNV
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ExternalComputeQueueDataParamsNV
  IO
  ExternalComputeQueueDataParamsNV
-> IO ExternalComputeQueueDataParamsNV
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ExternalComputeQueueDataParamsNV
   IO
   ExternalComputeQueueDataParamsNV
 -> io ExternalComputeQueueDataParamsNV)
-> ContT
     ExternalComputeQueueDataParamsNV
     IO
     ExternalComputeQueueDataParamsNV
-> io ExternalComputeQueueDataParamsNV
forall a b. (a -> b) -> a -> b
$ do
  let vkGetExternalComputeQueueDataNVPtr :: FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
vkGetExternalComputeQueueDataNVPtr = DeviceCmds
-> FunPtr
     (Ptr ExternalComputeQueueNV_T
      -> Ptr ExternalComputeQueueDataParamsNV
      -> ("data" ::: Ptr ())
      -> IO ())
pVkGetExternalComputeQueueDataNV (case "externalQueue" ::: ExternalComputeQueueNV
externalQueue of ExternalComputeQueueNV{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: ("externalQueue" ::: ExternalComputeQueueNV) -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  IO () -> ContT ExternalComputeQueueDataParamsNV IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT ExternalComputeQueueDataParamsNV m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ExternalComputeQueueDataParamsNV IO ())
-> IO () -> ContT ExternalComputeQueueDataParamsNV IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
vkGetExternalComputeQueueDataNVPtr FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
-> FunPtr
     (Ptr ExternalComputeQueueNV_T
      -> Ptr ExternalComputeQueueDataParamsNV
      -> ("data" ::: Ptr ())
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. (HasCallStack, 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 vkGetExternalComputeQueueDataNV is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetExternalComputeQueueDataNV' :: Ptr ExternalComputeQueueNV_T
-> Ptr ExternalComputeQueueDataParamsNV
-> ("data" ::: Ptr ())
-> IO ()
vkGetExternalComputeQueueDataNV' = FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
-> Ptr ExternalComputeQueueNV_T
-> Ptr ExternalComputeQueueDataParamsNV
-> ("data" ::: Ptr ())
-> IO ()
mkVkGetExternalComputeQueueDataNV FunPtr
  (Ptr ExternalComputeQueueNV_T
   -> Ptr ExternalComputeQueueDataParamsNV
   -> ("data" ::: Ptr ())
   -> IO ())
vkGetExternalComputeQueueDataNVPtr
  pParams <- ((Ptr ExternalComputeQueueDataParamsNV
  -> IO ExternalComputeQueueDataParamsNV)
 -> IO ExternalComputeQueueDataParamsNV)
-> ContT
     ExternalComputeQueueDataParamsNV
     IO
     (Ptr ExternalComputeQueueDataParamsNV)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ExternalComputeQueueDataParamsNV)
  lift $ traceAroundEvent "vkGetExternalComputeQueueDataNV" (vkGetExternalComputeQueueDataNV'
                                                               (externalComputeQueueNVHandle (externalQueue))
                                                               (pParams)
                                                               (data'))
  params <- lift $ peekCStruct @ExternalComputeQueueDataParamsNV pParams
  pure $ (params)


-- | VkExternalComputeQueueDeviceCreateInfoNV - Structure specifying
-- information about external compute queues relevant to device creation
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ExternalComputeQueueDeviceCreateInfoNV = ExternalComputeQueueDeviceCreateInfoNV
  { -- | @reservedExternalQueues@ is the maximum number of external queues an
    -- application /can/ create at once. This /must/ be less than or equal to
    -- the @maxExternalQueues@ value reported by
    -- 'PhysicalDeviceExternalComputeQueuePropertiesNV'
    ExternalComputeQueueDeviceCreateInfoNV -> Word32
reservedExternalQueues :: Word32 }
  deriving (Typeable, ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> Bool
(ExternalComputeQueueDeviceCreateInfoNV
 -> ExternalComputeQueueDeviceCreateInfoNV -> Bool)
-> (ExternalComputeQueueDeviceCreateInfoNV
    -> ExternalComputeQueueDeviceCreateInfoNV -> Bool)
-> Eq ExternalComputeQueueDeviceCreateInfoNV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> Bool
== :: ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> Bool
$c/= :: ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> Bool
/= :: ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalComputeQueueDeviceCreateInfoNV)
#endif
deriving instance Show ExternalComputeQueueDeviceCreateInfoNV

instance ToCStruct ExternalComputeQueueDeviceCreateInfoNV where
  withCStruct :: forall b.
ExternalComputeQueueDeviceCreateInfoNV
-> (Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b) -> IO b
withCStruct ExternalComputeQueueDeviceCreateInfoNV
x Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b
f = Int -> (Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b) -> IO b)
-> (Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ExternalComputeQueueDeviceCreateInfoNV
p -> Ptr ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> IO b -> IO b
forall b.
Ptr ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueDeviceCreateInfoNV
p ExternalComputeQueueDeviceCreateInfoNV
x (Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b
f Ptr ExternalComputeQueueDeviceCreateInfoNV
p)
  pokeCStruct :: forall b.
Ptr ExternalComputeQueueDeviceCreateInfoNV
-> ExternalComputeQueueDeviceCreateInfoNV -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueDeviceCreateInfoNV
p ExternalComputeQueueDeviceCreateInfoNV{Word32
reservedExternalQueues :: ExternalComputeQueueDeviceCreateInfoNV -> Word32
reservedExternalQueues :: Word32
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DEVICE_CREATE_INFO_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
reservedExternalQueues)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr ExternalComputeQueueDeviceCreateInfoNV -> IO b -> IO b
pokeZeroCStruct Ptr ExternalComputeQueueDeviceCreateInfoNV
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DEVICE_CREATE_INFO_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalComputeQueueDeviceCreateInfoNV where
  peekCStruct :: Ptr ExternalComputeQueueDeviceCreateInfoNV
-> IO ExternalComputeQueueDeviceCreateInfoNV
peekCStruct Ptr ExternalComputeQueueDeviceCreateInfoNV
p = do
    reservedExternalQueues <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ExternalComputeQueueDeviceCreateInfoNV
p Ptr ExternalComputeQueueDeviceCreateInfoNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    pure $ ExternalComputeQueueDeviceCreateInfoNV
             reservedExternalQueues

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

instance Zero ExternalComputeQueueDeviceCreateInfoNV where
  zero :: ExternalComputeQueueDeviceCreateInfoNV
zero = Word32 -> ExternalComputeQueueDeviceCreateInfoNV
ExternalComputeQueueDeviceCreateInfoNV
           Word32
forall a. Zero a => a
zero


-- | VkExternalComputeQueueCreateInfoNV - Structure specifying configuration
-- parameters for external compute queue creation
--
-- = Description
--
-- When creating a 'Vulkan.Extensions.Handles.ExternalComputeQueueNV', the
-- @preferredQueue@ field is a strong scheduling hint as to which
-- 'Vulkan.Core10.Handles.Queue' Vulkan graphics workloads will be
-- submitted to with the expectation that execution will overlap with
-- execution of work submitted by the external API.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.Handles.Queue',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createExternalComputeQueueNV'
data ExternalComputeQueueCreateInfoNV = ExternalComputeQueueCreateInfoNV
  { -- | @preferredQueue@ is a 'Vulkan.Core10.Handles.Queue' supporting graphics
    -- commands.
    --
    -- #VUID-VkExternalComputeQueueCreateInfoNV-preferredQueue-parameter#
    -- @preferredQueue@ /must/ be a valid 'Vulkan.Core10.Handles.Queue' handle
    ExternalComputeQueueCreateInfoNV -> Ptr Queue_T
preferredQueue :: Ptr Queue_T }
  deriving (Typeable, ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> Bool
(ExternalComputeQueueCreateInfoNV
 -> ExternalComputeQueueCreateInfoNV -> Bool)
-> (ExternalComputeQueueCreateInfoNV
    -> ExternalComputeQueueCreateInfoNV -> Bool)
-> Eq ExternalComputeQueueCreateInfoNV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> Bool
== :: ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> Bool
$c/= :: ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> Bool
/= :: ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalComputeQueueCreateInfoNV)
#endif
deriving instance Show ExternalComputeQueueCreateInfoNV

instance ToCStruct ExternalComputeQueueCreateInfoNV where
  withCStruct :: forall b.
ExternalComputeQueueCreateInfoNV
-> (Ptr ExternalComputeQueueCreateInfoNV -> IO b) -> IO b
withCStruct ExternalComputeQueueCreateInfoNV
x Ptr ExternalComputeQueueCreateInfoNV -> IO b
f = Int -> (Ptr ExternalComputeQueueCreateInfoNV -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr ExternalComputeQueueCreateInfoNV -> IO b) -> IO b)
-> (Ptr ExternalComputeQueueCreateInfoNV -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ExternalComputeQueueCreateInfoNV
p -> Ptr ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> IO b -> IO b
forall b.
Ptr ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueCreateInfoNV
p ExternalComputeQueueCreateInfoNV
x (Ptr ExternalComputeQueueCreateInfoNV -> IO b
f Ptr ExternalComputeQueueCreateInfoNV
p)
  pokeCStruct :: forall b.
Ptr ExternalComputeQueueCreateInfoNV
-> ExternalComputeQueueCreateInfoNV -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueCreateInfoNV
p ExternalComputeQueueCreateInfoNV{Ptr Queue_T
preferredQueue :: ExternalComputeQueueCreateInfoNV -> Ptr Queue_T
preferredQueue :: Ptr Queue_T
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_CREATE_INFO_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr Queue_T) -> Ptr Queue_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV -> Int -> Ptr (Ptr Queue_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr Queue_T))) (Ptr Queue_T
preferredQueue)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ExternalComputeQueueCreateInfoNV -> IO b -> IO b
pokeZeroCStruct Ptr ExternalComputeQueueCreateInfoNV
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_CREATE_INFO_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr (Ptr Queue_T) -> Ptr Queue_T -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV -> Int -> Ptr (Ptr Queue_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr Queue_T))) (Ptr Queue_T
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalComputeQueueCreateInfoNV where
  peekCStruct :: Ptr ExternalComputeQueueCreateInfoNV
-> IO ExternalComputeQueueCreateInfoNV
peekCStruct Ptr ExternalComputeQueueCreateInfoNV
p = do
    preferredQueue <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Queue_T) ((Ptr ExternalComputeQueueCreateInfoNV
p Ptr ExternalComputeQueueCreateInfoNV -> Int -> Ptr (Ptr Queue_T)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr Queue_T)))
    pure $ ExternalComputeQueueCreateInfoNV
             preferredQueue

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

instance Zero ExternalComputeQueueCreateInfoNV where
  zero :: ExternalComputeQueueCreateInfoNV
zero = Ptr Queue_T -> ExternalComputeQueueCreateInfoNV
ExternalComputeQueueCreateInfoNV
           Ptr Queue_T
forall a. Zero a => a
zero


-- | VkExternalComputeQueueDataParamsNV - Structure specifying parameters for
-- implementation-specific data retrieval from the external compute queue
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getExternalComputeQueueDataNV'
data ExternalComputeQueueDataParamsNV = ExternalComputeQueueDataParamsNV
  { -- | @deviceIndex@ is the index of the device within a device group that the
    -- data is being queried for. This is ignored if device groups are not
    -- utilized.
    ExternalComputeQueueDataParamsNV -> Word32
deviceIndex :: Word32 }
  deriving (Typeable, ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> Bool
(ExternalComputeQueueDataParamsNV
 -> ExternalComputeQueueDataParamsNV -> Bool)
-> (ExternalComputeQueueDataParamsNV
    -> ExternalComputeQueueDataParamsNV -> Bool)
-> Eq ExternalComputeQueueDataParamsNV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> Bool
== :: ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> Bool
$c/= :: ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> Bool
/= :: ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalComputeQueueDataParamsNV)
#endif
deriving instance Show ExternalComputeQueueDataParamsNV

instance ToCStruct ExternalComputeQueueDataParamsNV where
  withCStruct :: forall b.
ExternalComputeQueueDataParamsNV
-> (Ptr ExternalComputeQueueDataParamsNV -> IO b) -> IO b
withCStruct ExternalComputeQueueDataParamsNV
x Ptr ExternalComputeQueueDataParamsNV -> IO b
f = Int -> (Ptr ExternalComputeQueueDataParamsNV -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr ExternalComputeQueueDataParamsNV -> IO b) -> IO b)
-> (Ptr ExternalComputeQueueDataParamsNV -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr ExternalComputeQueueDataParamsNV
p -> Ptr ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> IO b -> IO b
forall b.
Ptr ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueDataParamsNV
p ExternalComputeQueueDataParamsNV
x (Ptr ExternalComputeQueueDataParamsNV -> IO b
f Ptr ExternalComputeQueueDataParamsNV
p)
  pokeCStruct :: forall b.
Ptr ExternalComputeQueueDataParamsNV
-> ExternalComputeQueueDataParamsNV -> IO b -> IO b
pokeCStruct Ptr ExternalComputeQueueDataParamsNV
p ExternalComputeQueueDataParamsNV{Word32
deviceIndex :: ExternalComputeQueueDataParamsNV -> Word32
deviceIndex :: Word32
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DATA_PARAMS_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
deviceIndex)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr ExternalComputeQueueDataParamsNV -> IO b -> IO b
pokeZeroCStruct Ptr ExternalComputeQueueDataParamsNV
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_COMPUTE_QUEUE_DATA_PARAMS_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ExternalComputeQueueDataParamsNV where
  peekCStruct :: Ptr ExternalComputeQueueDataParamsNV
-> IO ExternalComputeQueueDataParamsNV
peekCStruct Ptr ExternalComputeQueueDataParamsNV
p = do
    deviceIndex <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ExternalComputeQueueDataParamsNV
p Ptr ExternalComputeQueueDataParamsNV -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    pure $ ExternalComputeQueueDataParamsNV
             deviceIndex

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

instance Zero ExternalComputeQueueDataParamsNV where
  zero :: ExternalComputeQueueDataParamsNV
zero = Word32 -> ExternalComputeQueueDataParamsNV
ExternalComputeQueueDataParamsNV
           Word32
forall a. Zero a => a
zero


-- | VkPhysicalDeviceExternalComputeQueuePropertiesNV - Structure specifying
-- hardware specific information and limits for
-- VK_NV_external_compute_queue functionality
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_NV_external_compute_queue VK_NV_external_compute_queue>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceExternalComputeQueuePropertiesNV = PhysicalDeviceExternalComputeQueuePropertiesNV
  { -- | @externalDataSize@ is the minimum size of the memory allocation that
    -- applications /can/ pass to 'getExternalComputeQueueDataNV'.
    PhysicalDeviceExternalComputeQueuePropertiesNV -> Word32
externalDataSize :: Word32
  , -- | @maxExternalQueues@ is the maximum number of external queues that an
    -- application can create.
    PhysicalDeviceExternalComputeQueuePropertiesNV -> Word32
maxExternalQueues :: Word32
  }
  deriving (Typeable, PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool
(PhysicalDeviceExternalComputeQueuePropertiesNV
 -> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool)
-> (PhysicalDeviceExternalComputeQueuePropertiesNV
    -> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool)
-> Eq PhysicalDeviceExternalComputeQueuePropertiesNV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool
== :: PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool
$c/= :: PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool
/= :: PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceExternalComputeQueuePropertiesNV)
#endif
deriving instance Show PhysicalDeviceExternalComputeQueuePropertiesNV

instance ToCStruct PhysicalDeviceExternalComputeQueuePropertiesNV where
  withCStruct :: forall b.
PhysicalDeviceExternalComputeQueuePropertiesNV
-> (Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b)
-> IO b
withCStruct PhysicalDeviceExternalComputeQueuePropertiesNV
x Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b
f = Int
-> (Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b)
 -> IO b)
-> (Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p -> Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b -> IO b
forall b.
Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p PhysicalDeviceExternalComputeQueuePropertiesNV
x (Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b
f Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p PhysicalDeviceExternalComputeQueuePropertiesNV{Word32
externalDataSize :: PhysicalDeviceExternalComputeQueuePropertiesNV -> Word32
maxExternalQueues :: PhysicalDeviceExternalComputeQueuePropertiesNV -> Word32
externalDataSize :: Word32
maxExternalQueues :: Word32
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_COMPUTE_QUEUE_PROPERTIES_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
externalDataSize)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
maxExternalQueues)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceExternalComputeQueuePropertiesNV -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_COMPUTE_QUEUE_PROPERTIES_NV)
    Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceExternalComputeQueuePropertiesNV where
  peekCStruct :: Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> IO PhysicalDeviceExternalComputeQueuePropertiesNV
peekCStruct Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p = do
    externalDataSize <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
p Ptr PhysicalDeviceExternalComputeQueuePropertiesNV
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    maxExternalQueues <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
    pure $ PhysicalDeviceExternalComputeQueuePropertiesNV
             externalDataSize maxExternalQueues

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

instance Zero PhysicalDeviceExternalComputeQueuePropertiesNV where
  zero :: PhysicalDeviceExternalComputeQueuePropertiesNV
zero = Word32 -> Word32 -> PhysicalDeviceExternalComputeQueuePropertiesNV
PhysicalDeviceExternalComputeQueuePropertiesNV
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero


type NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION"
pattern NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION :: forall a . Integral a => a
pattern $mNV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bNV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION :: forall a. Integral a => a
NV_EXTERNAL_COMPUTE_QUEUE_SPEC_VERSION = 1


type NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME = "VK_NV_external_compute_queue"

-- No documentation found for TopLevel "VK_NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME"
pattern NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mNV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bNV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
NV_EXTERNAL_COMPUTE_QUEUE_EXTENSION_NAME = "VK_NV_external_compute_queue"