{-# language CPP #-}
module Vulkan.Core11.Promoted_From_VK_KHR_descriptor_update_template  ( createDescriptorUpdateTemplate
                                                                      , withDescriptorUpdateTemplate
                                                                      , destroyDescriptorUpdateTemplate
                                                                      , updateDescriptorSetWithTemplate
                                                                      , DescriptorUpdateTemplateEntry(..)
                                                                      , DescriptorUpdateTemplateCreateInfo(..)
                                                                      , DescriptorUpdateTemplate(..)
                                                                      , DescriptorUpdateTemplateCreateFlags(..)
                                                                      , StructureType(..)
                                                                      , DescriptorUpdateTemplateType(..)
                                                                      , ObjectType(..)
                                                                      ) where

import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Control.Monad.IO.Class (MonadIO)
import Data.Typeable (Typeable)
import Foreign.C.Types (CSize)
import Foreign.C.Types (CSize(CSize))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.Handles (DescriptorSet)
import Vulkan.Core10.Handles (DescriptorSet(..))
import Vulkan.Core10.Handles (DescriptorSetLayout)
import Vulkan.Core10.Enums.DescriptorType (DescriptorType)
import Vulkan.Core11.Handles (DescriptorUpdateTemplate)
import Vulkan.Core11.Handles (DescriptorUpdateTemplate(..))
import Vulkan.Core11.Enums.DescriptorUpdateTemplateCreateFlags (DescriptorUpdateTemplateCreateFlags)
import Vulkan.Core11.Enums.DescriptorUpdateTemplateType (DescriptorUpdateTemplateType)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkCreateDescriptorUpdateTemplate))
import Vulkan.Dynamic (DeviceCmds(pVkDestroyDescriptorUpdateTemplate))
import Vulkan.Dynamic (DeviceCmds(pVkUpdateDescriptorSetWithTemplate))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.PipelineBindPoint (PipelineBindPoint)
import Vulkan.Core10.Handles (PipelineLayout)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core11.Handles (DescriptorUpdateTemplate(..))
import Vulkan.Core11.Enums.DescriptorUpdateTemplateCreateFlags (DescriptorUpdateTemplateCreateFlags(..))
import Vulkan.Core11.Enums.DescriptorUpdateTemplateType (DescriptorUpdateTemplateType(..))
import Vulkan.Core10.Enums.ObjectType (ObjectType(..))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateDescriptorUpdateTemplate
  :: FunPtr (Ptr Device_T -> Ptr DescriptorUpdateTemplateCreateInfo -> Ptr AllocationCallbacks -> Ptr DescriptorUpdateTemplate -> IO Result) -> Ptr Device_T -> Ptr DescriptorUpdateTemplateCreateInfo -> Ptr AllocationCallbacks -> Ptr DescriptorUpdateTemplate -> IO Result

-- | vkCreateDescriptorUpdateTemplate - Create a new descriptor update
-- template
--
-- == Valid Usage (Implicit)
--
-- -   @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   @pCreateInfo@ /must/ be a valid pointer to a valid
--     'DescriptorUpdateTemplateCreateInfo' structure
--
-- -   If @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid
--     pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   @pDescriptorUpdateTemplate@ /must/ be a valid pointer to a
--     'Vulkan.Core11.Handles.DescriptorUpdateTemplate' handle
--
-- == 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_OUT_OF_DEVICE_MEMORY'
--
-- = See Also
--
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core11.Handles.DescriptorUpdateTemplate',
-- 'DescriptorUpdateTemplateCreateInfo', 'Vulkan.Core10.Handles.Device'
createDescriptorUpdateTemplate :: forall io
                                . (MonadIO io)
                               => -- | @device@ is the logical device that creates the descriptor update
                                  -- template.
                                  Device
                               -> -- | @pCreateInfo@ is a pointer to a 'DescriptorUpdateTemplateCreateInfo'
                                  -- structure specifying the set of descriptors to update with a single call
                                  -- to
                                  -- 'Vulkan.Extensions.VK_KHR_push_descriptor.cmdPushDescriptorSetWithTemplateKHR'
                                  -- or 'updateDescriptorSetWithTemplate'.
                                  DescriptorUpdateTemplateCreateInfo
                               -> -- | @pAllocator@ controls host memory allocation as described in the
                                  -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#memory-allocation Memory Allocation>
                                  -- chapter.
                                  ("allocator" ::: Maybe AllocationCallbacks)
                               -> io (DescriptorUpdateTemplate)
createDescriptorUpdateTemplate :: Device
-> DescriptorUpdateTemplateCreateInfo
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorUpdateTemplate
createDescriptorUpdateTemplate device :: Device
device createInfo :: DescriptorUpdateTemplateCreateInfo
createInfo allocator :: "allocator" ::: Maybe AllocationCallbacks
allocator = IO DescriptorUpdateTemplate -> io DescriptorUpdateTemplate
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DescriptorUpdateTemplate -> io DescriptorUpdateTemplate)
-> (ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
    -> IO DescriptorUpdateTemplate)
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
-> io DescriptorUpdateTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
-> IO DescriptorUpdateTemplate
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
 -> io DescriptorUpdateTemplate)
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
-> io DescriptorUpdateTemplate
forall a b. (a -> b) -> a -> b
$ do
  let vkCreateDescriptorUpdateTemplatePtr :: FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
vkCreateDescriptorUpdateTemplatePtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
      -> IO Result)
pVkCreateDescriptorUpdateTemplate (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT DescriptorUpdateTemplate IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorUpdateTemplate IO ())
-> IO () -> ContT DescriptorUpdateTemplate IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
vkCreateDescriptorUpdateTemplatePtr FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkCreateDescriptorUpdateTemplate is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCreateDescriptorUpdateTemplate' :: Ptr Device_T
-> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> IO Result
vkCreateDescriptorUpdateTemplate' = FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
-> Ptr Device_T
-> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> IO Result
mkVkCreateDescriptorUpdateTemplate FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO Result)
vkCreateDescriptorUpdateTemplatePtr
  "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
pCreateInfo <- ((("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
  -> IO DescriptorUpdateTemplate)
 -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
   -> IO DescriptorUpdateTemplate)
  -> IO DescriptorUpdateTemplate)
 -> ContT
      DescriptorUpdateTemplate
      IO
      ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo))
-> ((("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
     -> IO DescriptorUpdateTemplate)
    -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
forall a b. (a -> b) -> a -> b
$ DescriptorUpdateTemplateCreateInfo
-> (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
    -> IO DescriptorUpdateTemplate)
-> IO DescriptorUpdateTemplate
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DescriptorUpdateTemplateCreateInfo
createInfo)
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    Nothing -> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pAllocator" ::: Ptr AllocationCallbacks)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pAllocator" ::: Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just j :: AllocationCallbacks
j -> ((("pAllocator" ::: Ptr AllocationCallbacks)
  -> IO DescriptorUpdateTemplate)
 -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pAllocator" ::: Ptr AllocationCallbacks)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO DescriptorUpdateTemplate)
  -> IO DescriptorUpdateTemplate)
 -> ContT
      DescriptorUpdateTemplate
      IO
      ("pAllocator" ::: Ptr AllocationCallbacks))
-> ((("pAllocator" ::: Ptr AllocationCallbacks)
     -> IO DescriptorUpdateTemplate)
    -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pAllocator" ::: Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (("pAllocator" ::: Ptr AllocationCallbacks)
    -> IO DescriptorUpdateTemplate)
-> IO DescriptorUpdateTemplate
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  "pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate
pPDescriptorUpdateTemplate <- ((("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
  -> IO DescriptorUpdateTemplate)
 -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
   -> IO DescriptorUpdateTemplate)
  -> IO DescriptorUpdateTemplate)
 -> ContT
      DescriptorUpdateTemplate
      IO
      ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate))
-> ((("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
     -> IO DescriptorUpdateTemplate)
    -> IO DescriptorUpdateTemplate)
-> ContT
     DescriptorUpdateTemplate
     IO
     ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
forall a b. (a -> b) -> a -> b
$ IO ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> (("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
    -> IO ())
-> (("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
    -> IO DescriptorUpdateTemplate)
-> IO DescriptorUpdateTemplate
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
forall a. Int -> IO (Ptr a)
callocBytes @DescriptorUpdateTemplate 8) ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT DescriptorUpdateTemplate IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT DescriptorUpdateTemplate IO Result)
-> IO Result -> ContT DescriptorUpdateTemplate IO Result
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> IO Result
vkCreateDescriptorUpdateTemplate' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
pCreateInfo "pAllocator" ::: Ptr AllocationCallbacks
pAllocator ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate
pPDescriptorUpdateTemplate)
  IO () -> ContT DescriptorUpdateTemplate IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorUpdateTemplate IO ())
-> IO () -> ContT DescriptorUpdateTemplate 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))
  DescriptorUpdateTemplate
pDescriptorUpdateTemplate <- IO DescriptorUpdateTemplate
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO DescriptorUpdateTemplate
 -> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate)
-> IO DescriptorUpdateTemplate
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
forall a b. (a -> b) -> a -> b
$ ("pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate)
-> IO DescriptorUpdateTemplate
forall a. Storable a => Ptr a -> IO a
peek @DescriptorUpdateTemplate "pDescriptorUpdateTemplate" ::: Ptr DescriptorUpdateTemplate
pPDescriptorUpdateTemplate
  DescriptorUpdateTemplate
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorUpdateTemplate
 -> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate)
-> DescriptorUpdateTemplate
-> ContT DescriptorUpdateTemplate IO DescriptorUpdateTemplate
forall a b. (a -> b) -> a -> b
$ (DescriptorUpdateTemplate
pDescriptorUpdateTemplate)

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


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

-- | vkDestroyDescriptorUpdateTemplate - Destroy a descriptor update template
-- object
--
-- == Valid Usage
--
-- -   If 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorSetLayout@ was created, a compatible set of
--     callbacks /must/ be provided here
--
-- -   If no 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorSetLayout@ was created, @pAllocator@ /must/
--     be @NULL@
--
-- == Valid Usage (Implicit)
--
-- -   @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   If @descriptorUpdateTemplate@ is not
--     'Vulkan.Core10.APIConstants.NULL_HANDLE', @descriptorUpdateTemplate@
--     /must/ be a valid 'Vulkan.Core11.Handles.DescriptorUpdateTemplate'
--     handle
--
-- -   If @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid
--     pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   If @descriptorUpdateTemplate@ is a valid handle, it /must/ have been
--     created, allocated, or retrieved from @device@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorUpdateTemplate@ /must/ be externally
--     synchronized
--
-- = See Also
--
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core11.Handles.DescriptorUpdateTemplate',
-- 'Vulkan.Core10.Handles.Device'
destroyDescriptorUpdateTemplate :: forall io
                                 . (MonadIO io)
                                => -- | @device@ is the logical device that has been used to create the
                                   -- descriptor update template
                                   Device
                                -> -- | @descriptorUpdateTemplate@ is the descriptor update template to destroy.
                                   DescriptorUpdateTemplate
                                -> -- | @pAllocator@ controls host memory allocation as described in the
                                   -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#memory-allocation Memory Allocation>
                                   -- chapter.
                                   ("allocator" ::: Maybe AllocationCallbacks)
                                -> io ()
destroyDescriptorUpdateTemplate :: Device
-> DescriptorUpdateTemplate
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorUpdateTemplate device :: Device
device descriptorUpdateTemplate :: DescriptorUpdateTemplate
descriptorUpdateTemplate allocator :: "allocator" ::: Maybe AllocationCallbacks
allocator = 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 vkDestroyDescriptorUpdateTemplatePtr :: FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorUpdateTemplatePtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorUpdateTemplate
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
pVkDestroyDescriptorUpdateTemplate (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorUpdateTemplatePtr FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> DescriptorUpdateTemplate
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkDestroyDescriptorUpdateTemplate is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkDestroyDescriptorUpdateTemplate' :: Ptr Device_T
-> DescriptorUpdateTemplate
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorUpdateTemplate' = FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> Ptr Device_T
-> DescriptorUpdateTemplate
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
mkVkDestroyDescriptorUpdateTemplate FunPtr
  (Ptr Device_T
   -> DescriptorUpdateTemplate
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorUpdateTemplatePtr
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    Nothing -> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ContT () IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pAllocator" ::: Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just j :: AllocationCallbacks
j -> ((("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()) -> IO ())
-> ContT () IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()) -> IO ())
 -> ContT () IO ("pAllocator" ::: Ptr AllocationCallbacks))
-> ((("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()) -> IO ())
-> ContT () IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  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
$ Ptr Device_T
-> DescriptorUpdateTemplate
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorUpdateTemplate' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorUpdateTemplate
descriptorUpdateTemplate) "pAllocator" ::: Ptr AllocationCallbacks
pAllocator
  () -> ContT () IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> ContT () IO ()) -> () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkUpdateDescriptorSetWithTemplate
  :: FunPtr (Ptr Device_T -> DescriptorSet -> DescriptorUpdateTemplate -> Ptr () -> IO ()) -> Ptr Device_T -> DescriptorSet -> DescriptorUpdateTemplate -> Ptr () -> IO ()

-- | vkUpdateDescriptorSetWithTemplate - Update the contents of a descriptor
-- set object using an update template
--
-- == Valid Usage
--
-- -   @pData@ /must/ be a valid pointer to a memory containing one or more
--     valid instances of
--     'Vulkan.Core10.DescriptorSet.DescriptorImageInfo',
--     'Vulkan.Core10.DescriptorSet.DescriptorBufferInfo', or
--     'Vulkan.Core10.Handles.BufferView' in a layout defined by
--     @descriptorUpdateTemplate@ when it was created with
--     'createDescriptorUpdateTemplate'
--
-- == Valid Usage (Implicit)
--
-- -   @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   @descriptorSet@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorSet' handle
--
-- -   @descriptorUpdateTemplate@ /must/ be a valid
--     'Vulkan.Core11.Handles.DescriptorUpdateTemplate' handle
--
-- -   @descriptorUpdateTemplate@ /must/ have been created, allocated, or
--     retrieved from @device@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorSet@ /must/ be externally synchronized
--
-- __API example.__
--
-- > struct AppBufferView {
-- >     VkBufferView bufferView;
-- >     uint32_t     applicationRelatedInformation;
-- > };
-- >
-- > struct AppDataStructure
-- > {
-- >     VkDescriptorImageInfo  imageInfo;          // a single image info
-- >     VkDescriptorBufferInfo bufferInfoArray[3]; // 3 buffer infos in an array
-- >     AppBufferView          bufferView[2];      // An application defined structure containing a bufferView
-- >     // ... some more application related data
-- > };
-- >
-- > const VkDescriptorUpdateTemplateEntry descriptorUpdateTemplateEntries[] =
-- > {
-- >     // binding to a single image descriptor
-- >     {
-- >         0,                                           // binding
-- >         0,                                           // dstArrayElement
-- >         1,                                           // descriptorCount
-- >         VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,   // descriptorType
-- >         offsetof(AppDataStructure, imageInfo),       // offset
-- >         0                                            // stride is not required if descriptorCount is 1
-- >     },
-- >
-- >     // binding to an array of buffer descriptors
-- >     {
-- >         1,                                           // binding
-- >         0,                                           // dstArrayElement
-- >         3,                                           // descriptorCount
-- >         VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,           // descriptorType
-- >         offsetof(AppDataStructure, bufferInfoArray), // offset
-- >         sizeof(VkDescriptorBufferInfo)               // stride, descriptor buffer infos are compact
-- >     },
-- >
-- >     // binding to an array of buffer views
-- >     {
-- >         2,                                           // binding
-- >         0,                                           // dstArrayElement
-- >         2,                                           // descriptorCount
-- >         VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,     // descriptorType
-- >         offsetof(AppDataStructure, bufferView) +
-- >           offsetof(AppBufferView, bufferView),       // offset
-- >         sizeof(AppBufferView)                        // stride, bufferViews do not have to be compact
-- >     },
-- > };
-- >
-- > // create a descriptor update template for descriptor set updates
-- > const VkDescriptorUpdateTemplateCreateInfo createInfo =
-- > {
-- >     VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO,  // sType
-- >     NULL,                                                      // pNext
-- >     0,                                                         // flags
-- >     3,                                                         // descriptorUpdateEntryCount
-- >     descriptorUpdateTemplateEntries,                           // pDescriptorUpdateEntries
-- >     VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET,         // templateType
-- >     myLayout,                                                  // descriptorSetLayout
-- >     0,                                                         // pipelineBindPoint, ignored by given templateType
-- >     0,                                                         // pipelineLayout, ignored by given templateType
-- >     0,                                                         // set, ignored by given templateType
-- > };
-- >
-- > VkDescriptorUpdateTemplate myDescriptorUpdateTemplate;
-- > myResult = vkCreateDescriptorUpdateTemplate(
-- >     myDevice,
-- >     &createInfo,
-- >     NULL,
-- >     &myDescriptorUpdateTemplate);
-- > }
-- >
-- >
-- > AppDataStructure appData;
-- >
-- > // fill appData here or cache it in your engine
-- > vkUpdateDescriptorSetWithTemplate(myDevice, myDescriptorSet, myDescriptorUpdateTemplate, &appData);
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorSet',
-- 'Vulkan.Core11.Handles.DescriptorUpdateTemplate',
-- 'Vulkan.Core10.Handles.Device'
updateDescriptorSetWithTemplate :: forall io
                                 . (MonadIO io)
                                => -- | @device@ is the logical device that updates the descriptor sets.
                                   Device
                                -> -- | @descriptorSet@ is the descriptor set to update
                                   DescriptorSet
                                -> -- | @descriptorUpdateTemplate@ is a
                                   -- 'Vulkan.Core11.Handles.DescriptorUpdateTemplate' object specifying the
                                   -- update mapping between @pData@ and the descriptor set to update.
                                   DescriptorUpdateTemplate
                                -> -- | @pData@ is a pointer to memory containing one or more
                                   -- 'Vulkan.Core10.DescriptorSet.DescriptorImageInfo',
                                   -- 'Vulkan.Core10.DescriptorSet.DescriptorBufferInfo', or
                                   -- 'Vulkan.Core10.Handles.BufferView' structures or
                                   -- 'Vulkan.Extensions.Handles.AccelerationStructureKHR' or
                                   -- 'Vulkan.Extensions.VK_NV_ray_tracing.AccelerationStructureNV' handles
                                   -- used to write the descriptors.
                                   ("data" ::: Ptr ())
                                -> io ()
updateDescriptorSetWithTemplate :: Device
-> DescriptorSet
-> DescriptorUpdateTemplate
-> ("data" ::: Ptr ())
-> io ()
updateDescriptorSetWithTemplate device :: Device
device descriptorSet :: DescriptorSet
descriptorSet descriptorUpdateTemplate :: DescriptorUpdateTemplate
descriptorUpdateTemplate data' :: "data" ::: Ptr ()
data' = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ()) -> IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkUpdateDescriptorSetWithTemplatePtr :: FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
vkUpdateDescriptorSetWithTemplatePtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorSet
      -> DescriptorUpdateTemplate
      -> ("data" ::: Ptr ())
      -> IO ())
pVkUpdateDescriptorSetWithTemplate (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
vkUpdateDescriptorSetWithTemplatePtr FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> DescriptorSet
      -> DescriptorUpdateTemplate
      -> ("data" ::: Ptr ())
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkUpdateDescriptorSetWithTemplate is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkUpdateDescriptorSetWithTemplate' :: Ptr Device_T
-> DescriptorSet
-> DescriptorUpdateTemplate
-> ("data" ::: Ptr ())
-> IO ()
vkUpdateDescriptorSetWithTemplate' = FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
-> Ptr Device_T
-> DescriptorSet
-> DescriptorUpdateTemplate
-> ("data" ::: Ptr ())
-> IO ()
mkVkUpdateDescriptorSetWithTemplate FunPtr
  (Ptr Device_T
   -> DescriptorSet
   -> DescriptorUpdateTemplate
   -> ("data" ::: Ptr ())
   -> IO ())
vkUpdateDescriptorSetWithTemplatePtr
  Ptr Device_T
-> DescriptorSet
-> DescriptorUpdateTemplate
-> ("data" ::: Ptr ())
-> IO ()
vkUpdateDescriptorSetWithTemplate' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorSet
descriptorSet) (DescriptorUpdateTemplate
descriptorUpdateTemplate) ("data" ::: Ptr ()
data')
  () -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- | VkDescriptorUpdateTemplateEntry - Describes a single descriptor update
-- of the descriptor update template
--
-- == Valid Usage
--
-- -   @dstBinding@ /must/ be a valid binding in the descriptor set layout
--     implicitly specified when using a descriptor update template to
--     update descriptors
--
-- -   @dstArrayElement@ and @descriptorCount@ /must/ be less than or equal
--     to the number of array elements in the descriptor set binding
--     implicitly specified when using a descriptor update template to
--     update descriptors, and all applicable consecutive bindings, as
--     described by
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-updates-consecutive>
--
-- -   If @descriptor@ type is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @dstArrayElement@ /must/ be an integer multiple of @4@
--
-- -   If @descriptor@ type is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @descriptorCount@ /must/ be an integer multiple of @4@
--
-- == Valid Usage (Implicit)
--
-- -   @descriptorType@ /must/ be a valid
--     'Vulkan.Core10.Enums.DescriptorType.DescriptorType' value
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType',
-- 'DescriptorUpdateTemplateCreateInfo'
data DescriptorUpdateTemplateEntry = DescriptorUpdateTemplateEntry
  { -- | @dstBinding@ is the descriptor binding to update when using this
    -- descriptor update template.
    DescriptorUpdateTemplateEntry -> Word32
dstBinding :: Word32
  , -- | @dstArrayElement@ is the starting element in the array belonging to
    -- @dstBinding@. If the descriptor binding identified by @srcBinding@ has a
    -- descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @dstArrayElement@ specifies the starting byte offset to update.
    DescriptorUpdateTemplateEntry -> Word32
dstArrayElement :: Word32
  , -- | @descriptorCount@ is the number of descriptors to update. If
    -- @descriptorCount@ is greater than the number of remaining array elements
    -- in the destination binding, those affect consecutive bindings in a
    -- manner similar to 'Vulkan.Core10.DescriptorSet.WriteDescriptorSet'
    -- above. If the descriptor binding identified by @dstBinding@ has a
    -- descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @descriptorCount@ specifies the number of bytes to update and the
    -- remaining array elements in the destination binding refer to the
    -- remaining number of bytes in it.
    DescriptorUpdateTemplateEntry -> Word32
descriptorCount :: Word32
  , -- | @descriptorType@ is a
    -- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType' specifying the type
    -- of the descriptor.
    DescriptorUpdateTemplateEntry -> DescriptorType
descriptorType :: DescriptorType
  , -- | @offset@ is the offset in bytes of the first binding in the raw data
    -- structure.
    DescriptorUpdateTemplateEntry -> Word64
offset :: Word64
  , -- | @stride@ is the stride in bytes between two consecutive array elements
    -- of the descriptor update informations in the raw data structure. The
    -- actual pointer ptr for each array element j of update entry i is
    -- computed using the following formula:
    --
    -- >     const char *ptr = (const char *)pData + pDescriptorUpdateEntries[i].offset + j * pDescriptorUpdateEntries[i].stride
    --
    -- The stride is useful in case the bindings are stored in structs along
    -- with other data. If @descriptorType@ is
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then the value of @stride@ is ignored and the stride is assumed to be
    -- @1@, i.e. the descriptor update information for them is always specified
    -- as a contiguous range.
    DescriptorUpdateTemplateEntry -> Word64
stride :: Word64
  }
  deriving (Typeable, DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> Bool
(DescriptorUpdateTemplateEntry
 -> DescriptorUpdateTemplateEntry -> Bool)
-> (DescriptorUpdateTemplateEntry
    -> DescriptorUpdateTemplateEntry -> Bool)
-> Eq DescriptorUpdateTemplateEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> Bool
$c/= :: DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> Bool
== :: DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> Bool
$c== :: DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorUpdateTemplateEntry)
#endif
deriving instance Show DescriptorUpdateTemplateEntry

instance ToCStruct DescriptorUpdateTemplateEntry where
  withCStruct :: DescriptorUpdateTemplateEntry
-> (Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b
withCStruct x :: DescriptorUpdateTemplateEntry
x f :: Ptr DescriptorUpdateTemplateEntry -> IO b
f = Int -> Int -> (Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
-> (Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr DescriptorUpdateTemplateEntry
p -> Ptr DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorUpdateTemplateEntry
p DescriptorUpdateTemplateEntry
x (Ptr DescriptorUpdateTemplateEntry -> IO b
f Ptr DescriptorUpdateTemplateEntry
p)
  pokeCStruct :: Ptr DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> IO b -> IO b
pokeCStruct p :: Ptr DescriptorUpdateTemplateEntry
p DescriptorUpdateTemplateEntry{..} f :: IO b
f = do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
dstBinding)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
dstArrayElement)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
descriptorCount)
    Ptr DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr DescriptorType)) (DescriptorType
descriptorType)
    Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
offset))
    Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
stride))
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr DescriptorUpdateTemplateEntry -> IO b -> IO b
pokeZeroCStruct p :: Ptr DescriptorUpdateTemplateEntry
p f :: IO b
f = do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr DescriptorType)) (DescriptorType
forall a. Zero a => a
zero)
    Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
forall a. Zero a => a
zero))
    Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct DescriptorUpdateTemplateEntry where
  peekCStruct :: Ptr DescriptorUpdateTemplateEntry
-> IO DescriptorUpdateTemplateEntry
peekCStruct p :: Ptr DescriptorUpdateTemplateEntry
p = do
    Word32
dstBinding <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
    Word32
dstArrayElement <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32))
    Word32
descriptorCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32))
    DescriptorType
descriptorType <- Ptr DescriptorType -> IO DescriptorType
forall a. Storable a => Ptr a -> IO a
peek @DescriptorType ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr DescriptorType))
    CSize
offset <- Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr CSize))
    CSize
stride <- Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek @CSize ((Ptr DescriptorUpdateTemplateEntry
p Ptr DescriptorUpdateTemplateEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr CSize))
    DescriptorUpdateTemplateEntry -> IO DescriptorUpdateTemplateEntry
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorUpdateTemplateEntry -> IO DescriptorUpdateTemplateEntry)
-> DescriptorUpdateTemplateEntry
-> IO DescriptorUpdateTemplateEntry
forall a b. (a -> b) -> a -> b
$ Word32
-> Word32
-> Word32
-> DescriptorType
-> Word64
-> Word64
-> DescriptorUpdateTemplateEntry
DescriptorUpdateTemplateEntry
             Word32
dstBinding Word32
dstArrayElement Word32
descriptorCount DescriptorType
descriptorType ((\(CSize a :: Word64
a) -> Word64
a) CSize
offset) ((\(CSize a :: Word64
a) -> Word64
a) CSize
stride)

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

instance Zero DescriptorUpdateTemplateEntry where
  zero :: DescriptorUpdateTemplateEntry
zero = Word32
-> Word32
-> Word32
-> DescriptorType
-> Word64
-> Word64
-> DescriptorUpdateTemplateEntry
DescriptorUpdateTemplateEntry
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           DescriptorType
forall a. Zero a => a
zero
           Word64
forall a. Zero a => a
zero
           Word64
forall a. Zero a => a
zero


-- | VkDescriptorUpdateTemplateCreateInfo - Structure specifying parameters
-- of a newly created descriptor update template
--
-- == Valid Usage
--
-- -   If @templateType@ is
--     'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET',
--     @descriptorSetLayout@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorSetLayout' handle
--
-- -   If @templateType@ is
--     'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR',
--     @pipelineBindPoint@ /must/ be a valid
--     'Vulkan.Core10.Enums.PipelineBindPoint.PipelineBindPoint' value
--
-- -   If @templateType@ is
--     'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR',
--     @pipelineLayout@ /must/ be a valid
--     'Vulkan.Core10.Handles.PipelineLayout' handle
--
-- -   If @templateType@ is
--     'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR',
--     @set@ /must/ be the unique set number in the pipeline layout that
--     uses a descriptor set layout that was created with
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR'
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO'
--
-- -   @pNext@ /must/ be @NULL@
--
-- -   @flags@ /must/ be @0@
--
-- -   @pDescriptorUpdateEntries@ /must/ be a valid pointer to an array of
--     @descriptorUpdateEntryCount@ valid 'DescriptorUpdateTemplateEntry'
--     structures
--
-- -   @templateType@ /must/ be a valid
--     'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DescriptorUpdateTemplateType'
--     value
--
-- -   @descriptorUpdateEntryCount@ /must/ be greater than @0@
--
-- -   Both of @descriptorSetLayout@, and @pipelineLayout@ that are valid
--     handles of non-ignored parameters /must/ have been created,
--     allocated, or retrieved from the same 'Vulkan.Core10.Handles.Device'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorSetLayout',
-- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateCreateFlags.DescriptorUpdateTemplateCreateFlags',
-- 'DescriptorUpdateTemplateEntry',
-- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DescriptorUpdateTemplateType',
-- 'Vulkan.Core10.Enums.PipelineBindPoint.PipelineBindPoint',
-- 'Vulkan.Core10.Handles.PipelineLayout',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createDescriptorUpdateTemplate',
-- 'Vulkan.Extensions.VK_KHR_descriptor_update_template.createDescriptorUpdateTemplateKHR'
data DescriptorUpdateTemplateCreateInfo = DescriptorUpdateTemplateCreateInfo
  { -- | @flags@ is reserved for future use.
    DescriptorUpdateTemplateCreateInfo
-> DescriptorUpdateTemplateCreateFlags
flags :: DescriptorUpdateTemplateCreateFlags
  , -- | @pDescriptorUpdateEntries@ is a pointer to an array of
    -- 'DescriptorUpdateTemplateEntry' structures describing the descriptors to
    -- be updated by the descriptor update template.
    DescriptorUpdateTemplateCreateInfo
-> Vector DescriptorUpdateTemplateEntry
descriptorUpdateEntries :: Vector DescriptorUpdateTemplateEntry
  , -- | @templateType@ Specifies the type of the descriptor update template. If
    -- set to
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET'
    -- it /can/ only be used to update descriptor sets with a fixed
    -- @descriptorSetLayout@. If set to
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR'
    -- it /can/ only be used to push descriptor sets using the provided
    -- @pipelineBindPoint@, @pipelineLayout@, and @set@ number.
    DescriptorUpdateTemplateCreateInfo -> DescriptorUpdateTemplateType
templateType :: DescriptorUpdateTemplateType
  , -- | @descriptorSetLayout@ is the descriptor set layout the parameter update
    -- template will be used with. All descriptor sets which are going to be
    -- updated through the newly created descriptor update template /must/ be
    -- created with this layout. @descriptorSetLayout@ is the descriptor set
    -- layout used to build the descriptor update template. All descriptor sets
    -- which are going to be updated through the newly created descriptor
    -- update template /must/ be created with a layout that matches (is the
    -- same as, or defined identically to) this layout. This parameter is
    -- ignored if @templateType@ is not
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET'.
    DescriptorUpdateTemplateCreateInfo -> DescriptorSetLayout
descriptorSetLayout :: DescriptorSetLayout
  , -- | @pipelineBindPoint@ is a
    -- 'Vulkan.Core10.Enums.PipelineBindPoint.PipelineBindPoint' indicating the
    -- type of the pipeline that will use the descriptors. This parameter is
    -- ignored if @templateType@ is not
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR'
    DescriptorUpdateTemplateCreateInfo -> PipelineBindPoint
pipelineBindPoint :: PipelineBindPoint
  , -- | @pipelineLayout@ is a 'Vulkan.Core10.Handles.PipelineLayout' object used
    -- to program the bindings. This parameter is ignored if @templateType@ is
    -- not
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR'
    DescriptorUpdateTemplateCreateInfo -> PipelineLayout
pipelineLayout :: PipelineLayout
  , -- | @set@ is the set number of the descriptor set in the pipeline layout
    -- that will be updated. This parameter is ignored if @templateType@ is not
    -- 'Vulkan.Core11.Enums.DescriptorUpdateTemplateType.DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR'
    DescriptorUpdateTemplateCreateInfo -> Word32
set :: Word32
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorUpdateTemplateCreateInfo)
#endif
deriving instance Show DescriptorUpdateTemplateCreateInfo

instance ToCStruct DescriptorUpdateTemplateCreateInfo where
  withCStruct :: DescriptorUpdateTemplateCreateInfo
-> (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
    -> IO b)
-> IO b
withCStruct x :: DescriptorUpdateTemplateCreateInfo
x f :: ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo) -> IO b
f = Int
-> Int
-> (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 72 8 ((("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
  -> IO b)
 -> IO b)
-> (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p -> ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> DescriptorUpdateTemplateCreateInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p DescriptorUpdateTemplateCreateInfo
x (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo) -> IO b
f "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p)
  pokeCStruct :: ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> DescriptorUpdateTemplateCreateInfo -> IO b -> IO b
pokeCStruct p :: "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p DescriptorUpdateTemplateCreateInfo{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorUpdateTemplateCreateFlags
-> DescriptorUpdateTemplateCreateFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorUpdateTemplateCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DescriptorUpdateTemplateCreateFlags)) (DescriptorUpdateTemplateCreateFlags
flags)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector DescriptorUpdateTemplateEntry -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorUpdateTemplateEntry -> Int)
-> Vector DescriptorUpdateTemplateEntry -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorUpdateTemplateEntry
descriptorUpdateEntries)) :: Word32))
    Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries' <- ((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorUpdateTemplateEntry)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorUpdateTemplateEntry))
-> ((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorUpdateTemplateEntry)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @DescriptorUpdateTemplateEntry ((Vector DescriptorUpdateTemplateEntry -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorUpdateTemplateEntry
descriptorUpdateEntries)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 32) 8
    (Int -> DescriptorUpdateTemplateEntry -> ContT b IO ())
-> Vector DescriptorUpdateTemplateEntry -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: DescriptorUpdateTemplateEntry
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries' Ptr DescriptorUpdateTemplateEntry
-> Int -> Ptr DescriptorUpdateTemplateEntry
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (32 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorUpdateTemplateEntry) (DescriptorUpdateTemplateEntry
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector DescriptorUpdateTemplateEntry
descriptorUpdateEntries)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr DescriptorUpdateTemplateEntry)
-> Ptr DescriptorUpdateTemplateEntry -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr (Ptr DescriptorUpdateTemplateEntry)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr DescriptorUpdateTemplateEntry))) (Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries')
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorUpdateTemplateType
-> DescriptorUpdateTemplateType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorUpdateTemplateType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr DescriptorUpdateTemplateType)) (DescriptorUpdateTemplateType
templateType)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorSetLayout -> DescriptorSetLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorSetLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr DescriptorSetLayout)) (DescriptorSetLayout
descriptorSetLayout)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr PipelineBindPoint -> PipelineBindPoint -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineBindPoint
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr PipelineBindPoint)) (PipelineBindPoint
pipelineBindPoint)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr PipelineLayout -> PipelineLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr PipelineLayout)) (PipelineLayout
pipelineLayout)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr Word32)) (Word32
set)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 72
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> IO b -> IO b
pokeZeroCStruct p :: "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ("data" ::: Ptr ()) -> ("data" ::: Ptr ()) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr ("data" ::: Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) ("data" ::: Ptr ()
forall a. Ptr a
nullPtr)
    Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries' <- ((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorUpdateTemplateEntry)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorUpdateTemplateEntry))
-> ((Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorUpdateTemplateEntry)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr DescriptorUpdateTemplateEntry -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @DescriptorUpdateTemplateEntry ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 32) 8
    (Int -> DescriptorUpdateTemplateEntry -> ContT b IO ())
-> Vector DescriptorUpdateTemplateEntry -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: DescriptorUpdateTemplateEntry
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateEntry -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries' Ptr DescriptorUpdateTemplateEntry
-> Int -> Ptr DescriptorUpdateTemplateEntry
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (32 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorUpdateTemplateEntry) (DescriptorUpdateTemplateEntry
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector DescriptorUpdateTemplateEntry
forall a. Monoid a => a
mempty)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr DescriptorUpdateTemplateEntry)
-> Ptr DescriptorUpdateTemplateEntry -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr (Ptr DescriptorUpdateTemplateEntry)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr DescriptorUpdateTemplateEntry))) (Ptr DescriptorUpdateTemplateEntry
pPDescriptorUpdateEntries')
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorUpdateTemplateType
-> DescriptorUpdateTemplateType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorUpdateTemplateType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr DescriptorUpdateTemplateType)) (DescriptorUpdateTemplateType
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorSetLayout -> DescriptorSetLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorSetLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr DescriptorSetLayout)) (DescriptorSetLayout
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr PipelineBindPoint -> PipelineBindPoint -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineBindPoint
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr PipelineBindPoint)) (PipelineBindPoint
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr PipelineLayout -> PipelineLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr PipelineLayout)) (PipelineLayout
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct DescriptorUpdateTemplateCreateInfo where
  peekCStruct :: ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> IO DescriptorUpdateTemplateCreateInfo
peekCStruct p :: "pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p = do
    DescriptorUpdateTemplateCreateFlags
flags <- Ptr DescriptorUpdateTemplateCreateFlags
-> IO DescriptorUpdateTemplateCreateFlags
forall a. Storable a => Ptr a -> IO a
peek @DescriptorUpdateTemplateCreateFlags (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorUpdateTemplateCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DescriptorUpdateTemplateCreateFlags))
    Word32
descriptorUpdateEntryCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    Ptr DescriptorUpdateTemplateEntry
pDescriptorUpdateEntries <- Ptr (Ptr DescriptorUpdateTemplateEntry)
-> IO (Ptr DescriptorUpdateTemplateEntry)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorUpdateTemplateEntry) (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr (Ptr DescriptorUpdateTemplateEntry)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr DescriptorUpdateTemplateEntry)))
    Vector DescriptorUpdateTemplateEntry
pDescriptorUpdateEntries' <- Int
-> (Int -> IO DescriptorUpdateTemplateEntry)
-> IO (Vector DescriptorUpdateTemplateEntry)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
descriptorUpdateEntryCount) (\i :: Int
i -> Ptr DescriptorUpdateTemplateEntry
-> IO DescriptorUpdateTemplateEntry
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DescriptorUpdateTemplateEntry ((Ptr DescriptorUpdateTemplateEntry
pDescriptorUpdateEntries Ptr DescriptorUpdateTemplateEntry
-> Int -> Ptr DescriptorUpdateTemplateEntry
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (32 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorUpdateTemplateEntry)))
    DescriptorUpdateTemplateType
templateType <- Ptr DescriptorUpdateTemplateType -> IO DescriptorUpdateTemplateType
forall a. Storable a => Ptr a -> IO a
peek @DescriptorUpdateTemplateType (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorUpdateTemplateType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr DescriptorUpdateTemplateType))
    DescriptorSetLayout
descriptorSetLayout <- Ptr DescriptorSetLayout -> IO DescriptorSetLayout
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSetLayout (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr DescriptorSetLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr DescriptorSetLayout))
    PipelineBindPoint
pipelineBindPoint <- Ptr PipelineBindPoint -> IO PipelineBindPoint
forall a. Storable a => Ptr a -> IO a
peek @PipelineBindPoint (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineBindPoint
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 48 :: Ptr PipelineBindPoint))
    PipelineLayout
pipelineLayout <- Ptr PipelineLayout -> IO PipelineLayout
forall a. Storable a => Ptr a -> IO a
peek @PipelineLayout (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr PipelineLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr PipelineLayout))
    Word32
set <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo
p ("pCreateInfo" ::: Ptr DescriptorUpdateTemplateCreateInfo)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr Word32))
    DescriptorUpdateTemplateCreateInfo
-> IO DescriptorUpdateTemplateCreateInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorUpdateTemplateCreateInfo
 -> IO DescriptorUpdateTemplateCreateInfo)
-> DescriptorUpdateTemplateCreateInfo
-> IO DescriptorUpdateTemplateCreateInfo
forall a b. (a -> b) -> a -> b
$ DescriptorUpdateTemplateCreateFlags
-> Vector DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateType
-> DescriptorSetLayout
-> PipelineBindPoint
-> PipelineLayout
-> Word32
-> DescriptorUpdateTemplateCreateInfo
DescriptorUpdateTemplateCreateInfo
             DescriptorUpdateTemplateCreateFlags
flags Vector DescriptorUpdateTemplateEntry
pDescriptorUpdateEntries' DescriptorUpdateTemplateType
templateType DescriptorSetLayout
descriptorSetLayout PipelineBindPoint
pipelineBindPoint PipelineLayout
pipelineLayout Word32
set

instance Zero DescriptorUpdateTemplateCreateInfo where
  zero :: DescriptorUpdateTemplateCreateInfo
zero = DescriptorUpdateTemplateCreateFlags
-> Vector DescriptorUpdateTemplateEntry
-> DescriptorUpdateTemplateType
-> DescriptorSetLayout
-> PipelineBindPoint
-> PipelineLayout
-> Word32
-> DescriptorUpdateTemplateCreateInfo
DescriptorUpdateTemplateCreateInfo
           DescriptorUpdateTemplateCreateFlags
forall a. Zero a => a
zero
           Vector DescriptorUpdateTemplateEntry
forall a. Monoid a => a
mempty
           DescriptorUpdateTemplateType
forall a. Zero a => a
zero
           DescriptorSetLayout
forall a. Zero a => a
zero
           PipelineBindPoint
forall a. Zero a => a
zero
           PipelineLayout
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero