{-# language CPP #-}
-- No documentation found for Chapter "DescriptorSet"
module Vulkan.Core10.DescriptorSet  ( createDescriptorSetLayout
                                    , withDescriptorSetLayout
                                    , destroyDescriptorSetLayout
                                    , createDescriptorPool
                                    , withDescriptorPool
                                    , destroyDescriptorPool
                                    , resetDescriptorPool
                                    , allocateDescriptorSets
                                    , withDescriptorSets
                                    , freeDescriptorSets
                                    , updateDescriptorSets
                                    , DescriptorBufferInfo(..)
                                    , DescriptorImageInfo(..)
                                    , WriteDescriptorSet(..)
                                    , CopyDescriptorSet(..)
                                    , DescriptorSetLayoutBinding(..)
                                    , DescriptorSetLayoutCreateInfo(..)
                                    , DescriptorPoolSize(..)
                                    , DescriptorPoolCreateInfo(..)
                                    , DescriptorSetAllocateInfo(..)
                                    , DescriptorSet(..)
                                    , DescriptorSetLayout(..)
                                    , DescriptorPool(..)
                                    , DescriptorPoolResetFlags(..)
                                    , DescriptorType(..)
                                    , DescriptorPoolCreateFlagBits(..)
                                    , DescriptorPoolCreateFlags
                                    , DescriptorSetLayoutCreateFlagBits(..)
                                    , DescriptorSetLayoutCreateFlags
                                    ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
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 (castPtr)
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 qualified Data.Vector (null)
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.Type.Equality ((:~:)(Refl))
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 Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.CStruct.Extends (pokeSomeCStruct)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.Handles (Buffer)
import Vulkan.Core10.Handles (BufferView)
import Vulkan.CStruct.Extends (Chain)
import Vulkan.Core10.Handles (DescriptorPool)
import Vulkan.Core10.Handles (DescriptorPool(..))
import Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits (DescriptorPoolCreateFlags)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_inline_uniform_block (DescriptorPoolInlineUniformBlockCreateInfoEXT)
import Vulkan.Core10.Enums.DescriptorPoolResetFlags (DescriptorPoolResetFlags)
import Vulkan.Core10.Enums.DescriptorPoolResetFlags (DescriptorPoolResetFlags(..))
import Vulkan.Core10.Handles (DescriptorSet)
import Vulkan.Core10.Handles (DescriptorSet(..))
import Vulkan.Core10.Handles (DescriptorSetLayout)
import Vulkan.Core10.Handles (DescriptorSetLayout(..))
import {-# SOURCE #-} Vulkan.Core12.Promoted_From_VK_EXT_descriptor_indexing (DescriptorSetLayoutBindingFlagsCreateInfo)
import Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits (DescriptorSetLayoutCreateFlags)
import {-# SOURCE #-} Vulkan.Core12.Promoted_From_VK_EXT_descriptor_indexing (DescriptorSetVariableDescriptorCountAllocateInfo)
import Vulkan.Core10.Enums.DescriptorType (DescriptorType)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkAllocateDescriptorSets))
import Vulkan.Dynamic (DeviceCmds(pVkCreateDescriptorPool))
import Vulkan.Dynamic (DeviceCmds(pVkCreateDescriptorSetLayout))
import Vulkan.Dynamic (DeviceCmds(pVkDestroyDescriptorPool))
import Vulkan.Dynamic (DeviceCmds(pVkDestroyDescriptorSetLayout))
import Vulkan.Dynamic (DeviceCmds(pVkFreeDescriptorSets))
import Vulkan.Dynamic (DeviceCmds(pVkResetDescriptorPool))
import Vulkan.Dynamic (DeviceCmds(pVkUpdateDescriptorSets))
import Vulkan.Core10.FundamentalTypes (DeviceSize)
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.Core10.Enums.ImageLayout (ImageLayout)
import Vulkan.Core10.Handles (ImageView)
import {-# SOURCE #-} Vulkan.Extensions.VK_VALVE_mutable_descriptor_type (MutableDescriptorTypeCreateInfoVALVE)
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Sampler)
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlags)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_acceleration_structure (WriteDescriptorSetAccelerationStructureKHR)
import {-# SOURCE #-} Vulkan.Extensions.VK_NV_ray_tracing (WriteDescriptorSetAccelerationStructureNV)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_inline_uniform_block (WriteDescriptorSetInlineUniformBlockEXT)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COPY_DESCRIPTOR_SET))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.Handles (DescriptorPool(..))
import Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits (DescriptorPoolCreateFlagBits(..))
import Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits (DescriptorPoolCreateFlags)
import Vulkan.Core10.Enums.DescriptorPoolResetFlags (DescriptorPoolResetFlags(..))
import Vulkan.Core10.Handles (DescriptorSet(..))
import Vulkan.Core10.Handles (DescriptorSetLayout(..))
import Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits (DescriptorSetLayoutCreateFlagBits(..))
import Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits (DescriptorSetLayoutCreateFlags)
import Vulkan.Core10.Enums.DescriptorType (DescriptorType(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateDescriptorSetLayout
  :: FunPtr (Ptr Device_T -> Ptr (SomeStruct DescriptorSetLayoutCreateInfo) -> Ptr AllocationCallbacks -> Ptr DescriptorSetLayout -> IO Result) -> Ptr Device_T -> Ptr (SomeStruct DescriptorSetLayoutCreateInfo) -> Ptr AllocationCallbacks -> Ptr DescriptorSetLayout -> IO Result

-- | vkCreateDescriptorSetLayout - Create a new descriptor set layout
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateDescriptorSetLayout-device-parameter# @device@ /must/
--     be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkCreateDescriptorSetLayout-pCreateInfo-parameter#
--     @pCreateInfo@ /must/ be a valid pointer to a valid
--     'DescriptorSetLayoutCreateInfo' structure
--
-- -   #VUID-vkCreateDescriptorSetLayout-pAllocator-parameter# If
--     @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid pointer
--     to a valid 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks'
--     structure
--
-- -   #VUID-vkCreateDescriptorSetLayout-pSetLayout-parameter# @pSetLayout@
--     /must/ be a valid pointer to a
--     'Vulkan.Core10.Handles.DescriptorSetLayout' 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.Core10.Handles.DescriptorSetLayout',
-- 'DescriptorSetLayoutCreateInfo', 'Vulkan.Core10.Handles.Device'
createDescriptorSetLayout :: forall a io
                           . (Extendss DescriptorSetLayoutCreateInfo a, PokeChain a, MonadIO io)
                          => -- | @device@ is the logical device that creates the descriptor set layout.
                             Device
                          -> -- | @pCreateInfo@ is a pointer to a 'DescriptorSetLayoutCreateInfo'
                             -- structure specifying the state of the descriptor set layout object.
                             (DescriptorSetLayoutCreateInfo a)
                          -> -- | @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 (DescriptorSetLayout)
createDescriptorSetLayout :: Device
-> DescriptorSetLayoutCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorSetLayout
createDescriptorSetLayout Device
device DescriptorSetLayoutCreateInfo a
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = IO DescriptorSetLayout -> io DescriptorSetLayout
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DescriptorSetLayout -> io DescriptorSetLayout)
-> (ContT DescriptorSetLayout IO DescriptorSetLayout
    -> IO DescriptorSetLayout)
-> ContT DescriptorSetLayout IO DescriptorSetLayout
-> io DescriptorSetLayout
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT DescriptorSetLayout IO DescriptorSetLayout
-> IO DescriptorSetLayout
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT DescriptorSetLayout IO DescriptorSetLayout
 -> io DescriptorSetLayout)
-> ContT DescriptorSetLayout IO DescriptorSetLayout
-> io DescriptorSetLayout
forall a b. (a -> b) -> a -> b
$ do
  let vkCreateDescriptorSetLayoutPtr :: FunPtr
  (Ptr Device_T
   -> ("pCreateInfo"
       ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
vkCreateDescriptorSetLayoutPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo"
          ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
      -> IO Result)
pVkCreateDescriptorSetLayout (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT DescriptorSetLayout IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorSetLayout IO ())
-> IO () -> ContT DescriptorSetLayout 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 (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
vkCreateDescriptorSetLayoutPtr FunPtr
  (Ptr Device_T
   -> ("pCreateInfo"
       ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo"
          ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pCreateInfo"
       ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateDescriptorSetLayout is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCreateDescriptorSetLayout' :: Ptr Device_T
-> ("pCreateInfo"
    ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO Result
vkCreateDescriptorSetLayout' = FunPtr
  (Ptr Device_T
   -> ("pCreateInfo"
       ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
-> Ptr Device_T
-> ("pCreateInfo"
    ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO Result
mkVkCreateDescriptorSetLayout FunPtr
  (Ptr Device_T
   -> ("pCreateInfo"
       ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO Result)
vkCreateDescriptorSetLayoutPtr
  Ptr (DescriptorSetLayoutCreateInfo a)
pCreateInfo <- ((Ptr (DescriptorSetLayoutCreateInfo a) -> IO DescriptorSetLayout)
 -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout IO (Ptr (DescriptorSetLayoutCreateInfo a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (DescriptorSetLayoutCreateInfo a) -> IO DescriptorSetLayout)
  -> IO DescriptorSetLayout)
 -> ContT
      DescriptorSetLayout IO (Ptr (DescriptorSetLayoutCreateInfo a)))
-> ((Ptr (DescriptorSetLayoutCreateInfo a)
     -> IO DescriptorSetLayout)
    -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout IO (Ptr (DescriptorSetLayoutCreateInfo a))
forall a b. (a -> b) -> a -> b
$ DescriptorSetLayoutCreateInfo a
-> (Ptr (DescriptorSetLayoutCreateInfo a)
    -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DescriptorSetLayoutCreateInfo a
createInfo)
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
Nothing -> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ContT
     DescriptorSetLayout IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pAllocator" ::: Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just AllocationCallbacks
j -> ((("pAllocator" ::: Ptr AllocationCallbacks)
  -> IO DescriptorSetLayout)
 -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout 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 DescriptorSetLayout)
  -> IO DescriptorSetLayout)
 -> ContT
      DescriptorSetLayout IO ("pAllocator" ::: Ptr AllocationCallbacks))
-> ((("pAllocator" ::: Ptr AllocationCallbacks)
     -> IO DescriptorSetLayout)
    -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (("pAllocator" ::: Ptr AllocationCallbacks)
    -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  "pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayout <- ((("pSetLayout" ::: Ptr DescriptorSetLayout)
  -> IO DescriptorSetLayout)
 -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSetLayout" ::: Ptr DescriptorSetLayout)
   -> IO DescriptorSetLayout)
  -> IO DescriptorSetLayout)
 -> ContT
      DescriptorSetLayout IO ("pSetLayout" ::: Ptr DescriptorSetLayout))
-> ((("pSetLayout" ::: Ptr DescriptorSetLayout)
     -> IO DescriptorSetLayout)
    -> IO DescriptorSetLayout)
-> ContT
     DescriptorSetLayout IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a b. (a -> b) -> a -> b
$ IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> (("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO ())
-> (("pSetLayout" ::: Ptr DescriptorSetLayout)
    -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a. Int -> IO (Ptr a)
callocBytes @DescriptorSetLayout Int
8) ("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT DescriptorSetLayout IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT DescriptorSetLayout IO Result)
-> IO Result -> ContT DescriptorSetLayout IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkCreateDescriptorSetLayout" (Ptr Device_T
-> ("pCreateInfo"
    ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO Result
vkCreateDescriptorSetLayout' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Ptr (DescriptorSetLayoutCreateInfo a)
-> "pCreateInfo" ::: Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (DescriptorSetLayoutCreateInfo a)
pCreateInfo) "pAllocator" ::: Ptr AllocationCallbacks
pAllocator ("pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayout))
  IO () -> ContT DescriptorSetLayout IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorSetLayout IO ())
-> IO () -> ContT DescriptorSetLayout 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))
  DescriptorSetLayout
pSetLayout <- IO DescriptorSetLayout
-> ContT DescriptorSetLayout IO DescriptorSetLayout
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO DescriptorSetLayout
 -> ContT DescriptorSetLayout IO DescriptorSetLayout)
-> IO DescriptorSetLayout
-> ContT DescriptorSetLayout IO DescriptorSetLayout
forall a b. (a -> b) -> a -> b
$ ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSetLayout "pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayout
  DescriptorSetLayout
-> ContT DescriptorSetLayout IO DescriptorSetLayout
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorSetLayout
 -> ContT DescriptorSetLayout IO DescriptorSetLayout)
-> DescriptorSetLayout
-> ContT DescriptorSetLayout IO DescriptorSetLayout
forall a b. (a -> b) -> a -> b
$ (DescriptorSetLayout
pSetLayout)

-- | A convenience wrapper to make a compatible pair of calls to
-- 'createDescriptorSetLayout' and 'destroyDescriptorSetLayout'
--
-- To ensure that 'destroyDescriptorSetLayout' 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.
--
withDescriptorSetLayout :: forall a io r . (Extendss DescriptorSetLayoutCreateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorSetLayoutCreateInfo a -> Maybe AllocationCallbacks -> (io DescriptorSetLayout -> (DescriptorSetLayout -> io ()) -> r) -> r
withDescriptorSetLayout :: Device
-> DescriptorSetLayoutCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> (io DescriptorSetLayout -> (DescriptorSetLayout -> io ()) -> r)
-> r
withDescriptorSetLayout Device
device DescriptorSetLayoutCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator io DescriptorSetLayout -> (DescriptorSetLayout -> io ()) -> r
b =
  io DescriptorSetLayout -> (DescriptorSetLayout -> io ()) -> r
b (Device
-> DescriptorSetLayoutCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorSetLayout
forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorSetLayoutCreateInfo a, PokeChain a,
 MonadIO io) =>
Device
-> DescriptorSetLayoutCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorSetLayout
createDescriptorSetLayout Device
device DescriptorSetLayoutCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator)
    (\(DescriptorSetLayout
o0) -> Device
-> DescriptorSetLayout
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorSetLayout
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorSetLayout Device
device DescriptorSetLayout
o0 "allocator" ::: Maybe AllocationCallbacks
pAllocator)


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

-- | vkDestroyDescriptorSetLayout - Destroy a descriptor set layout object
--
-- == Valid Usage
--
-- -   #VUID-vkDestroyDescriptorSetLayout-descriptorSetLayout-00284# If
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorSetLayout@ was created, a compatible set of
--     callbacks /must/ be provided here
--
-- -   #VUID-vkDestroyDescriptorSetLayout-descriptorSetLayout-00285# If no
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorSetLayout@ was created, @pAllocator@ /must/
--     be @NULL@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkDestroyDescriptorSetLayout-device-parameter# @device@ /must/
--     be a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkDestroyDescriptorSetLayout-descriptorSetLayout-parameter# If
--     @descriptorSetLayout@ is not
--     'Vulkan.Core10.APIConstants.NULL_HANDLE', @descriptorSetLayout@
--     /must/ be a valid 'Vulkan.Core10.Handles.DescriptorSetLayout' handle
--
-- -   #VUID-vkDestroyDescriptorSetLayout-pAllocator-parameter# If
--     @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid pointer
--     to a valid 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks'
--     structure
--
-- -   #VUID-vkDestroyDescriptorSetLayout-descriptorSetLayout-parent# If
--     @descriptorSetLayout@ is a valid handle, it /must/ have been
--     created, allocated, or retrieved from @device@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorSetLayout@ /must/ be externally
--     synchronized
--
-- = See Also
--
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.DescriptorSetLayout',
-- 'Vulkan.Core10.Handles.Device'
destroyDescriptorSetLayout :: forall io
                            . (MonadIO io)
                           => -- | @device@ is the logical device that destroys the descriptor set layout.
                              Device
                           -> -- | @descriptorSetLayout@ is the descriptor set layout to destroy.
                              DescriptorSetLayout
                           -> -- | @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 ()
destroyDescriptorSetLayout :: Device
-> DescriptorSetLayout
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorSetLayout Device
device DescriptorSetLayout
descriptorSetLayout "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 vkDestroyDescriptorSetLayoutPtr :: FunPtr
  (Ptr Device_T
   -> DescriptorSetLayout
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorSetLayoutPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorSetLayout
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
pVkDestroyDescriptorSetLayout (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
   -> DescriptorSetLayout
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorSetLayoutPtr FunPtr
  (Ptr Device_T
   -> DescriptorSetLayout
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> DescriptorSetLayout
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorSetLayout
   -> ("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 String
"" String
"The function pointer for vkDestroyDescriptorSetLayout is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkDestroyDescriptorSetLayout' :: Ptr Device_T
-> DescriptorSetLayout
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorSetLayout' = FunPtr
  (Ptr Device_T
   -> DescriptorSetLayout
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> Ptr Device_T
-> DescriptorSetLayout
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
mkVkDestroyDescriptorSetLayout FunPtr
  (Ptr Device_T
   -> DescriptorSetLayout
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorSetLayoutPtr
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
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 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
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkDestroyDescriptorSetLayout" (Ptr Device_T
-> DescriptorSetLayout
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorSetLayout' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorSetLayout
descriptorSetLayout) "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" mkVkCreateDescriptorPool
  :: FunPtr (Ptr Device_T -> Ptr (SomeStruct DescriptorPoolCreateInfo) -> Ptr AllocationCallbacks -> Ptr DescriptorPool -> IO Result) -> Ptr Device_T -> Ptr (SomeStruct DescriptorPoolCreateInfo) -> Ptr AllocationCallbacks -> Ptr DescriptorPool -> IO Result

-- | vkCreateDescriptorPool - Creates a descriptor pool object
--
-- = Description
--
-- The created descriptor pool is returned in @pDescriptorPool@.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateDescriptorPool-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkCreateDescriptorPool-pCreateInfo-parameter# @pCreateInfo@
--     /must/ be a valid pointer to a valid 'DescriptorPoolCreateInfo'
--     structure
--
-- -   #VUID-vkCreateDescriptorPool-pAllocator-parameter# If @pAllocator@
--     is not @NULL@, @pAllocator@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   #VUID-vkCreateDescriptorPool-pDescriptorPool-parameter#
--     @pDescriptorPool@ /must/ be a valid pointer to a
--     'Vulkan.Core10.Handles.DescriptorPool' 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'
--
--     -   'Vulkan.Extensions.VK_EXT_descriptor_indexing.ERROR_FRAGMENTATION_EXT'
--
-- = See Also
--
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.DescriptorPool', 'DescriptorPoolCreateInfo',
-- 'Vulkan.Core10.Handles.Device'
createDescriptorPool :: forall a io
                      . (Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io)
                     => -- | @device@ is the logical device that creates the descriptor pool.
                        Device
                     -> -- | @pCreateInfo@ is a pointer to a 'DescriptorPoolCreateInfo' structure
                        -- specifying the state of the descriptor pool object.
                        (DescriptorPoolCreateInfo a)
                     -> -- | @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 (DescriptorPool)
createDescriptorPool :: Device
-> DescriptorPoolCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorPool
createDescriptorPool Device
device DescriptorPoolCreateInfo a
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = IO DescriptorPool -> io DescriptorPool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DescriptorPool -> io DescriptorPool)
-> (ContT DescriptorPool IO DescriptorPool -> IO DescriptorPool)
-> ContT DescriptorPool IO DescriptorPool
-> io DescriptorPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT DescriptorPool IO DescriptorPool -> IO DescriptorPool
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT DescriptorPool IO DescriptorPool -> io DescriptorPool)
-> ContT DescriptorPool IO DescriptorPool -> io DescriptorPool
forall a b. (a -> b) -> a -> b
$ do
  let vkCreateDescriptorPoolPtr :: FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
vkCreateDescriptorPoolPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pDescriptorPool" ::: Ptr DescriptorPool)
      -> IO Result)
pVkCreateDescriptorPool (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT DescriptorPool IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorPool IO ())
-> IO () -> ContT DescriptorPool 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 (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
vkCreateDescriptorPoolPtr FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pDescriptorPool" ::: Ptr DescriptorPool)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateDescriptorPool is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCreateDescriptorPool' :: Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorPool" ::: Ptr DescriptorPool)
-> IO Result
vkCreateDescriptorPool' = FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
-> Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorPool" ::: Ptr DescriptorPool)
-> IO Result
mkVkCreateDescriptorPool FunPtr
  (Ptr Device_T
   -> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pDescriptorPool" ::: Ptr DescriptorPool)
   -> IO Result)
vkCreateDescriptorPoolPtr
  Ptr (DescriptorPoolCreateInfo a)
pCreateInfo <- ((Ptr (DescriptorPoolCreateInfo a) -> IO DescriptorPool)
 -> IO DescriptorPool)
-> ContT DescriptorPool IO (Ptr (DescriptorPoolCreateInfo a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (DescriptorPoolCreateInfo a) -> IO DescriptorPool)
  -> IO DescriptorPool)
 -> ContT DescriptorPool IO (Ptr (DescriptorPoolCreateInfo a)))
-> ((Ptr (DescriptorPoolCreateInfo a) -> IO DescriptorPool)
    -> IO DescriptorPool)
-> ContT DescriptorPool IO (Ptr (DescriptorPoolCreateInfo a))
forall a b. (a -> b) -> a -> b
$ DescriptorPoolCreateInfo a
-> (Ptr (DescriptorPoolCreateInfo a) -> IO DescriptorPool)
-> IO DescriptorPool
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DescriptorPoolCreateInfo a
createInfo)
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
Nothing -> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ContT
     DescriptorPool IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall (f :: * -> *) a. Applicative f => a -> f a
pure "pAllocator" ::: Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
    Just AllocationCallbacks
j -> ((("pAllocator" ::: Ptr AllocationCallbacks) -> IO DescriptorPool)
 -> IO DescriptorPool)
-> ContT
     DescriptorPool 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 DescriptorPool)
  -> IO DescriptorPool)
 -> ContT
      DescriptorPool IO ("pAllocator" ::: Ptr AllocationCallbacks))
-> ((("pAllocator" ::: Ptr AllocationCallbacks)
     -> IO DescriptorPool)
    -> IO DescriptorPool)
-> ContT
     DescriptorPool IO ("pAllocator" ::: Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (("pAllocator" ::: Ptr AllocationCallbacks)
    -> IO DescriptorPool)
-> IO DescriptorPool
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
  "pDescriptorPool" ::: Ptr DescriptorPool
pPDescriptorPool <- ((("pDescriptorPool" ::: Ptr DescriptorPool) -> IO DescriptorPool)
 -> IO DescriptorPool)
-> ContT
     DescriptorPool IO ("pDescriptorPool" ::: Ptr DescriptorPool)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDescriptorPool" ::: Ptr DescriptorPool) -> IO DescriptorPool)
  -> IO DescriptorPool)
 -> ContT
      DescriptorPool IO ("pDescriptorPool" ::: Ptr DescriptorPool))
-> ((("pDescriptorPool" ::: Ptr DescriptorPool)
     -> IO DescriptorPool)
    -> IO DescriptorPool)
-> ContT
     DescriptorPool IO ("pDescriptorPool" ::: Ptr DescriptorPool)
forall a b. (a -> b) -> a -> b
$ IO ("pDescriptorPool" ::: Ptr DescriptorPool)
-> (("pDescriptorPool" ::: Ptr DescriptorPool) -> IO ())
-> (("pDescriptorPool" ::: Ptr DescriptorPool)
    -> IO DescriptorPool)
-> IO DescriptorPool
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pDescriptorPool" ::: Ptr DescriptorPool)
forall a. Int -> IO (Ptr a)
callocBytes @DescriptorPool Int
8) ("pDescriptorPool" ::: Ptr DescriptorPool) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT DescriptorPool IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT DescriptorPool IO Result)
-> IO Result -> ContT DescriptorPool IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkCreateDescriptorPool" (Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pDescriptorPool" ::: Ptr DescriptorPool)
-> IO Result
vkCreateDescriptorPool' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Ptr (DescriptorPoolCreateInfo a)
-> "pCreateInfo" ::: Ptr (SomeStruct DescriptorPoolCreateInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (DescriptorPoolCreateInfo a)
pCreateInfo) "pAllocator" ::: Ptr AllocationCallbacks
pAllocator ("pDescriptorPool" ::: Ptr DescriptorPool
pPDescriptorPool))
  IO () -> ContT DescriptorPool IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT DescriptorPool IO ())
-> IO () -> ContT DescriptorPool 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))
  DescriptorPool
pDescriptorPool <- IO DescriptorPool -> ContT DescriptorPool IO DescriptorPool
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO DescriptorPool -> ContT DescriptorPool IO DescriptorPool)
-> IO DescriptorPool -> ContT DescriptorPool IO DescriptorPool
forall a b. (a -> b) -> a -> b
$ ("pDescriptorPool" ::: Ptr DescriptorPool) -> IO DescriptorPool
forall a. Storable a => Ptr a -> IO a
peek @DescriptorPool "pDescriptorPool" ::: Ptr DescriptorPool
pPDescriptorPool
  DescriptorPool -> ContT DescriptorPool IO DescriptorPool
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorPool -> ContT DescriptorPool IO DescriptorPool)
-> DescriptorPool -> ContT DescriptorPool IO DescriptorPool
forall a b. (a -> b) -> a -> b
$ (DescriptorPool
pDescriptorPool)

-- | A convenience wrapper to make a compatible pair of calls to
-- 'createDescriptorPool' and 'destroyDescriptorPool'
--
-- To ensure that 'destroyDescriptorPool' 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.
--
withDescriptorPool :: forall a io r . (Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorPoolCreateInfo a -> Maybe AllocationCallbacks -> (io DescriptorPool -> (DescriptorPool -> io ()) -> r) -> r
withDescriptorPool :: Device
-> DescriptorPoolCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> (io DescriptorPool -> (DescriptorPool -> io ()) -> r)
-> r
withDescriptorPool Device
device DescriptorPoolCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator io DescriptorPool -> (DescriptorPool -> io ()) -> r
b =
  io DescriptorPool -> (DescriptorPool -> io ()) -> r
b (Device
-> DescriptorPoolCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorPool
forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io) =>
Device
-> DescriptorPoolCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorPool
createDescriptorPool Device
device DescriptorPoolCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator)
    (\(DescriptorPool
o0) -> Device
-> DescriptorPool
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorPool
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorPool Device
device DescriptorPool
o0 "allocator" ::: Maybe AllocationCallbacks
pAllocator)


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

-- | vkDestroyDescriptorPool - Destroy a descriptor pool object
--
-- = Description
--
-- When a pool is destroyed, all descriptor sets allocated from the pool
-- are implicitly freed and become invalid. Descriptor sets allocated from
-- a given pool do not need to be freed before destroying that descriptor
-- pool.
--
-- == Valid Usage
--
-- -   #VUID-vkDestroyDescriptorPool-descriptorPool-00303# All submitted
--     commands that refer to @descriptorPool@ (via any allocated
--     descriptor sets) /must/ have completed execution
--
-- -   #VUID-vkDestroyDescriptorPool-descriptorPool-00304# If
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorPool@ was created, a compatible set of
--     callbacks /must/ be provided here
--
-- -   #VUID-vkDestroyDescriptorPool-descriptorPool-00305# If no
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' were
--     provided when @descriptorPool@ was created, @pAllocator@ /must/ be
--     @NULL@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkDestroyDescriptorPool-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkDestroyDescriptorPool-descriptorPool-parameter# If
--     @descriptorPool@ is not 'Vulkan.Core10.APIConstants.NULL_HANDLE',
--     @descriptorPool@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorPool' handle
--
-- -   #VUID-vkDestroyDescriptorPool-pAllocator-parameter# If @pAllocator@
--     is not @NULL@, @pAllocator@ /must/ be a valid pointer to a valid
--     'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks' structure
--
-- -   #VUID-vkDestroyDescriptorPool-descriptorPool-parent# If
--     @descriptorPool@ is a valid handle, it /must/ have been created,
--     allocated, or retrieved from @device@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorPool@ /must/ be externally synchronized
--
-- = See Also
--
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'Vulkan.Core10.Handles.DescriptorPool', 'Vulkan.Core10.Handles.Device'
destroyDescriptorPool :: forall io
                       . (MonadIO io)
                      => -- | @device@ is the logical device that destroys the descriptor pool.
                         Device
                      -> -- | @descriptorPool@ is the descriptor pool to destroy.
                         DescriptorPool
                      -> -- | @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 ()
destroyDescriptorPool :: Device
-> DescriptorPool
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorPool Device
device DescriptorPool
descriptorPool "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 vkDestroyDescriptorPoolPtr :: FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorPoolPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
pVkDestroyDescriptorPool (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
   -> DescriptorPool
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorPoolPtr FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("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 String
"" String
"The function pointer for vkDestroyDescriptorPool is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkDestroyDescriptorPool' :: Ptr Device_T
-> DescriptorPool
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorPool' = FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
-> Ptr Device_T
-> DescriptorPool
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
mkVkDestroyDescriptorPool FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> IO ())
vkDestroyDescriptorPoolPtr
  "pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
    "allocator" ::: Maybe AllocationCallbacks
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 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
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkDestroyDescriptorPool" (Ptr Device_T
-> DescriptorPool
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
vkDestroyDescriptorPool' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorPool
descriptorPool) "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" mkVkResetDescriptorPool
  :: FunPtr (Ptr Device_T -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result) -> Ptr Device_T -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result

-- | vkResetDescriptorPool - Resets a descriptor pool object
--
-- = Description
--
-- Resetting a descriptor pool recycles all of the resources from all of
-- the descriptor sets allocated from the descriptor pool back to the
-- descriptor pool, and the descriptor sets are implicitly freed.
--
-- == Valid Usage
--
-- -   #VUID-vkResetDescriptorPool-descriptorPool-00313# All uses of
--     @descriptorPool@ (via any allocated descriptor sets) /must/ have
--     completed execution
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkResetDescriptorPool-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkResetDescriptorPool-descriptorPool-parameter#
--     @descriptorPool@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorPool' handle
--
-- -   #VUID-vkResetDescriptorPool-flags-zerobitmask# @flags@ /must/ be @0@
--
-- -   #VUID-vkResetDescriptorPool-descriptorPool-parent# @descriptorPool@
--     /must/ have been created, allocated, or retrieved from @device@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorPool@ /must/ be externally synchronized
--
-- -   Host access to any 'Vulkan.Core10.Handles.DescriptorSet' objects
--     allocated from @descriptorPool@ /must/ be externally synchronized
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorPool',
-- 'Vulkan.Core10.Enums.DescriptorPoolResetFlags.DescriptorPoolResetFlags',
-- 'Vulkan.Core10.Handles.Device'
resetDescriptorPool :: forall io
                     . (MonadIO io)
                    => -- | @device@ is the logical device that owns the descriptor pool.
                       Device
                    -> -- | @descriptorPool@ is the descriptor pool to be reset.
                       DescriptorPool
                    -> -- | @flags@ is reserved for future use.
                       DescriptorPoolResetFlags
                    -> io ()
resetDescriptorPool :: Device -> DescriptorPool -> DescriptorPoolResetFlags -> io ()
resetDescriptorPool Device
device DescriptorPool
descriptorPool DescriptorPoolResetFlags
flags = 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 vkResetDescriptorPoolPtr :: FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
vkResetDescriptorPoolPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
pVkResetDescriptorPool (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
vkResetDescriptorPoolPtr FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkResetDescriptorPool is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkResetDescriptorPool' :: Ptr Device_T
-> DescriptorPool -> DescriptorPoolResetFlags -> IO Result
vkResetDescriptorPool' = FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
-> Ptr Device_T
-> DescriptorPool
-> DescriptorPoolResetFlags
-> IO Result
mkVkResetDescriptorPool FunPtr
  (Ptr Device_T
   -> DescriptorPool -> DescriptorPoolResetFlags -> IO Result)
vkResetDescriptorPoolPtr
  Result
_ <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkResetDescriptorPool" (Ptr Device_T
-> DescriptorPool -> DescriptorPoolResetFlags -> IO Result
vkResetDescriptorPool' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorPool
descriptorPool) (DescriptorPoolResetFlags
flags))
  () -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkAllocateDescriptorSets
  :: FunPtr (Ptr Device_T -> Ptr (SomeStruct DescriptorSetAllocateInfo) -> Ptr DescriptorSet -> IO Result) -> Ptr Device_T -> Ptr (SomeStruct DescriptorSetAllocateInfo) -> Ptr DescriptorSet -> IO Result

-- | vkAllocateDescriptorSets - Allocate one or more descriptor sets
--
-- = Description
--
-- The allocated descriptor sets are returned in @pDescriptorSets@.
--
-- When a descriptor set is allocated, the initial state is largely
-- uninitialized and all descriptors are undefined. Descriptors also become
-- undefined if the underlying resource is destroyed. Descriptor sets
-- containing undefined descriptors /can/ still be bound and used, subject
-- to the following conditions:
--
-- -   For descriptor set bindings created with the
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT'
--     bit set, all descriptors in that binding that are dynamically used
--     /must/ have been populated before the descriptor set is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-binding consumed>.
--
-- -   For descriptor set bindings created without the
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT'
--     bit set, all descriptors in that binding that are statically used
--     /must/ have been populated before the descriptor set is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-binding consumed>.
--
-- -   Descriptor bindings with descriptor type of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--     /can/ be undefined when the descriptor set is
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-binding consumed>;
--     though values in that block will be undefined.
--
-- -   Entries that are not used by a pipeline /can/ have undefined
--     descriptors.
--
-- If a call to 'allocateDescriptorSets' would cause the total number of
-- descriptor sets allocated from the pool to exceed the value of
-- 'DescriptorPoolCreateInfo'::@maxSets@ used to create
-- @pAllocateInfo->descriptorPool@, then the allocation /may/ fail due to
-- lack of space in the descriptor pool. Similarly, the allocation /may/
-- fail due to lack of space if the call to 'allocateDescriptorSets' would
-- cause the number of any given descriptor type to exceed the sum of all
-- the @descriptorCount@ members of each element of
-- 'DescriptorPoolCreateInfo'::@pPoolSizes@ with a @type@ equal to that
-- type.
--
-- Additionally, the allocation /may/ also fail if a call to
-- 'allocateDescriptorSets' would cause the total number of inline uniform
-- block bindings allocated from the pool to exceed the value of
-- 'Vulkan.Extensions.VK_EXT_inline_uniform_block.DescriptorPoolInlineUniformBlockCreateInfoEXT'::@maxInlineUniformBlockBindings@
-- used to create the descriptor pool.
--
-- If the allocation fails due to no more space in the descriptor pool, and
-- not because of system or device memory exhaustion, then
-- 'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_POOL_MEMORY' /must/ be
-- returned.
--
-- 'allocateDescriptorSets' /can/ be used to create multiple descriptor
-- sets. If the creation of any of those descriptor sets fails, then the
-- implementation /must/ destroy all successfully created descriptor set
-- objects from this command, set all entries of the @pDescriptorSets@
-- array to 'Vulkan.Core10.APIConstants.NULL_HANDLE' and return the error.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkAllocateDescriptorSets-device-parameter# @device@ /must/ be
--     a valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkAllocateDescriptorSets-pAllocateInfo-parameter#
--     @pAllocateInfo@ /must/ be a valid pointer to a valid
--     'DescriptorSetAllocateInfo' structure
--
-- -   #VUID-vkAllocateDescriptorSets-pDescriptorSets-parameter#
--     @pDescriptorSets@ /must/ be a valid pointer to an array of
--     @pAllocateInfo->descriptorSetCount@
--     'Vulkan.Core10.Handles.DescriptorSet' handles
--
-- -   #VUID-vkAllocateDescriptorSets-pAllocateInfo::descriptorSetCount-arraylength#
--     @pAllocateInfo->descriptorSetCount@ /must/ be greater than @0@
--
-- == Host Synchronization
--
-- -   Host access to @pAllocateInfo->descriptorPool@ /must/ be externally
--     synchronized
--
-- == 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'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_FRAGMENTED_POOL'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_POOL_MEMORY'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorSet', 'DescriptorSetAllocateInfo',
-- 'Vulkan.Core10.Handles.Device'
allocateDescriptorSets :: forall a io
                        . (Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io)
                       => -- | @device@ is the logical device that owns the descriptor pool.
                          Device
                       -> -- | @pAllocateInfo@ is a pointer to a 'DescriptorSetAllocateInfo' structure
                          -- describing parameters of the allocation.
                          (DescriptorSetAllocateInfo a)
                       -> io (("descriptorSets" ::: Vector DescriptorSet))
allocateDescriptorSets :: Device
-> DescriptorSetAllocateInfo a
-> io ("descriptorSets" ::: Vector DescriptorSet)
allocateDescriptorSets Device
device DescriptorSetAllocateInfo a
allocateInfo = IO ("descriptorSets" ::: Vector DescriptorSet)
-> io ("descriptorSets" ::: Vector DescriptorSet)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("descriptorSets" ::: Vector DescriptorSet)
 -> io ("descriptorSets" ::: Vector DescriptorSet))
-> (ContT
      ("descriptorSets" ::: Vector DescriptorSet)
      IO
      ("descriptorSets" ::: Vector DescriptorSet)
    -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
-> io ("descriptorSets" ::: Vector DescriptorSet)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  ("descriptorSets" ::: Vector DescriptorSet)
  IO
  ("descriptorSets" ::: Vector DescriptorSet)
-> IO ("descriptorSets" ::: Vector DescriptorSet)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   ("descriptorSets" ::: Vector DescriptorSet)
   IO
   ("descriptorSets" ::: Vector DescriptorSet)
 -> io ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
-> io ("descriptorSets" ::: Vector DescriptorSet)
forall a b. (a -> b) -> a -> b
$ do
  let vkAllocateDescriptorSetsPtr :: FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkAllocateDescriptorSetsPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
      -> ("pDescriptorSets" ::: Ptr DescriptorSet)
      -> IO Result)
pVkAllocateDescriptorSets (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
  IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ())
-> IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkAllocateDescriptorSetsPtr FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
      -> ("pDescriptorSets" ::: Ptr DescriptorSet)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkAllocateDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkAllocateDescriptorSets' :: Ptr Device_T
-> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
vkAllocateDescriptorSets' = FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
-> Ptr Device_T
-> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
mkVkAllocateDescriptorSets FunPtr
  (Ptr Device_T
   -> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkAllocateDescriptorSetsPtr
  Ptr (DescriptorSetAllocateInfo a)
pAllocateInfo <- ((Ptr (DescriptorSetAllocateInfo a)
  -> IO ("descriptorSets" ::: Vector DescriptorSet))
 -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     (Ptr (DescriptorSetAllocateInfo a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (DescriptorSetAllocateInfo a)
   -> IO ("descriptorSets" ::: Vector DescriptorSet))
  -> IO ("descriptorSets" ::: Vector DescriptorSet))
 -> ContT
      ("descriptorSets" ::: Vector DescriptorSet)
      IO
      (Ptr (DescriptorSetAllocateInfo a)))
-> ((Ptr (DescriptorSetAllocateInfo a)
     -> IO ("descriptorSets" ::: Vector DescriptorSet))
    -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     (Ptr (DescriptorSetAllocateInfo a))
forall a b. (a -> b) -> a -> b
$ DescriptorSetAllocateInfo a
-> (Ptr (DescriptorSetAllocateInfo a)
    -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> IO ("descriptorSets" ::: Vector DescriptorSet)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (DescriptorSetAllocateInfo a
allocateInfo)
  "pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets <- ((("pDescriptorSets" ::: Ptr DescriptorSet)
  -> IO ("descriptorSets" ::: Vector DescriptorSet))
 -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("pDescriptorSets" ::: Ptr DescriptorSet)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO ("descriptorSets" ::: Vector DescriptorSet))
  -> IO ("descriptorSets" ::: Vector DescriptorSet))
 -> ContT
      ("descriptorSets" ::: Vector DescriptorSet)
      IO
      ("pDescriptorSets" ::: Ptr DescriptorSet))
-> ((("pDescriptorSets" ::: Ptr DescriptorSet)
     -> IO ("descriptorSets" ::: Vector DescriptorSet))
    -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("pDescriptorSets" ::: Ptr DescriptorSet)
forall a b. (a -> b) -> a -> b
$ IO ("pDescriptorSets" ::: Ptr DescriptorSet)
-> (("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ())
-> (("pDescriptorSets" ::: Ptr DescriptorSet)
    -> IO ("descriptorSets" ::: Vector DescriptorSet))
-> IO ("descriptorSets" ::: Vector DescriptorSet)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pDescriptorSets" ::: Ptr DescriptorSet)
forall a. Int -> IO (Ptr a)
callocBytes @DescriptorSet ((Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int)
-> (DescriptorSetAllocateInfo a -> Int)
-> DescriptorSetAllocateInfo a
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector DescriptorSetLayout -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayout -> Int)
-> (DescriptorSetAllocateInfo a -> Vector DescriptorSetLayout)
-> DescriptorSetAllocateInfo a
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DescriptorSetAllocateInfo a -> Vector DescriptorSetLayout
forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
setLayouts (DescriptorSetAllocateInfo a -> Int)
-> DescriptorSetAllocateInfo a -> Int
forall a b. (a -> b) -> a -> b
$ (DescriptorSetAllocateInfo a
allocateInfo)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)) ("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result
-> ContT ("descriptorSets" ::: Vector DescriptorSet) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO Result)
-> IO Result
-> ContT ("descriptorSets" ::: Vector DescriptorSet) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkAllocateDescriptorSets" (Ptr Device_T
-> ("pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo))
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
vkAllocateDescriptorSets' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Ptr (DescriptorSetAllocateInfo a)
-> "pAllocateInfo" ::: Ptr (SomeStruct DescriptorSetAllocateInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (DescriptorSetAllocateInfo a)
pAllocateInfo) ("pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets))
  IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ())
-> IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) 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))
  "descriptorSets" ::: Vector DescriptorSet
pDescriptorSets <- IO ("descriptorSets" ::: Vector DescriptorSet)
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("descriptorSets" ::: Vector DescriptorSet)
 -> ContT
      ("descriptorSets" ::: Vector DescriptorSet)
      IO
      ("descriptorSets" ::: Vector DescriptorSet))
-> IO ("descriptorSets" ::: Vector DescriptorSet)
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO DescriptorSet)
-> IO ("descriptorSets" ::: Vector DescriptorSet)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int)
-> (DescriptorSetAllocateInfo a -> Int)
-> DescriptorSetAllocateInfo a
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector DescriptorSetLayout -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayout -> Int)
-> (DescriptorSetAllocateInfo a -> Vector DescriptorSetLayout)
-> DescriptorSetAllocateInfo a
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DescriptorSetAllocateInfo a -> Vector DescriptorSetLayout
forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
setLayouts (DescriptorSetAllocateInfo a -> Int)
-> DescriptorSetAllocateInfo a -> Int
forall a b. (a -> b) -> a -> b
$ (DescriptorSetAllocateInfo a
allocateInfo)) (\Int
i -> ("pDescriptorSets" ::: Ptr DescriptorSet) -> IO DescriptorSet
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet (("pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets ("pDescriptorSets" ::: Ptr DescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSet)))
  ("descriptorSets" ::: Vector DescriptorSet)
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("descriptorSets" ::: Vector DescriptorSet)
 -> ContT
      ("descriptorSets" ::: Vector DescriptorSet)
      IO
      ("descriptorSets" ::: Vector DescriptorSet))
-> ("descriptorSets" ::: Vector DescriptorSet)
-> ContT
     ("descriptorSets" ::: Vector DescriptorSet)
     IO
     ("descriptorSets" ::: Vector DescriptorSet)
forall a b. (a -> b) -> a -> b
$ ("descriptorSets" ::: Vector DescriptorSet
pDescriptorSets)

-- | A convenience wrapper to make a compatible pair of calls to
-- 'allocateDescriptorSets' and 'freeDescriptorSets'
--
-- To ensure that 'freeDescriptorSets' 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.
--
withDescriptorSets :: forall a io r . (Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorSetAllocateInfo a -> (io (Vector DescriptorSet) -> (Vector DescriptorSet -> io ()) -> r) -> r
withDescriptorSets :: Device
-> DescriptorSetAllocateInfo a
-> (io ("descriptorSets" ::: Vector DescriptorSet)
    -> (("descriptorSets" ::: Vector DescriptorSet) -> io ()) -> r)
-> r
withDescriptorSets Device
device DescriptorSetAllocateInfo a
pAllocateInfo io ("descriptorSets" ::: Vector DescriptorSet)
-> (("descriptorSets" ::: Vector DescriptorSet) -> io ()) -> r
b =
  io ("descriptorSets" ::: Vector DescriptorSet)
-> (("descriptorSets" ::: Vector DescriptorSet) -> io ()) -> r
b (Device
-> DescriptorSetAllocateInfo a
-> io ("descriptorSets" ::: Vector DescriptorSet)
forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io) =>
Device
-> DescriptorSetAllocateInfo a
-> io ("descriptorSets" ::: Vector DescriptorSet)
allocateDescriptorSets Device
device DescriptorSetAllocateInfo a
pAllocateInfo)
    (\("descriptorSets" ::: Vector DescriptorSet
o0) -> Device
-> DescriptorPool
-> ("descriptorSets" ::: Vector DescriptorSet)
-> io ()
forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorPool
-> ("descriptorSets" ::: Vector DescriptorSet)
-> io ()
freeDescriptorSets Device
device (DescriptorSetAllocateInfo a -> DescriptorPool
forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
descriptorPool (DescriptorSetAllocateInfo a
pAllocateInfo :: DescriptorSetAllocateInfo a)) "descriptorSets" ::: Vector DescriptorSet
o0)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkFreeDescriptorSets
  :: FunPtr (Ptr Device_T -> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result) -> Ptr Device_T -> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result

-- | vkFreeDescriptorSets - Free one or more descriptor sets
--
-- = Description
--
-- After calling 'freeDescriptorSets', all descriptor sets in
-- @pDescriptorSets@ are invalid.
--
-- == Valid Usage
--
-- -   #VUID-vkFreeDescriptorSets-pDescriptorSets-00309# All submitted
--     commands that refer to any element of @pDescriptorSets@ /must/ have
--     completed execution
--
-- -   #VUID-vkFreeDescriptorSets-pDescriptorSets-00310# @pDescriptorSets@
--     /must/ be a valid pointer to an array of @descriptorSetCount@
--     'Vulkan.Core10.Handles.DescriptorSet' handles, each element of which
--     /must/ either be a valid handle or
--     'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-vkFreeDescriptorSets-descriptorPool-00312# @descriptorPool@
--     /must/ have been created with the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT'
--     flag
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkFreeDescriptorSets-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkFreeDescriptorSets-descriptorPool-parameter#
--     @descriptorPool@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorPool' handle
--
-- -   #VUID-vkFreeDescriptorSets-descriptorSetCount-arraylength#
--     @descriptorSetCount@ /must/ be greater than @0@
--
-- -   #VUID-vkFreeDescriptorSets-descriptorPool-parent# @descriptorPool@
--     /must/ have been created, allocated, or retrieved from @device@
--
-- -   #VUID-vkFreeDescriptorSets-pDescriptorSets-parent# Each element of
--     @pDescriptorSets@ that is a valid handle /must/ have been created,
--     allocated, or retrieved from @descriptorPool@
--
-- == Host Synchronization
--
-- -   Host access to @descriptorPool@ /must/ be externally synchronized
--
-- -   Host access to each member of @pDescriptorSets@ /must/ be externally
--     synchronized
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorPool',
-- 'Vulkan.Core10.Handles.DescriptorSet', 'Vulkan.Core10.Handles.Device'
freeDescriptorSets :: forall io
                    . (MonadIO io)
                   => -- | @device@ is the logical device that owns the descriptor pool.
                      Device
                   -> -- | @descriptorPool@ is the descriptor pool from which the descriptor sets
                      -- were allocated.
                      DescriptorPool
                   -> -- | @pDescriptorSets@ is a pointer to an array of handles to
                      -- 'Vulkan.Core10.Handles.DescriptorSet' objects.
                      ("descriptorSets" ::: Vector DescriptorSet)
                   -> io ()
freeDescriptorSets :: Device
-> DescriptorPool
-> ("descriptorSets" ::: Vector DescriptorSet)
-> io ()
freeDescriptorSets Device
device DescriptorPool
descriptorPool "descriptorSets" ::: Vector DescriptorSet
descriptorSets = 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 vkFreeDescriptorSetsPtr :: FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkFreeDescriptorSetsPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorSets" ::: Ptr DescriptorSet)
      -> IO Result)
pVkFreeDescriptorSets (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
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkFreeDescriptorSetsPtr FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
-> FunPtr
     (Ptr Device_T
      -> DescriptorPool
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorSets" ::: Ptr DescriptorSet)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkFreeDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkFreeDescriptorSets' :: Ptr Device_T
-> DescriptorPool
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
vkFreeDescriptorSets' = FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
-> Ptr Device_T
-> DescriptorPool
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
mkVkFreeDescriptorSets FunPtr
  (Ptr Device_T
   -> DescriptorPool
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorSets" ::: Ptr DescriptorSet)
   -> IO Result)
vkFreeDescriptorSetsPtr
  "pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets <- ((("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ()) -> IO ())
-> ContT () IO ("pDescriptorSets" ::: Ptr DescriptorSet)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ()) -> IO ())
 -> ContT () IO ("pDescriptorSets" ::: Ptr DescriptorSet))
-> ((("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ()) -> IO ())
-> ContT () IO ("pDescriptorSets" ::: Ptr DescriptorSet)
forall a b. (a -> b) -> a -> b
$ Int
-> (("pDescriptorSets" ::: Ptr DescriptorSet) -> IO ()) -> IO ()
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorSet ((("descriptorSets" ::: Vector DescriptorSet) -> Int
forall a. Vector a -> Int
Data.Vector.length ("descriptorSets" ::: Vector DescriptorSet
descriptorSets)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)
  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
$ (Int -> DescriptorSet -> IO ())
-> ("descriptorSets" ::: Vector DescriptorSet) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorSet
e -> ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets ("pDescriptorSets" ::: Ptr DescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSet) (DescriptorSet
e)) ("descriptorSets" ::: Vector DescriptorSet
descriptorSets)
  Result
_ <- IO Result -> ContT () IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT () IO Result)
-> IO Result -> ContT () IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkFreeDescriptorSets" (Ptr Device_T
-> DescriptorPool
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorSets" ::: Ptr DescriptorSet)
-> IO Result
vkFreeDescriptorSets' (Device -> Ptr Device_T
deviceHandle (Device
device)) (DescriptorPool
descriptorPool) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("descriptorSets" ::: Vector DescriptorSet) -> Int
forall a. Vector a -> Int
Data.Vector.length (("descriptorSets" ::: Vector DescriptorSet) -> Int)
-> ("descriptorSets" ::: Vector DescriptorSet) -> Int
forall a b. (a -> b) -> a -> b
$ ("descriptorSets" ::: Vector DescriptorSet
descriptorSets)) :: Word32)) ("pDescriptorSets" ::: Ptr DescriptorSet
pPDescriptorSets))
  () -> 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" mkVkUpdateDescriptorSets
  :: FunPtr (Ptr Device_T -> Word32 -> Ptr (SomeStruct WriteDescriptorSet) -> Word32 -> Ptr CopyDescriptorSet -> IO ()) -> Ptr Device_T -> Word32 -> Ptr (SomeStruct WriteDescriptorSet) -> Word32 -> Ptr CopyDescriptorSet -> IO ()

-- | vkUpdateDescriptorSets - Update the contents of a descriptor set object
--
-- = Description
--
-- The operations described by @pDescriptorWrites@ are performed first,
-- followed by the operations described by @pDescriptorCopies@. Within each
-- array, the operations are performed in the order they appear in the
-- array.
--
-- Each element in the @pDescriptorWrites@ array describes an operation
-- updating the descriptor set using descriptors for resources specified in
-- the structure.
--
-- Each element in the @pDescriptorCopies@ array is a 'CopyDescriptorSet'
-- structure describing an operation copying descriptors between sets.
--
-- If the @dstSet@ member of any element of @pDescriptorWrites@ or
-- @pDescriptorCopies@ is bound, accessed, or modified by any command that
-- was recorded to a command buffer which is currently in the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording or executable state>,
-- and any of the descriptor bindings that are updated were not created
-- with the
-- 'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT'
-- or
-- 'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT'
-- bits set, that command buffer becomes
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle invalid>.
--
-- == Valid Usage
--
-- -   #VUID-vkUpdateDescriptorSets-None-03047# Descriptor bindings updated
--     by this command which were created without the
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT'
--     or
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT'
--     bits set /must/ not be used by any command that was recorded to a
--     command buffer which is in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle pending state>
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkUpdateDescriptorSets-device-parameter# @device@ /must/ be a
--     valid 'Vulkan.Core10.Handles.Device' handle
--
-- -   #VUID-vkUpdateDescriptorSets-pDescriptorWrites-parameter# If
--     @descriptorWriteCount@ is not @0@, @pDescriptorWrites@ /must/ be a
--     valid pointer to an array of @descriptorWriteCount@ valid
--     'WriteDescriptorSet' structures
--
-- -   #VUID-vkUpdateDescriptorSets-pDescriptorCopies-parameter# If
--     @descriptorCopyCount@ is not @0@, @pDescriptorCopies@ /must/ be a
--     valid pointer to an array of @descriptorCopyCount@ valid
--     'CopyDescriptorSet' structures
--
-- == Host Synchronization
--
-- -   Host access to @pDescriptorWrites@[].dstSet /must/ be externally
--     synchronized
--
-- -   Host access to @pDescriptorCopies@[].dstSet /must/ be externally
--     synchronized
--
-- = See Also
--
-- 'CopyDescriptorSet', 'Vulkan.Core10.Handles.Device',
-- 'WriteDescriptorSet'
updateDescriptorSets :: forall io
                      . (MonadIO io)
                     => -- | @device@ is the logical device that updates the descriptor sets.
                        Device
                     -> -- | @pDescriptorWrites@ is a pointer to an array of 'WriteDescriptorSet'
                        -- structures describing the descriptor sets to write to.
                        ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
                     -> -- | @pDescriptorCopies@ is a pointer to an array of 'CopyDescriptorSet'
                        -- structures describing the descriptor sets to copy between.
                        ("descriptorCopies" ::: Vector CopyDescriptorSet)
                     -> io ()
updateDescriptorSets :: Device
-> ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> ("descriptorCopies" ::: Vector CopyDescriptorSet)
-> io ()
updateDescriptorSets Device
device "descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet)
descriptorWrites "descriptorCopies" ::: Vector CopyDescriptorSet
descriptorCopies = 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 vkUpdateDescriptorSetsPtr :: FunPtr
  (Ptr Device_T
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> IO ())
vkUpdateDescriptorSetsPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
      -> IO ())
pVkUpdateDescriptorSets (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
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> IO ())
vkUpdateDescriptorSetsPtr FunPtr
  (Ptr Device_T
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> IO ())
-> FunPtr
     (Ptr Device_T
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
      -> ("descriptorSetCount" ::: Word32)
      -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Device_T
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> 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 String
"" String
"The function pointer for vkUpdateDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkUpdateDescriptorSets' :: Ptr Device_T
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> IO ()
vkUpdateDescriptorSets' = FunPtr
  (Ptr Device_T
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> IO ())
-> Ptr Device_T
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> IO ()
mkVkUpdateDescriptorSets FunPtr
  (Ptr Device_T
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
   -> ("descriptorSetCount" ::: Word32)
   -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
   -> IO ())
vkUpdateDescriptorSetsPtr
  Ptr (WriteDescriptorSet Any)
pPDescriptorWrites <- ((Ptr (WriteDescriptorSet Any) -> IO ()) -> IO ())
-> ContT () IO (Ptr (WriteDescriptorSet Any))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (WriteDescriptorSet Any) -> IO ()) -> IO ())
 -> ContT () IO (Ptr (WriteDescriptorSet Any)))
-> ((Ptr (WriteDescriptorSet Any) -> IO ()) -> IO ())
-> ContT () IO (Ptr (WriteDescriptorSet Any))
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr (WriteDescriptorSet Any) -> IO ()) -> IO ()
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @(WriteDescriptorSet _) ((("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> Int
forall a. Vector a -> Int
Data.Vector.length ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet)
descriptorWrites)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
64)
  (Int -> SomeStruct WriteDescriptorSet -> ContT () IO ())
-> ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> ContT () IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i SomeStruct WriteDescriptorSet
e -> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO ()) -> IO ()) -> ContT () IO ())
-> ((() -> IO ()) -> IO ()) -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
-> SomeStruct WriteDescriptorSet -> IO () -> IO ()
forall (a :: [*] -> *) b.
(forall (es :: [*]).
 (Extendss a es, PokeChain es) =>
 ToCStruct (a es)) =>
Ptr (SomeStruct a) -> SomeStruct a -> IO b -> IO b
pokeSomeCStruct (Ptr (WriteDescriptorSet Any)
-> "pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (WriteDescriptorSet Any)
pPDescriptorWrites Ptr (WriteDescriptorSet Any) -> Int -> Ptr (WriteDescriptorSet _)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
64 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (WriteDescriptorSet _))) (SomeStruct WriteDescriptorSet
e) (IO () -> IO ())
-> ((() -> IO ()) -> IO ()) -> (() -> IO ()) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO ()) -> () -> IO ()
forall a b. (a -> b) -> a -> b
$ ())) ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet)
descriptorWrites)
  "pDescriptorCopies" ::: Ptr CopyDescriptorSet
pPDescriptorCopies <- ((("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO ())
 -> IO ())
-> ContT () IO ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO ())
  -> IO ())
 -> ContT () IO ("pDescriptorCopies" ::: Ptr CopyDescriptorSet))
-> ((("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO ())
    -> IO ())
-> ContT () IO ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
forall a b. (a -> b) -> a -> b
$ Int
-> (("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO ())
-> IO ()
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @CopyDescriptorSet ((("descriptorCopies" ::: Vector CopyDescriptorSet) -> Int
forall a. Vector a -> Int
Data.Vector.length ("descriptorCopies" ::: Vector CopyDescriptorSet
descriptorCopies)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
56)
  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
$ (Int -> CopyDescriptorSet -> IO ())
-> ("descriptorCopies" ::: Vector CopyDescriptorSet) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i CopyDescriptorSet
e -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> CopyDescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pDescriptorCopies" ::: Ptr CopyDescriptorSet
pPDescriptorCopies ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorCopies" ::: Ptr CopyDescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
56 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr CopyDescriptorSet) (CopyDescriptorSet
e)) ("descriptorCopies" ::: Vector CopyDescriptorSet
descriptorCopies)
  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
$ String -> IO () -> IO ()
forall a. String -> IO a -> IO a
traceAroundEvent String
"vkUpdateDescriptorSets" (Ptr Device_T
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet))
-> ("descriptorSetCount" ::: Word32)
-> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> IO ()
vkUpdateDescriptorSets' (Device -> Ptr Device_T
deviceHandle (Device
device)) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> Int
forall a. Vector a -> Int
Data.Vector.length (("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
 -> Int)
-> ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> Int
forall a b. (a -> b) -> a -> b
$ ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet)
descriptorWrites)) :: Word32)) (Ptr (WriteDescriptorSet Any)
-> "pDescriptorWrites" ::: Ptr (SomeStruct WriteDescriptorSet)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (WriteDescriptorSet Any)
pPDescriptorWrites)) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (("descriptorCopies" ::: Vector CopyDescriptorSet) -> Int
forall a. Vector a -> Int
Data.Vector.length (("descriptorCopies" ::: Vector CopyDescriptorSet) -> Int)
-> ("descriptorCopies" ::: Vector CopyDescriptorSet) -> Int
forall a b. (a -> b) -> a -> b
$ ("descriptorCopies" ::: Vector CopyDescriptorSet
descriptorCopies)) :: Word32)) ("pDescriptorCopies" ::: Ptr CopyDescriptorSet
pPDescriptorCopies))
  () -> ContT () IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> ContT () IO ()) -> () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ()


-- | VkDescriptorBufferInfo - Structure specifying descriptor buffer
-- information
--
-- = Description
--
-- Note
--
-- When setting @range@ to 'Vulkan.Core10.APIConstants.WHOLE_SIZE', the
-- effective range /must/ not be larger than the maximum range for the
-- descriptor type
-- (<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#limits-maxUniformBufferRange maxUniformBufferRange>
-- or
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#limits-maxStorageBufferRange maxStorageBufferRange>).
-- This means that 'Vulkan.Core10.APIConstants.WHOLE_SIZE' is not typically
-- useful in the common case where uniform buffer descriptors are
-- suballocated from a buffer that is much larger than
-- @maxUniformBufferRange@.
--
-- For
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC'
-- and
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC'
-- descriptor types, @offset@ is the base offset from which the dynamic
-- offset is applied and @range@ is the static size used for all dynamic
-- offsets.
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorBufferInfo-offset-00340# @offset@ /must/ be less
--     than the size of @buffer@
--
-- -   #VUID-VkDescriptorBufferInfo-range-00341# If @range@ is not equal to
--     'Vulkan.Core10.APIConstants.WHOLE_SIZE', @range@ /must/ be greater
--     than @0@
--
-- -   #VUID-VkDescriptorBufferInfo-range-00342# If @range@ is not equal to
--     'Vulkan.Core10.APIConstants.WHOLE_SIZE', @range@ /must/ be less than
--     or equal to the size of @buffer@ minus @offset@
--
-- -   #VUID-VkDescriptorBufferInfo-buffer-02998# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-nullDescriptor nullDescriptor>
--     feature is not enabled, @buffer@ /must/ not be
--     'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-VkDescriptorBufferInfo-buffer-02999# If @buffer@ is
--     'Vulkan.Core10.APIConstants.NULL_HANDLE', @offset@ /must/ be zero
--     and @range@ /must/ be 'Vulkan.Core10.APIConstants.WHOLE_SIZE'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorBufferInfo-buffer-parameter# If @buffer@ is not
--     'Vulkan.Core10.APIConstants.NULL_HANDLE', @buffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.Buffer' handle
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.Buffer',
-- 'Vulkan.Core10.FundamentalTypes.DeviceSize', 'WriteDescriptorSet'
data DescriptorBufferInfo = DescriptorBufferInfo
  { -- | @buffer@ is 'Vulkan.Core10.APIConstants.NULL_HANDLE' or the buffer
    -- resource.
    DescriptorBufferInfo -> Buffer
buffer :: Buffer
  , -- | @offset@ is the offset in bytes from the start of @buffer@. Access to
    -- buffer memory via this descriptor uses addressing that is relative to
    -- this starting offset.
    DescriptorBufferInfo -> DeviceSize
offset :: DeviceSize
  , -- | @range@ is the size in bytes that is used for this descriptor update, or
    -- 'Vulkan.Core10.APIConstants.WHOLE_SIZE' to use the range from @offset@
    -- to the end of the buffer.
    DescriptorBufferInfo -> DeviceSize
range :: DeviceSize
  }
  deriving (Typeable, DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
(DescriptorBufferInfo -> DescriptorBufferInfo -> Bool)
-> (DescriptorBufferInfo -> DescriptorBufferInfo -> Bool)
-> Eq DescriptorBufferInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
$c/= :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
== :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
$c== :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorBufferInfo)
#endif
deriving instance Show DescriptorBufferInfo

instance ToCStruct DescriptorBufferInfo where
  withCStruct :: DescriptorBufferInfo -> (Ptr DescriptorBufferInfo -> IO b) -> IO b
withCStruct DescriptorBufferInfo
x Ptr DescriptorBufferInfo -> IO b
f = Int -> (Ptr DescriptorBufferInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr DescriptorBufferInfo -> IO b) -> IO b)
-> (Ptr DescriptorBufferInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DescriptorBufferInfo
p -> Ptr DescriptorBufferInfo -> DescriptorBufferInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorBufferInfo
p DescriptorBufferInfo
x (Ptr DescriptorBufferInfo -> IO b
f Ptr DescriptorBufferInfo
p)
  pokeCStruct :: Ptr DescriptorBufferInfo -> DescriptorBufferInfo -> IO b -> IO b
pokeCStruct Ptr DescriptorBufferInfo
p DescriptorBufferInfo{DeviceSize
Buffer
range :: DeviceSize
offset :: DeviceSize
buffer :: Buffer
$sel:range:DescriptorBufferInfo :: DescriptorBufferInfo -> DeviceSize
$sel:offset:DescriptorBufferInfo :: DescriptorBufferInfo -> DeviceSize
$sel:buffer:DescriptorBufferInfo :: DescriptorBufferInfo -> Buffer
..} IO b
f = do
    Ptr Buffer -> Buffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr Buffer
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Buffer)) (Buffer
buffer)
    Ptr DeviceSize -> DeviceSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr DeviceSize)) (DeviceSize
offset)
    Ptr DeviceSize -> DeviceSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) (DeviceSize
range)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr DescriptorBufferInfo -> IO b -> IO b
pokeZeroCStruct Ptr DescriptorBufferInfo
p IO b
f = do
    Ptr DeviceSize -> DeviceSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr DeviceSize)) (DeviceSize
forall a. Zero a => a
zero)
    Ptr DeviceSize -> DeviceSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize)) (DeviceSize
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DescriptorBufferInfo where
  peekCStruct :: Ptr DescriptorBufferInfo -> IO DescriptorBufferInfo
peekCStruct Ptr DescriptorBufferInfo
p = do
    Buffer
buffer <- Ptr Buffer -> IO Buffer
forall a. Storable a => Ptr a -> IO a
peek @Buffer ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr Buffer
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Buffer))
    DeviceSize
offset <- Ptr DeviceSize -> IO DeviceSize
forall a. Storable a => Ptr a -> IO a
peek @DeviceSize ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr DeviceSize))
    DeviceSize
range <- Ptr DeviceSize -> IO DeviceSize
forall a. Storable a => Ptr a -> IO a
peek @DeviceSize ((Ptr DescriptorBufferInfo
p Ptr DescriptorBufferInfo -> Int -> Ptr DeviceSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DeviceSize))
    DescriptorBufferInfo -> IO DescriptorBufferInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorBufferInfo -> IO DescriptorBufferInfo)
-> DescriptorBufferInfo -> IO DescriptorBufferInfo
forall a b. (a -> b) -> a -> b
$ Buffer -> DeviceSize -> DeviceSize -> DescriptorBufferInfo
DescriptorBufferInfo
             Buffer
buffer DeviceSize
offset DeviceSize
range

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

instance Zero DescriptorBufferInfo where
  zero :: DescriptorBufferInfo
zero = Buffer -> DeviceSize -> DeviceSize -> DescriptorBufferInfo
DescriptorBufferInfo
           Buffer
forall a. Zero a => a
zero
           DeviceSize
forall a. Zero a => a
zero
           DeviceSize
forall a. Zero a => a
zero


-- | VkDescriptorImageInfo - Structure specifying descriptor image
-- information
--
-- = Description
--
-- Members of 'DescriptorImageInfo' that are not used in an update (as
-- described above) are ignored.
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorImageInfo-imageView-00343# @imageView@ /must/ not
--     be 2D or 2D array image view created from a 3D image
--
-- -   #VUID-VkDescriptorImageInfo-imageView-01976# If @imageView@ is
--     created from a depth\/stencil image, the @aspectMask@ used to create
--     the @imageView@ /must/ include either
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_DEPTH_BIT' or
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_STENCIL_BIT'
--     but not both
--
-- -   #VUID-VkDescriptorImageInfo-imageLayout-00344# @imageLayout@ /must/
--     match the actual 'Vulkan.Core10.Enums.ImageLayout.ImageLayout' of
--     each subresource accessible from @imageView@ at the time this
--     descriptor is accessed as defined by the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#resources-image-layouts-matching-rule image layout matching rules>
--
-- -   #VUID-VkDescriptorImageInfo-sampler-01564# If @sampler@ is used and
--     the 'Vulkan.Core10.Enums.Format.Format' of the image is a
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-requiring-sampler-ycbcr-conversion multi-planar format>,
--     the image /must/ have been created with
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_MUTABLE_FORMAT_BIT',
--     and the @aspectMask@ of the @imageView@ /must/ be
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_PLANE_0_BIT',
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_PLANE_1_BIT'
--     or (for three-plane formats only)
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_PLANE_2_BIT'
--
-- -   #VUID-VkDescriptorImageInfo-mutableComparisonSamplers-04450# If the
--     @VK_KHR_portability_subset@ extension is enabled, and
--     'Vulkan.Extensions.VK_KHR_portability_subset.PhysicalDevicePortabilitySubsetFeaturesKHR'::@mutableComparisonSamplers@
--     is 'Vulkan.Core10.FundamentalTypes.FALSE', then @sampler@ /must/
--     have been created with
--     'Vulkan.Core10.Sampler.SamplerCreateInfo'::@compareEnable@ set to
--     'Vulkan.Core10.FundamentalTypes.FALSE'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorImageInfo-commonparent# Both of @imageView@, and
--     @sampler@ 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.Enums.ImageLayout.ImageLayout',
-- 'Vulkan.Core10.Handles.ImageView', 'Vulkan.Core10.Handles.Sampler',
-- 'WriteDescriptorSet'
data DescriptorImageInfo = DescriptorImageInfo
  { -- | @sampler@ is a sampler handle, and is used in descriptor updates for
    -- types 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER' and
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER'
    -- if the binding being updated does not use immutable samplers.
    DescriptorImageInfo -> Sampler
sampler :: Sampler
  , -- | @imageView@ is 'Vulkan.Core10.APIConstants.NULL_HANDLE' or an image view
    -- handle, and is used in descriptor updates for types
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
    -- and
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT'.
    DescriptorImageInfo -> ImageView
imageView :: ImageView
  , -- | @imageLayout@ is the layout that the image subresources accessible from
    -- @imageView@ will be in at the time this descriptor is accessed.
    -- @imageLayout@ is used in descriptor updates for types
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
    -- and
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT'.
    DescriptorImageInfo -> ImageLayout
imageLayout :: ImageLayout
  }
  deriving (Typeable, DescriptorImageInfo -> DescriptorImageInfo -> Bool
(DescriptorImageInfo -> DescriptorImageInfo -> Bool)
-> (DescriptorImageInfo -> DescriptorImageInfo -> Bool)
-> Eq DescriptorImageInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
$c/= :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
== :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
$c== :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorImageInfo)
#endif
deriving instance Show DescriptorImageInfo

instance ToCStruct DescriptorImageInfo where
  withCStruct :: DescriptorImageInfo -> (Ptr DescriptorImageInfo -> IO b) -> IO b
withCStruct DescriptorImageInfo
x Ptr DescriptorImageInfo -> IO b
f = Int -> (Ptr DescriptorImageInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr DescriptorImageInfo -> IO b) -> IO b)
-> (Ptr DescriptorImageInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DescriptorImageInfo
p -> Ptr DescriptorImageInfo -> DescriptorImageInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorImageInfo
p DescriptorImageInfo
x (Ptr DescriptorImageInfo -> IO b
f Ptr DescriptorImageInfo
p)
  pokeCStruct :: Ptr DescriptorImageInfo -> DescriptorImageInfo -> IO b -> IO b
pokeCStruct Ptr DescriptorImageInfo
p DescriptorImageInfo{ImageLayout
Sampler
ImageView
imageLayout :: ImageLayout
imageView :: ImageView
sampler :: Sampler
$sel:imageLayout:DescriptorImageInfo :: DescriptorImageInfo -> ImageLayout
$sel:imageView:DescriptorImageInfo :: DescriptorImageInfo -> ImageView
$sel:sampler:DescriptorImageInfo :: DescriptorImageInfo -> Sampler
..} IO b
f = do
    Ptr Sampler -> Sampler -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr Sampler
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Sampler)) (Sampler
sampler)
    Ptr ImageView -> ImageView -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageView
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ImageView)) (ImageView
imageView)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ImageLayout)) (ImageLayout
imageLayout)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr DescriptorImageInfo -> IO b -> IO b
pokeZeroCStruct Ptr DescriptorImageInfo
p IO b
f = do
    Ptr Sampler -> Sampler -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr Sampler
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Sampler)) (Sampler
forall a. Zero a => a
zero)
    Ptr ImageView -> ImageView -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageView
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ImageView)) (ImageView
forall a. Zero a => a
zero)
    Ptr ImageLayout -> ImageLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ImageLayout)) (ImageLayout
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DescriptorImageInfo where
  peekCStruct :: Ptr DescriptorImageInfo -> IO DescriptorImageInfo
peekCStruct Ptr DescriptorImageInfo
p = do
    Sampler
sampler <- Ptr Sampler -> IO Sampler
forall a. Storable a => Ptr a -> IO a
peek @Sampler ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr Sampler
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Sampler))
    ImageView
imageView <- Ptr ImageView -> IO ImageView
forall a. Storable a => Ptr a -> IO a
peek @ImageView ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageView
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr ImageView))
    ImageLayout
imageLayout <- Ptr ImageLayout -> IO ImageLayout
forall a. Storable a => Ptr a -> IO a
peek @ImageLayout ((Ptr DescriptorImageInfo
p Ptr DescriptorImageInfo -> Int -> Ptr ImageLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr ImageLayout))
    DescriptorImageInfo -> IO DescriptorImageInfo
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorImageInfo -> IO DescriptorImageInfo)
-> DescriptorImageInfo -> IO DescriptorImageInfo
forall a b. (a -> b) -> a -> b
$ Sampler -> ImageView -> ImageLayout -> DescriptorImageInfo
DescriptorImageInfo
             Sampler
sampler ImageView
imageView ImageLayout
imageLayout

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

instance Zero DescriptorImageInfo where
  zero :: DescriptorImageInfo
zero = Sampler -> ImageView -> ImageLayout -> DescriptorImageInfo
DescriptorImageInfo
           Sampler
forall a. Zero a => a
zero
           ImageView
forall a. Zero a => a
zero
           ImageLayout
forall a. Zero a => a
zero


-- | VkWriteDescriptorSet - Structure specifying the parameters of a
-- descriptor set write operation
--
-- = Description
--
-- Only one of @pImageInfo@, @pBufferInfo@, or @pTexelBufferView@ members
-- is used according to the descriptor type specified in the
-- @descriptorType@ member of the containing 'WriteDescriptorSet'
-- structure, or none of them in case @descriptorType@ is
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
-- in which case the source data for the descriptor writes is taken from
-- the
-- 'Vulkan.Extensions.VK_EXT_inline_uniform_block.WriteDescriptorSetInlineUniformBlockEXT'
-- structure included in the @pNext@ chain of 'WriteDescriptorSet', or if
-- @descriptorType@ is
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR',
-- in which case the source data for the descriptor writes is taken from
-- the
-- 'Vulkan.Extensions.VK_KHR_acceleration_structure.WriteDescriptorSetAccelerationStructureKHR'
-- structure in the @pNext@ chain of 'WriteDescriptorSet', or if
-- @descriptorType@ is
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV',
-- in which case the source data for the descriptor writes is taken from
-- the
-- 'Vulkan.Extensions.VK_NV_ray_tracing.WriteDescriptorSetAccelerationStructureNV'
-- structure in the @pNext@ chain of 'WriteDescriptorSet', as specified
-- below.
--
-- If the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-nullDescriptor nullDescriptor>
-- feature is enabled, the buffer, acceleration structure, imageView, or
-- bufferView /can/ be 'Vulkan.Core10.APIConstants.NULL_HANDLE'. Loads from
-- a null descriptor return zero values and stores and atomics to a null
-- descriptor are discarded. A null acceleration structure descriptor
-- results in the miss shader being invoked.
--
-- If the destination descriptor is a mutable descriptor, the active
-- descriptor type for the destination descriptor becomes @descriptorType@.
--
-- If the @dstBinding@ has fewer than @descriptorCount@ array elements
-- remaining starting from @dstArrayElement@, then the remainder will be
-- used to update the subsequent binding - @dstBinding@+1 starting at array
-- element zero. If a binding has a @descriptorCount@ of zero, it is
-- skipped. This behavior applies recursively, with the update affecting
-- consecutive bindings as needed to update all @descriptorCount@
-- descriptors. Consecutive bindings /must/ have identical
-- elink::VkDescriptorType, elink::VkShaderStageFlags,
-- 'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DescriptorBindingFlagBits',
-- and immutable samplers references.
--
-- Note
--
-- The same behavior applies to bindings with a descriptor type of
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
-- where @descriptorCount@ specifies the number of bytes to update while
-- @dstArrayElement@ specifies the starting byte offset, thus in this case
-- if the @dstBinding@ has a smaller byte size than the sum of
-- @dstArrayElement@ and @descriptorCount@, then the remainder will be used
-- to update the subsequent binding - @dstBinding@+1 starting at offset
-- zero. This falls out as a special case of the above rule.
--
-- == Valid Usage
--
-- -   #VUID-VkWriteDescriptorSet-dstBinding-00315# @dstBinding@ /must/ be
--     less than or equal to the maximum value of @binding@ of all
--     'DescriptorSetLayoutBinding' structures specified when @dstSet@’s
--     descriptor set layout was created
--
-- -   #VUID-VkWriteDescriptorSet-dstBinding-00316# @dstBinding@ /must/ be
--     a binding with a non-zero @descriptorCount@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorCount-00317# All consecutive
--     bindings updated via a single 'WriteDescriptorSet' structure, except
--     those with a @descriptorCount@ of zero, /must/ have identical
--     @descriptorType@ and @stageFlags@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorCount-00318# All consecutive
--     bindings updated via a single 'WriteDescriptorSet' structure, except
--     those with a @descriptorCount@ of zero, /must/ all either use
--     immutable samplers or /must/ all not use immutable samplers
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00319# @descriptorType@
--     /must/ match the type of @dstBinding@ within @dstSet@
--
-- -   #VUID-VkWriteDescriptorSet-dstSet-00320# @dstSet@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorSet' handle
--
-- -   #VUID-VkWriteDescriptorSet-dstArrayElement-00321# The sum of
--     @dstArrayElement@ and @descriptorCount@ /must/ be less than or equal
--     to the number of array elements in the descriptor set binding
--     specified by @dstBinding@, and all applicable consecutive bindings,
--     as described by
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-updates-consecutive>
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02219# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @dstArrayElement@ /must/ be an integer multiple of @4@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02220# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @descriptorCount@ /must/ be an integer multiple of @4@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00322# If @descriptorType@
--     is 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT',
--     @pImageInfo@ /must/ be a valid pointer to an array of
--     @descriptorCount@ valid 'DescriptorImageInfo' structures
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02994# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER',
--     each element of @pTexelBufferView@ /must/ be either a valid
--     'Vulkan.Core10.Handles.BufferView' handle or
--     'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02995# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER'
--     and the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-nullDescriptor nullDescriptor>
--     feature is not enabled, each element of @pTexelBufferView@ /must/
--     not be 'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00324# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC',
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC',
--     @pBufferInfo@ /must/ be a valid pointer to an array of
--     @descriptorCount@ valid 'DescriptorBufferInfo' structures
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00325# If @descriptorType@
--     is 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER' or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     and @dstSet@ was not allocated with a layout that included immutable
--     samplers for @dstBinding@ with @descriptorType@, the @sampler@
--     member of each element of @pImageInfo@ /must/ be a valid
--     'Vulkan.Core10.Handles.Sampler' object
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02996# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT',
--     the @imageView@ member of each element of @pImageInfo@ /must/ be
--     either a valid 'Vulkan.Core10.Handles.ImageView' handle or
--     'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02997# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT'
--     and the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-nullDescriptor nullDescriptor>
--     feature is not enabled, the @imageView@ member of each element of
--     @pImageInfo@ /must/ not be 'Vulkan.Core10.APIConstants.NULL_HANDLE'
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02221# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     the @pNext@ chain /must/ include a
--     'Vulkan.Extensions.VK_EXT_inline_uniform_block.WriteDescriptorSetInlineUniformBlockEXT'
--     structure whose @dataSize@ member equals @descriptorCount@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02382# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR',
--     the @pNext@ chain /must/ include a
--     'Vulkan.Extensions.VK_KHR_acceleration_structure.WriteDescriptorSetAccelerationStructureKHR'
--     structure whose @accelerationStructureCount@ member equals
--     @descriptorCount@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-03817# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV',
--     the @pNext@ chain /must/ include a
--     'Vulkan.Extensions.VK_NV_ray_tracing.WriteDescriptorSetAccelerationStructureNV'
--     structure whose @accelerationStructureCount@ member equals
--     @descriptorCount@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-01946# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE',
--     then the @imageView@ member of each @pImageInfo@ element /must/ have
--     been created without a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionInfo'
--     structure in its @pNext@ chain
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02738# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     and if any element of @pImageInfo@ has a @imageView@ member that was
--     created with a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionInfo'
--     structure in its @pNext@ chain, then @dstSet@ /must/ have been
--     allocated with a layout that included immutable samplers for
--     @dstBinding@, and the corresponding immutable sampler /must/ have
--     been created with an /identically defined/
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionInfo'
--     object
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-01948# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     and @dstSet@ was allocated with a layout that included immutable
--     samplers for @dstBinding@, then the @imageView@ member of each
--     element of @pImageInfo@ which corresponds to an immutable sampler
--     that enables
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#samplers-YCbCr-conversion sampler Y′CBCR conversion>
--     /must/ have been created with a
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionInfo'
--     structure in its @pNext@ chain with an /identically defined/
--     'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionInfo'
--     to the corresponding immutable sampler
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00327# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC',
--     the @offset@ member of each element of @pBufferInfo@ /must/ be a
--     multiple of
--     'Vulkan.Core10.DeviceInitialization.PhysicalDeviceLimits'::@minUniformBufferOffsetAlignment@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00328# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC',
--     the @offset@ member of each element of @pBufferInfo@ /must/ be a
--     multiple of
--     'Vulkan.Core10.DeviceInitialization.PhysicalDeviceLimits'::@minStorageBufferOffsetAlignment@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00329# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC',
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER',
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC',
--     and the @buffer@ member of any element of @pBufferInfo@ is the
--     handle of a non-sparse buffer, then that buffer /must/ be bound
--     completely and contiguously to a single
--     'Vulkan.Core10.Handles.DeviceMemory' object
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00330# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC',
--     the @buffer@ member of each element of @pBufferInfo@ /must/ have
--     been created with
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_UNIFORM_BUFFER_BIT'
--     set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00331# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC',
--     the @buffer@ member of each element of @pBufferInfo@ /must/ have
--     been created with
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_STORAGE_BUFFER_BIT'
--     set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00332# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC',
--     the @range@ member of each element of @pBufferInfo@, or the
--     effective range if @range@ is
--     'Vulkan.Core10.APIConstants.WHOLE_SIZE', /must/ be less than or
--     equal to
--     'Vulkan.Core10.DeviceInitialization.PhysicalDeviceLimits'::@maxUniformBufferRange@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00333# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC',
--     the @range@ member of each element of @pBufferInfo@, or the
--     effective range if @range@ is
--     'Vulkan.Core10.APIConstants.WHOLE_SIZE', /must/ be less than or
--     equal to
--     'Vulkan.Core10.DeviceInitialization.PhysicalDeviceLimits'::@maxStorageBufferRange@
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00334# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER',
--     the 'Vulkan.Core10.Handles.Buffer' that each element of
--     @pTexelBufferView@ was created from /must/ have been created with
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT'
--     set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00335# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER',
--     the 'Vulkan.Core10.Handles.Buffer' that each element of
--     @pTexelBufferView@ was created from /must/ have been created with
--     'Vulkan.Core10.Enums.BufferUsageFlagBits.BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT'
--     set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00336# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT',
--     the @imageView@ member of each element of @pImageInfo@ /must/ have
--     been created with the identity swizzle
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00337# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     the @imageView@ member of each element of @pImageInfo@ /must/ have
--     been created with
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_SAMPLED_BIT' set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-04149# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE'
--     the @imageLayout@ member of each element of @pImageInfo@ /must/ be a
--     member of the list given in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-sampledimage Sampled Image>
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-04150# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER'
--     the @imageLayout@ member of each element of @pImageInfo@ /must/ be a
--     member of the list given in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-combinedimagesampler Combined Image Sampler>
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-04151# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT'
--     the @imageLayout@ member of each element of @pImageInfo@ /must/ be a
--     member of the list given in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-inputattachment Input Attachment>
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-04152# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE'
--     the @imageLayout@ member of each element of @pImageInfo@ /must/ be a
--     member of the list given in
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-storageimage Storage Image>
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00338# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT',
--     the @imageView@ member of each element of @pImageInfo@ /must/ have
--     been created with
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_INPUT_ATTACHMENT_BIT'
--     set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-00339# If @descriptorType@
--     is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE',
--     the @imageView@ member of each element of @pImageInfo@ /must/ have
--     been created with
--     'Vulkan.Core10.Enums.ImageUsageFlagBits.IMAGE_USAGE_STORAGE_BIT' set
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-02752# If @descriptorType@
--     is 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER',
--     then @dstSet@ /must/ not have been allocated with a layout that
--     included immutable samplers for @dstBinding@
--
-- -   #VUID-VkWriteDescriptorSet-dstSet-04611# If the
--     'DescriptorSetLayoutBinding' for @dstSet@ at @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     the new active descriptor type @descriptorType@ /must/ exist in the
--     corresponding @pMutableDescriptorTypeLists@ list for @dstBinding@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkWriteDescriptorSet-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET'
--
-- -   #VUID-VkWriteDescriptorSet-pNext-pNext# Each @pNext@ member of any
--     structure (including this one) in the @pNext@ chain /must/ be either
--     @NULL@ or a pointer to a valid instance of
--     'Vulkan.Extensions.VK_KHR_acceleration_structure.WriteDescriptorSetAccelerationStructureKHR',
--     'Vulkan.Extensions.VK_NV_ray_tracing.WriteDescriptorSetAccelerationStructureNV',
--     or
--     'Vulkan.Extensions.VK_EXT_inline_uniform_block.WriteDescriptorSetInlineUniformBlockEXT'
--
-- -   #VUID-VkWriteDescriptorSet-sType-unique# The @sType@ value of each
--     struct in the @pNext@ chain /must/ be unique
--
-- -   #VUID-VkWriteDescriptorSet-descriptorType-parameter#
--     @descriptorType@ /must/ be a valid
--     'Vulkan.Core10.Enums.DescriptorType.DescriptorType' value
--
-- -   #VUID-VkWriteDescriptorSet-descriptorCount-arraylength#
--     @descriptorCount@ /must/ be greater than @0@
--
-- -   #VUID-VkWriteDescriptorSet-commonparent# Both of @dstSet@, and the
--     elements of @pTexelBufferView@ 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.BufferView', 'DescriptorBufferInfo',
-- 'DescriptorImageInfo', 'Vulkan.Core10.Handles.DescriptorSet',
-- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'Vulkan.Extensions.VK_KHR_push_descriptor.cmdPushDescriptorSetKHR',
-- 'updateDescriptorSets'
data WriteDescriptorSet (es :: [Type]) = WriteDescriptorSet
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    WriteDescriptorSet es -> Chain es
next :: Chain es
  , -- | @dstSet@ is the destination descriptor set to update.
    WriteDescriptorSet es -> DescriptorSet
dstSet :: DescriptorSet
  , -- | @dstBinding@ is the descriptor binding within that set.
    WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
dstBinding :: Word32
  , -- | @dstArrayElement@ is the starting element in that array. If the
    -- descriptor binding identified by @dstSet@ and @dstBinding@ has a
    -- descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @dstArrayElement@ specifies the starting byte offset within the
    -- binding.
    WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
dstArrayElement :: Word32
  , -- | @descriptorCount@ is the number of descriptors to update. If the
    -- descriptor binding identified by @dstSet@ and @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.
    -- Otherwise, @descriptorCount@ is one of
    --
    -- -   the number of elements in @pImageInfo@
    --
    -- -   the number of elements in @pBufferInfo@
    --
    -- -   the number of elements in @pTexelBufferView@
    --
    -- -   a value matching the @dataSize@ member of a
    --     'Vulkan.Extensions.VK_EXT_inline_uniform_block.WriteDescriptorSetInlineUniformBlockEXT'
    --     structure in the @pNext@ chain
    --
    -- -   a value matching the @accelerationStructureCount@ of a
    --     'Vulkan.Extensions.VK_KHR_acceleration_structure.WriteDescriptorSetAccelerationStructureKHR'
    --     structure in the @pNext@ chain
    WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
descriptorCount :: Word32
  , -- | @descriptorType@ is a
    -- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType' specifying the type
    -- of each descriptor in @pImageInfo@, @pBufferInfo@, or
    -- @pTexelBufferView@, as described below. If 'DescriptorSetLayoutBinding'
    -- for @dstSet@ at @dstBinding@ is not equal to
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
    -- @descriptorType@ /must/ be the same type as that specified in
    -- 'DescriptorSetLayoutBinding' for @dstSet@ at @dstBinding@. The type of
    -- the descriptor also controls which array the descriptors are taken from.
    WriteDescriptorSet es -> DescriptorType
descriptorType :: DescriptorType
  , -- | @pImageInfo@ is a pointer to an array of 'DescriptorImageInfo'
    -- structures or is ignored, as described below.
    WriteDescriptorSet es -> Vector DescriptorImageInfo
imageInfo :: Vector DescriptorImageInfo
  , -- | @pBufferInfo@ is a pointer to an array of 'DescriptorBufferInfo'
    -- structures or is ignored, as described below.
    WriteDescriptorSet es -> Vector DescriptorBufferInfo
bufferInfo :: Vector DescriptorBufferInfo
  , -- | @pTexelBufferView@ is a pointer to an array of
    -- 'Vulkan.Core10.Handles.BufferView' handles as described in the
    -- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#resources-buffer-views Buffer Views>
    -- section or is ignored, as described below.
    WriteDescriptorSet es -> Vector BufferView
texelBufferView :: Vector BufferView
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (WriteDescriptorSet (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (WriteDescriptorSet es)

instance Extensible WriteDescriptorSet where
  extensibleTypeName :: String
extensibleTypeName = String
"WriteDescriptorSet"
  setNext :: WriteDescriptorSet ds -> Chain es -> WriteDescriptorSet es
setNext WriteDescriptorSet ds
x Chain es
next = WriteDescriptorSet ds
x{$sel:next:WriteDescriptorSet :: Chain es
next = Chain es
next}
  getNext :: WriteDescriptorSet es -> Chain es
getNext WriteDescriptorSet{"descriptorSetCount" ::: Word32
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
Vector BufferView
Chain es
DescriptorSet
DescriptorType
texelBufferView :: Vector BufferView
bufferInfo :: Vector DescriptorBufferInfo
imageInfo :: Vector DescriptorImageInfo
descriptorType :: DescriptorType
descriptorCount :: "descriptorSetCount" ::: Word32
dstArrayElement :: "descriptorSetCount" ::: Word32
dstBinding :: "descriptorSetCount" ::: Word32
dstSet :: DescriptorSet
next :: Chain es
$sel:texelBufferView:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> Vector BufferView
$sel:bufferInfo:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
$sel:imageInfo:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
$sel:descriptorType:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
$sel:descriptorCount:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstArrayElement:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstBinding:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstSet:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
$sel:next:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends WriteDescriptorSet e => b) -> Maybe b
  extends :: proxy e -> (Extends WriteDescriptorSet e => b) -> Maybe b
extends proxy e
_ Extends WriteDescriptorSet e => b
f
    | Just e :~: WriteDescriptorSetAccelerationStructureNV
Refl <- (Typeable e, Typeable WriteDescriptorSetAccelerationStructureNV) =>
Maybe (e :~: WriteDescriptorSetAccelerationStructureNV)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @WriteDescriptorSetAccelerationStructureNV = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends WriteDescriptorSet e => b
f
    | Just e :~: WriteDescriptorSetAccelerationStructureKHR
Refl <- (Typeable e,
 Typeable WriteDescriptorSetAccelerationStructureKHR) =>
Maybe (e :~: WriteDescriptorSetAccelerationStructureKHR)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @WriteDescriptorSetAccelerationStructureKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends WriteDescriptorSet e => b
f
    | Just e :~: WriteDescriptorSetInlineUniformBlockEXT
Refl <- (Typeable e, Typeable WriteDescriptorSetInlineUniformBlockEXT) =>
Maybe (e :~: WriteDescriptorSetInlineUniformBlockEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @WriteDescriptorSetInlineUniformBlockEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends WriteDescriptorSet e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss WriteDescriptorSet es, PokeChain es) => ToCStruct (WriteDescriptorSet es) where
  withCStruct :: WriteDescriptorSet es
-> (Ptr (WriteDescriptorSet es) -> IO b) -> IO b
withCStruct WriteDescriptorSet es
x Ptr (WriteDescriptorSet es) -> IO b
f = Int -> (Ptr (WriteDescriptorSet es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
64 ((Ptr (WriteDescriptorSet es) -> IO b) -> IO b)
-> (Ptr (WriteDescriptorSet es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (WriteDescriptorSet es)
p -> Ptr (WriteDescriptorSet es)
-> WriteDescriptorSet es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (WriteDescriptorSet es)
p WriteDescriptorSet es
x (Ptr (WriteDescriptorSet es) -> IO b
f Ptr (WriteDescriptorSet es)
p)
  pokeCStruct :: Ptr (WriteDescriptorSet es)
-> WriteDescriptorSet es -> IO b -> IO b
pokeCStruct Ptr (WriteDescriptorSet es)
p WriteDescriptorSet{"descriptorSetCount" ::: Word32
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
Vector BufferView
Chain es
DescriptorSet
DescriptorType
texelBufferView :: Vector BufferView
bufferInfo :: Vector DescriptorBufferInfo
imageInfo :: Vector DescriptorImageInfo
descriptorType :: DescriptorType
descriptorCount :: "descriptorSetCount" ::: Word32
dstArrayElement :: "descriptorSetCount" ::: Word32
dstBinding :: "descriptorSetCount" ::: Word32
dstSet :: DescriptorSet
next :: Chain es
$sel:texelBufferView:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> Vector BufferView
$sel:bufferInfo:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
$sel:imageInfo:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
$sel:descriptorType:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
$sel:descriptorCount:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstArrayElement:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstBinding:WriteDescriptorSet :: forall (es :: [*]).
WriteDescriptorSet es -> "descriptorSetCount" ::: Word32
$sel:dstSet:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
$sel:next:WriteDescriptorSet :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
..} 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 ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    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
$ ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
dstSet)
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
dstBinding)
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
dstArrayElement)
    let pImageInfoLength :: Int
pImageInfoLength = Vector DescriptorImageInfo -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorImageInfo -> Int)
-> Vector DescriptorImageInfo -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorImageInfo
imageInfo)
    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
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pImageInfoLength ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== ("descriptorSetCount" ::: Word32
descriptorCount) Bool -> Bool -> Bool
|| Int
pImageInfoLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
      IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pImageInfo must be empty or have 'descriptorCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
    let pBufferInfoLength :: Int
pBufferInfoLength = Vector DescriptorBufferInfo -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorBufferInfo -> Int)
-> Vector DescriptorBufferInfo -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorBufferInfo
bufferInfo)
    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
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pBufferInfoLength ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== ("descriptorSetCount" ::: Word32
descriptorCount) Bool -> Bool -> Bool
|| Int
pBufferInfoLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
      IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pBufferInfo must be empty or have 'descriptorCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
    let pTexelBufferViewLength :: Int
pTexelBufferViewLength = Vector BufferView -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector BufferView -> Int) -> Vector BufferView -> Int
forall a b. (a -> b) -> a -> b
$ (Vector BufferView
texelBufferView)
    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
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pTexelBufferViewLength ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== ("descriptorSetCount" ::: Word32
descriptorCount) Bool -> Bool -> Bool
|| Int
pTexelBufferViewLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
      IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pTexelBufferView must be empty or have 'descriptorCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Word32)) (("descriptorSetCount" ::: Word32
descriptorCount))
    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 DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr DescriptorType)) (DescriptorType
descriptorType)
    Ptr DescriptorImageInfo
pImageInfo'' <- if Vector DescriptorImageInfo -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector DescriptorImageInfo
imageInfo)
      then Ptr DescriptorImageInfo -> ContT b IO (Ptr DescriptorImageInfo)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr DescriptorImageInfo
forall a. Ptr a
nullPtr
      else do
        Ptr DescriptorImageInfo
pPImageInfo <- ((Ptr DescriptorImageInfo -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorImageInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorImageInfo -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorImageInfo))
-> ((Ptr DescriptorImageInfo -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorImageInfo)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr DescriptorImageInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorImageInfo (((Vector DescriptorImageInfo -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorImageInfo
imageInfo))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
24)
        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
$ (Int -> DescriptorImageInfo -> IO ())
-> Vector DescriptorImageInfo -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorImageInfo
e -> Ptr DescriptorImageInfo -> DescriptorImageInfo -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DescriptorImageInfo
pPImageInfo Ptr DescriptorImageInfo -> Int -> Ptr DescriptorImageInfo
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorImageInfo) (DescriptorImageInfo
e)) ((Vector DescriptorImageInfo
imageInfo))
        Ptr DescriptorImageInfo -> ContT b IO (Ptr DescriptorImageInfo)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr DescriptorImageInfo -> ContT b IO (Ptr DescriptorImageInfo))
-> Ptr DescriptorImageInfo -> ContT b IO (Ptr DescriptorImageInfo)
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorImageInfo
pPImageInfo
    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 DescriptorImageInfo) -> Ptr DescriptorImageInfo -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr DescriptorImageInfo)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr (Ptr DescriptorImageInfo))) Ptr DescriptorImageInfo
pImageInfo''
    Ptr DescriptorBufferInfo
pBufferInfo'' <- if Vector DescriptorBufferInfo -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector DescriptorBufferInfo
bufferInfo)
      then Ptr DescriptorBufferInfo -> ContT b IO (Ptr DescriptorBufferInfo)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr DescriptorBufferInfo
forall a. Ptr a
nullPtr
      else do
        Ptr DescriptorBufferInfo
pPBufferInfo <- ((Ptr DescriptorBufferInfo -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorBufferInfo)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorBufferInfo -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorBufferInfo))
-> ((Ptr DescriptorBufferInfo -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorBufferInfo)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr DescriptorBufferInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorBufferInfo (((Vector DescriptorBufferInfo -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorBufferInfo
bufferInfo))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
24)
        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
$ (Int -> DescriptorBufferInfo -> IO ())
-> Vector DescriptorBufferInfo -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorBufferInfo
e -> Ptr DescriptorBufferInfo -> DescriptorBufferInfo -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DescriptorBufferInfo
pPBufferInfo Ptr DescriptorBufferInfo -> Int -> Ptr DescriptorBufferInfo
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorBufferInfo) (DescriptorBufferInfo
e)) ((Vector DescriptorBufferInfo
bufferInfo))
        Ptr DescriptorBufferInfo -> ContT b IO (Ptr DescriptorBufferInfo)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr DescriptorBufferInfo -> ContT b IO (Ptr DescriptorBufferInfo))
-> Ptr DescriptorBufferInfo
-> ContT b IO (Ptr DescriptorBufferInfo)
forall a b. (a -> b) -> a -> b
$ Ptr DescriptorBufferInfo
pPBufferInfo
    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 DescriptorBufferInfo) -> Ptr DescriptorBufferInfo -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr (Ptr DescriptorBufferInfo)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr (Ptr DescriptorBufferInfo))) Ptr DescriptorBufferInfo
pBufferInfo''
    Ptr BufferView
pTexelBufferView'' <- if Vector BufferView -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector BufferView
texelBufferView)
      then Ptr BufferView -> ContT b IO (Ptr BufferView)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr BufferView
forall a. Ptr a
nullPtr
      else do
        Ptr BufferView
pPTexelBufferView <- ((Ptr BufferView -> IO b) -> IO b) -> ContT b IO (Ptr BufferView)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr BufferView -> IO b) -> IO b) -> ContT b IO (Ptr BufferView))
-> ((Ptr BufferView -> IO b) -> IO b)
-> ContT b IO (Ptr BufferView)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr BufferView -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @BufferView (((Vector BufferView -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector BufferView
texelBufferView))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)
        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
$ (Int -> BufferView -> IO ()) -> Vector BufferView -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i BufferView
e -> Ptr BufferView -> BufferView -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr BufferView
pPTexelBufferView Ptr BufferView -> Int -> Ptr BufferView
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr BufferView) (BufferView
e)) ((Vector BufferView
texelBufferView))
        Ptr BufferView -> ContT b IO (Ptr BufferView)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr BufferView -> ContT b IO (Ptr BufferView))
-> Ptr BufferView -> ContT b IO (Ptr BufferView)
forall a b. (a -> b) -> a -> b
$ Ptr BufferView
pPTexelBufferView
    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 BufferView) -> Ptr BufferView -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr BufferView)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr (Ptr BufferView))) Ptr BufferView
pTexelBufferView''
    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 = Int
64
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr (WriteDescriptorSet es) -> IO b -> IO b
pokeZeroCStruct Ptr (WriteDescriptorSet es)
p 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 ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    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
$ ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
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 DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr DescriptorType)) (DescriptorType
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 (Extendss WriteDescriptorSet es, PeekChain es) => FromCStruct (WriteDescriptorSet es) where
  peekCStruct :: Ptr (WriteDescriptorSet es) -> IO (WriteDescriptorSet es)
peekCStruct Ptr (WriteDescriptorSet es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    DescriptorSet
dstSet <- ("pDescriptorSets" ::: Ptr DescriptorSet) -> IO DescriptorSet
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet))
    "descriptorSetCount" ::: Word32
dstBinding <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
dstArrayElement <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
descriptorCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Word32))
    DescriptorType
descriptorType <- Ptr DescriptorType -> IO DescriptorType
forall a. Storable a => Ptr a -> IO a
peek @DescriptorType ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr DescriptorType))
    Ptr DescriptorImageInfo
pImageInfo <- Ptr (Ptr DescriptorImageInfo) -> IO (Ptr DescriptorImageInfo)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorImageInfo) ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr DescriptorImageInfo)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr (Ptr DescriptorImageInfo)))
    let pImageInfoLength :: Int
pImageInfoLength = if Ptr DescriptorImageInfo
pImageInfo Ptr DescriptorImageInfo -> Ptr DescriptorImageInfo -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr DescriptorImageInfo
forall a. Ptr a
nullPtr then Int
0 else (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
descriptorCount)
    Vector DescriptorImageInfo
pImageInfo' <- Int
-> (Int -> IO DescriptorImageInfo)
-> IO (Vector DescriptorImageInfo)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pImageInfoLength (\Int
i -> Ptr DescriptorImageInfo -> IO DescriptorImageInfo
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DescriptorImageInfo ((Ptr DescriptorImageInfo
pImageInfo Ptr DescriptorImageInfo -> Int -> Ptr DescriptorImageInfo
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorImageInfo)))
    Ptr DescriptorBufferInfo
pBufferInfo <- Ptr (Ptr DescriptorBufferInfo) -> IO (Ptr DescriptorBufferInfo)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorBufferInfo) ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es)
-> Int -> Ptr (Ptr DescriptorBufferInfo)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr (Ptr DescriptorBufferInfo)))
    let pBufferInfoLength :: Int
pBufferInfoLength = if Ptr DescriptorBufferInfo
pBufferInfo Ptr DescriptorBufferInfo -> Ptr DescriptorBufferInfo -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr DescriptorBufferInfo
forall a. Ptr a
nullPtr then Int
0 else (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
descriptorCount)
    Vector DescriptorBufferInfo
pBufferInfo' <- Int
-> (Int -> IO DescriptorBufferInfo)
-> IO (Vector DescriptorBufferInfo)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pBufferInfoLength (\Int
i -> Ptr DescriptorBufferInfo -> IO DescriptorBufferInfo
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DescriptorBufferInfo ((Ptr DescriptorBufferInfo
pBufferInfo Ptr DescriptorBufferInfo -> Int -> Ptr DescriptorBufferInfo
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorBufferInfo)))
    Ptr BufferView
pTexelBufferView <- Ptr (Ptr BufferView) -> IO (Ptr BufferView)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr BufferView) ((Ptr (WriteDescriptorSet es)
p Ptr (WriteDescriptorSet es) -> Int -> Ptr (Ptr BufferView)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr (Ptr BufferView)))
    let pTexelBufferViewLength :: Int
pTexelBufferViewLength = if Ptr BufferView
pTexelBufferView Ptr BufferView -> Ptr BufferView -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr BufferView
forall a. Ptr a
nullPtr then Int
0 else (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
descriptorCount)
    Vector BufferView
pTexelBufferView' <- Int -> (Int -> IO BufferView) -> IO (Vector BufferView)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pTexelBufferViewLength (\Int
i -> Ptr BufferView -> IO BufferView
forall a. Storable a => Ptr a -> IO a
peek @BufferView ((Ptr BufferView
pTexelBufferView Ptr BufferView -> Int -> Ptr BufferView
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr BufferView)))
    WriteDescriptorSet es -> IO (WriteDescriptorSet es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (WriteDescriptorSet es -> IO (WriteDescriptorSet es))
-> WriteDescriptorSet es -> IO (WriteDescriptorSet es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
forall (es :: [*]).
Chain es
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
WriteDescriptorSet
             Chain es
next DescriptorSet
dstSet "descriptorSetCount" ::: Word32
dstBinding "descriptorSetCount" ::: Word32
dstArrayElement "descriptorSetCount" ::: Word32
descriptorCount DescriptorType
descriptorType Vector DescriptorImageInfo
pImageInfo' Vector DescriptorBufferInfo
pBufferInfo' Vector BufferView
pTexelBufferView'

instance es ~ '[] => Zero (WriteDescriptorSet es) where
  zero :: WriteDescriptorSet es
zero = Chain es
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
forall (es :: [*]).
Chain es
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
WriteDescriptorSet
           ()
           DescriptorSet
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           DescriptorType
forall a. Zero a => a
zero
           Vector DescriptorImageInfo
forall a. Monoid a => a
mempty
           Vector DescriptorBufferInfo
forall a. Monoid a => a
mempty
           Vector BufferView
forall a. Monoid a => a
mempty


-- | VkCopyDescriptorSet - Structure specifying a copy descriptor set
-- operation
--
-- = Description
--
-- If the 'DescriptorSetLayoutBinding' for @dstBinding@ is
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE' and
-- @srcBinding@ is not
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE', the
-- new active descriptor type becomes the descriptor type of @srcBinding@.
-- If both 'DescriptorSetLayoutBinding' for @srcBinding@ and @dstBinding@
-- are 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
-- the active descriptor type in each source descriptor is copied into the
-- corresponding destination descriptor. The active descriptor type /can/
-- be different for each source descriptor.
--
-- Note
--
-- The intention is that copies to and from mutable descriptors is a simple
-- memcpy. Copies between non-mutable and mutable descriptors are expected
-- to require one memcpy per descriptor to handle the difference in size,
-- but this use case with more than one @descriptorCount@ is considered
-- rare.
--
-- == Valid Usage
--
-- -   #VUID-VkCopyDescriptorSet-srcBinding-00345# @srcBinding@ /must/ be a
--     valid binding within @srcSet@
--
-- -   #VUID-VkCopyDescriptorSet-srcArrayElement-00346# The sum of
--     @srcArrayElement@ and @descriptorCount@ /must/ be less than or equal
--     to the number of array elements in the descriptor set binding
--     specified by @srcBinding@, and all applicable consecutive bindings,
--     as described by
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-updates-consecutive>
--
-- -   #VUID-VkCopyDescriptorSet-dstBinding-00347# @dstBinding@ /must/ be a
--     valid binding within @dstSet@
--
-- -   #VUID-VkCopyDescriptorSet-dstArrayElement-00348# The sum of
--     @dstArrayElement@ and @descriptorCount@ /must/ be less than or equal
--     to the number of array elements in the descriptor set binding
--     specified by @dstBinding@, and all applicable consecutive bindings,
--     as described by
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-updates-consecutive>
--
-- -   #VUID-VkCopyDescriptorSet-dstBinding-02632# The type of @dstBinding@
--     within @dstSet@ /must/ be equal to the type of @srcBinding@ within
--     @srcSet@
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-00349# If @srcSet@ is equal to
--     @dstSet@, then the source and destination ranges of descriptors
--     /must/ not overlap, where the ranges /may/ include array elements
--     from consecutive bindings as described by
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#descriptorsets-updates-consecutive>
--
-- -   #VUID-VkCopyDescriptorSet-srcBinding-02223# If the descriptor type
--     of the descriptor set binding specified by @srcBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @srcArrayElement@ /must/ be an integer multiple of @4@
--
-- -   #VUID-VkCopyDescriptorSet-dstBinding-02224# If the descriptor type
--     of the descriptor set binding specified by @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @dstArrayElement@ /must/ be an integer multiple of @4@
--
-- -   #VUID-VkCopyDescriptorSet-srcBinding-02225# If the descriptor type
--     of the descriptor set binding specified by either @srcBinding@ or
--     @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT',
--     @descriptorCount@ /must/ be an integer multiple of @4@
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-01918# If @srcSet@’s layout was
--     created with the
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--     flag set, then @dstSet@’s layout /must/ also have been created with
--     the
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--     flag set
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-04885# If @srcSet@’s layout was
--     created with neither
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--     nor
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE'
--     flags set, then @dstSet@’s layout /must/ have been created without
--     the
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--     flag set
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-01920# If the descriptor pool from
--     which @srcSet@ was allocated was created with the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     flag set, then the descriptor pool from which @dstSet@ was allocated
--     /must/ also have been created with the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     flag set
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-04887# If the descriptor pool from
--     which @srcSet@ was allocated was created with neither
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     nor
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE'
--     flags set, then the descriptor pool from which @dstSet@ was
--     allocated /must/ have been created without the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     flag set
--
-- -   #VUID-VkCopyDescriptorSet-dstBinding-02753# If the descriptor type
--     of the descriptor set binding specified by @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER', then
--     @dstSet@ /must/ not have been allocated with a layout that included
--     immutable samplers for @dstBinding@
--
-- -   #VUID-VkCopyDescriptorSet-dstSet-04612# If
--     'DescriptorSetLayoutBinding' for @dstSet@ at @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     the new active descriptor type /must/ exist in the corresponding
--     @pMutableDescriptorTypeLists@ list for @dstBinding@ if the new
--     active descriptor type is not
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-04613# If
--     'DescriptorSetLayoutBinding' for @srcSet@ at @srcBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--     and the 'DescriptorSetLayoutBinding' for @dstSet@ at @dstBinding@ is
--     not
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     the active descriptor type for the source descriptor /must/ match
--     the descriptor type of @dstBinding@
--
-- -   #VUID-VkCopyDescriptorSet-dstSet-04614# If
--     'DescriptorSetLayoutBinding' for @dstSet@ at @dstBinding@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     and the new active descriptor type is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     the @pMutableDescriptorTypeLists@ for @srcBinding@ and @dstBinding@
--     /must/ match exactly
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkCopyDescriptorSet-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COPY_DESCRIPTOR_SET'
--
-- -   #VUID-VkCopyDescriptorSet-pNext-pNext# @pNext@ /must/ be @NULL@
--
-- -   #VUID-VkCopyDescriptorSet-srcSet-parameter# @srcSet@ /must/ be a
--     valid 'Vulkan.Core10.Handles.DescriptorSet' handle
--
-- -   #VUID-VkCopyDescriptorSet-dstSet-parameter# @dstSet@ /must/ be a
--     valid 'Vulkan.Core10.Handles.DescriptorSet' handle
--
-- -   #VUID-VkCopyDescriptorSet-commonparent# Both of @dstSet@, and
--     @srcSet@ /must/ have been created, allocated, or retrieved from the
--     same 'Vulkan.Core10.Handles.Device'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorSet',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'updateDescriptorSets'
data CopyDescriptorSet = CopyDescriptorSet
  { -- | @srcSet@, @srcBinding@, and @srcArrayElement@ are the source set,
    -- binding, and array element, respectively. If the descriptor binding
    -- identified by @srcSet@ and @srcBinding@ has a descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @srcArrayElement@ specifies the starting byte offset within the
    -- binding to copy from.
    CopyDescriptorSet -> DescriptorSet
srcSet :: DescriptorSet
  , -- No documentation found for Nested "VkCopyDescriptorSet" "srcBinding"
    CopyDescriptorSet -> "descriptorSetCount" ::: Word32
srcBinding :: Word32
  , -- No documentation found for Nested "VkCopyDescriptorSet" "srcArrayElement"
    CopyDescriptorSet -> "descriptorSetCount" ::: Word32
srcArrayElement :: Word32
  , -- | @dstSet@, @dstBinding@, and @dstArrayElement@ are the destination set,
    -- binding, and array element, respectively. If the descriptor binding
    -- identified by @dstSet@ and @dstBinding@ has a descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @dstArrayElement@ specifies the starting byte offset within the
    -- binding to copy to.
    CopyDescriptorSet -> DescriptorSet
dstSet :: DescriptorSet
  , -- No documentation found for Nested "VkCopyDescriptorSet" "dstBinding"
    CopyDescriptorSet -> "descriptorSetCount" ::: Word32
dstBinding :: Word32
  , -- No documentation found for Nested "VkCopyDescriptorSet" "dstArrayElement"
    CopyDescriptorSet -> "descriptorSetCount" ::: Word32
dstArrayElement :: Word32
  , -- | @descriptorCount@ is the number of descriptors to copy from the source
    -- to destination. If @descriptorCount@ is greater than the number of
    -- remaining array elements in the source or destination binding, those
    -- affect consecutive bindings in a manner similar to 'WriteDescriptorSet'
    -- above. If the descriptor binding identified by @srcSet@ and @srcBinding@
    -- has a descriptor type of
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @descriptorCount@ specifies the number of bytes to copy and the
    -- remaining array elements in the source or destination binding refer to
    -- the remaining number of bytes in those.
    CopyDescriptorSet -> "descriptorSetCount" ::: Word32
descriptorCount :: Word32
  }
  deriving (Typeable, CopyDescriptorSet -> CopyDescriptorSet -> Bool
(CopyDescriptorSet -> CopyDescriptorSet -> Bool)
-> (CopyDescriptorSet -> CopyDescriptorSet -> Bool)
-> Eq CopyDescriptorSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
$c/= :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
== :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
$c== :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyDescriptorSet)
#endif
deriving instance Show CopyDescriptorSet

instance ToCStruct CopyDescriptorSet where
  withCStruct :: CopyDescriptorSet
-> (("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b)
-> IO b
withCStruct CopyDescriptorSet
x ("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b
f = Int
-> (("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b)
-> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
56 ((("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b) -> IO b)
-> (("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \"pDescriptorCopies" ::: Ptr CopyDescriptorSet
p -> ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> CopyDescriptorSet -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pDescriptorCopies" ::: Ptr CopyDescriptorSet
p CopyDescriptorSet
x (("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b
f "pDescriptorCopies" ::: Ptr CopyDescriptorSet
p)
  pokeCStruct :: ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> CopyDescriptorSet -> IO b -> IO b
pokeCStruct "pDescriptorCopies" ::: Ptr CopyDescriptorSet
p CopyDescriptorSet{"descriptorSetCount" ::: Word32
DescriptorSet
descriptorCount :: "descriptorSetCount" ::: Word32
dstArrayElement :: "descriptorSetCount" ::: Word32
dstBinding :: "descriptorSetCount" ::: Word32
dstSet :: DescriptorSet
srcArrayElement :: "descriptorSetCount" ::: Word32
srcBinding :: "descriptorSetCount" ::: Word32
srcSet :: DescriptorSet
$sel:descriptorCount:CopyDescriptorSet :: CopyDescriptorSet -> "descriptorSetCount" ::: Word32
$sel:dstArrayElement:CopyDescriptorSet :: CopyDescriptorSet -> "descriptorSetCount" ::: Word32
$sel:dstBinding:CopyDescriptorSet :: CopyDescriptorSet -> "descriptorSetCount" ::: Word32
$sel:dstSet:CopyDescriptorSet :: CopyDescriptorSet -> DescriptorSet
$sel:srcArrayElement:CopyDescriptorSet :: CopyDescriptorSet -> "descriptorSetCount" ::: Word32
$sel:srcBinding:CopyDescriptorSet :: CopyDescriptorSet -> "descriptorSetCount" ::: Word32
$sel:srcSet:CopyDescriptorSet :: CopyDescriptorSet -> DescriptorSet
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_DESCRIPTOR_SET)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
srcSet)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
srcBinding)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
srcArrayElement)
    ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DescriptorSet)) (DescriptorSet
dstSet)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
dstBinding)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
dstArrayElement)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
descriptorCount)
    IO b
f
  cStructSize :: Int
cStructSize = Int
56
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: ("pDescriptorCopies" ::: Ptr CopyDescriptorSet) -> IO b -> IO b
pokeZeroCStruct "pDescriptorCopies" ::: Ptr CopyDescriptorSet
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_DESCRIPTOR_SET)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    ("pDescriptorSets" ::: Ptr DescriptorSet) -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DescriptorSet)) (DescriptorSet
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct CopyDescriptorSet where
  peekCStruct :: ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> IO CopyDescriptorSet
peekCStruct "pDescriptorCopies" ::: Ptr CopyDescriptorSet
p = do
    DescriptorSet
srcSet <- ("pDescriptorSets" ::: Ptr DescriptorSet) -> IO DescriptorSet
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet))
    "descriptorSetCount" ::: Word32
srcBinding <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
srcArrayElement <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32))
    DescriptorSet
dstSet <- ("pDescriptorSets" ::: Ptr DescriptorSet) -> IO DescriptorSet
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> "pDescriptorSets" ::: Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DescriptorSet))
    "descriptorSetCount" ::: Word32
dstBinding <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
dstArrayElement <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
descriptorCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pDescriptorCopies" ::: Ptr CopyDescriptorSet
p ("pDescriptorCopies" ::: Ptr CopyDescriptorSet)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32))
    CopyDescriptorSet -> IO CopyDescriptorSet
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CopyDescriptorSet -> IO CopyDescriptorSet)
-> CopyDescriptorSet -> IO CopyDescriptorSet
forall a b. (a -> b) -> a -> b
$ DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> CopyDescriptorSet
CopyDescriptorSet
             DescriptorSet
srcSet "descriptorSetCount" ::: Word32
srcBinding "descriptorSetCount" ::: Word32
srcArrayElement DescriptorSet
dstSet "descriptorSetCount" ::: Word32
dstBinding "descriptorSetCount" ::: Word32
dstArrayElement "descriptorSetCount" ::: Word32
descriptorCount

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

instance Zero CopyDescriptorSet where
  zero :: CopyDescriptorSet
zero = DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> DescriptorSet
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32)
-> CopyDescriptorSet
CopyDescriptorSet
           DescriptorSet
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           DescriptorSet
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero


-- | VkDescriptorSetLayoutBinding - Structure specifying a descriptor set
-- layout binding
--
-- = Description
--
-- -   @pImmutableSamplers@ affects initialization of samplers. If
--     @descriptorType@ specifies a
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER' or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER'
--     type descriptor, then @pImmutableSamplers@ /can/ be used to
--     initialize a set of /immutable samplers/. Immutable samplers are
--     permanently bound into the set layout and /must/ not be changed;
--     updating a
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER'
--     descriptor with immutable samplers is not allowed and updates to a
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER'
--     descriptor with immutable samplers does not modify the samplers (the
--     image views are updated, but the sampler updates are ignored). If
--     @pImmutableSamplers@ is not @NULL@, then it is a pointer to an array
--     of sampler handles that will be copied into the set layout and used
--     for the corresponding binding. Only the sampler handles are copied;
--     the sampler objects /must/ not be destroyed before the final use of
--     the set layout and any descriptor pools and sets created using it.
--     If @pImmutableSamplers@ is @NULL@, then the sampler slots are
--     dynamic and sampler handles /must/ be bound into descriptor sets
--     using this layout. If @descriptorType@ is not one of these
--     descriptor types, then @pImmutableSamplers@ is ignored.
--
-- The above layout definition allows the descriptor bindings to be
-- specified sparsely such that not all binding numbers between 0 and the
-- maximum binding number need to be specified in the @pBindings@ array.
-- Bindings that are not specified have a @descriptorCount@ and
-- @stageFlags@ of zero, and the value of @descriptorType@ is undefined.
-- However, all binding numbers between 0 and the maximum binding number in
-- the 'DescriptorSetLayoutCreateInfo'::@pBindings@ array /may/ consume
-- memory in the descriptor set layout even if not all descriptor bindings
-- are used, though it /should/ not consume additional memory from the
-- descriptor pool.
--
-- Note
--
-- The maximum binding number specified /should/ be as compact as possible
-- to avoid wasted memory.
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-00282# If
--     @descriptorType@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLER' or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER',
--     and @descriptorCount@ is not @0@ and @pImmutableSamplers@ is not
--     @NULL@, @pImmutableSamplers@ /must/ be a valid pointer to an array
--     of @descriptorCount@ valid 'Vulkan.Core10.Handles.Sampler' handles
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-04604# If the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#features-inlineUniformBlock inlineUniformBlock>
--     feature is not enabled, @descriptorType@ /must/ not be
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-02209# If
--     @descriptorType@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--     then @descriptorCount@ /must/ be a multiple of @4@
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-02210# If
--     @descriptorType@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--     then @descriptorCount@ /must/ be less than or equal to
--     'Vulkan.Extensions.VK_EXT_inline_uniform_block.PhysicalDeviceInlineUniformBlockPropertiesEXT'::@maxInlineUniformBlockSize@
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorCount-00283# If
--     @descriptorCount@ is not @0@, @stageFlags@ /must/ be a valid
--     combination of
--     'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlagBits' values
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-01510# If
--     @descriptorType@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INPUT_ATTACHMENT'
--     and @descriptorCount@ is not @0@, then @stageFlags@ /must/ be @0@ or
--     'Vulkan.Core10.Enums.ShaderStageFlagBits.SHADER_STAGE_FRAGMENT_BIT'
--
-- -   #VUID-VkDescriptorSetLayoutBinding-pImmutableSamplers-04009# The
--     sampler objects indicated by @pImmutableSamplers@ /must/ not have a
--     @borderColor@ with one of the values
--     'Vulkan.Core10.Enums.BorderColor.BORDER_COLOR_FLOAT_CUSTOM_EXT' or
--     'Vulkan.Core10.Enums.BorderColor.BORDER_COLOR_INT_CUSTOM_EXT'
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-04605# If
--     @descriptorType@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     then @pImmutableSamplers@ /must/ be @NULL@.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorSetLayoutBinding-descriptorType-parameter#
--     @descriptorType@ /must/ be a valid
--     'Vulkan.Core10.Enums.DescriptorType.DescriptorType' value
--
-- = See Also
--
-- 'DescriptorSetLayoutCreateInfo',
-- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType',
-- 'Vulkan.Core10.Handles.Sampler',
-- 'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlags'
data DescriptorSetLayoutBinding = DescriptorSetLayoutBinding
  { -- | @binding@ is the binding number of this entry and corresponds to a
    -- resource of the same binding number in the shader stages.
    DescriptorSetLayoutBinding -> "descriptorSetCount" ::: Word32
binding :: Word32
  , -- | @descriptorType@ is a
    -- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType' specifying which
    -- type of resource descriptors are used for this binding.
    DescriptorSetLayoutBinding -> DescriptorType
descriptorType :: DescriptorType
  , -- | @descriptorCount@ is the number of descriptors contained in the binding,
    -- accessed in a shader as an array, except if @descriptorType@ is
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- in which case @descriptorCount@ is the size in bytes of the inline
    -- uniform block. If @descriptorCount@ is zero this binding entry is
    -- reserved and the resource /must/ not be accessed from any stage via this
    -- binding within any pipeline using the set layout.
    DescriptorSetLayoutBinding -> "descriptorSetCount" ::: Word32
descriptorCount :: Word32
  , -- | @stageFlags@ member is a bitmask of
    -- 'Vulkan.Core10.Enums.ShaderStageFlagBits.ShaderStageFlagBits' specifying
    -- which pipeline shader stages /can/ access a resource for this binding.
    -- 'Vulkan.Core10.Enums.ShaderStageFlagBits.SHADER_STAGE_ALL' is a
    -- shorthand specifying that all defined shader stages, including any
    -- additional stages defined by extensions, /can/ access the resource.
    --
    -- If a shader stage is not included in @stageFlags@, then a resource
    -- /must/ not be accessed from that stage via this binding within any
    -- pipeline using the set layout. Other than input attachments which are
    -- limited to the fragment shader, there are no limitations on what
    -- combinations of stages /can/ use a descriptor binding, and in particular
    -- a binding /can/ be used by both graphics stages and the compute stage.
    DescriptorSetLayoutBinding -> ShaderStageFlags
stageFlags :: ShaderStageFlags
  , -- No documentation found for Nested "VkDescriptorSetLayoutBinding" "pImmutableSamplers"
    DescriptorSetLayoutBinding -> Vector Sampler
immutableSamplers :: Vector Sampler
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorSetLayoutBinding)
#endif
deriving instance Show DescriptorSetLayoutBinding

instance ToCStruct DescriptorSetLayoutBinding where
  withCStruct :: DescriptorSetLayoutBinding
-> (Ptr DescriptorSetLayoutBinding -> IO b) -> IO b
withCStruct DescriptorSetLayoutBinding
x Ptr DescriptorSetLayoutBinding -> IO b
f = Int -> (Ptr DescriptorSetLayoutBinding -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr DescriptorSetLayoutBinding -> IO b) -> IO b)
-> (Ptr DescriptorSetLayoutBinding -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DescriptorSetLayoutBinding
p -> Ptr DescriptorSetLayoutBinding
-> DescriptorSetLayoutBinding -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorSetLayoutBinding
p DescriptorSetLayoutBinding
x (Ptr DescriptorSetLayoutBinding -> IO b
f Ptr DescriptorSetLayoutBinding
p)
  pokeCStruct :: Ptr DescriptorSetLayoutBinding
-> DescriptorSetLayoutBinding -> IO b -> IO b
pokeCStruct Ptr DescriptorSetLayoutBinding
p DescriptorSetLayoutBinding{"descriptorSetCount" ::: Word32
Vector Sampler
ShaderStageFlags
DescriptorType
immutableSamplers :: Vector Sampler
stageFlags :: ShaderStageFlags
descriptorCount :: "descriptorSetCount" ::: Word32
descriptorType :: DescriptorType
binding :: "descriptorSetCount" ::: Word32
$sel:immutableSamplers:DescriptorSetLayoutBinding :: DescriptorSetLayoutBinding -> Vector Sampler
$sel:stageFlags:DescriptorSetLayoutBinding :: DescriptorSetLayoutBinding -> ShaderStageFlags
$sel:descriptorCount:DescriptorSetLayoutBinding :: DescriptorSetLayoutBinding -> "descriptorSetCount" ::: Word32
$sel:descriptorType:DescriptorSetLayoutBinding :: DescriptorSetLayoutBinding -> DescriptorType
$sel:binding:DescriptorSetLayoutBinding :: DescriptorSetLayoutBinding -> "descriptorSetCount" ::: Word32
..} 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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
binding)
    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 DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr DescriptorType)) (DescriptorType
descriptorType)
    let pImmutableSamplersLength :: Int
pImmutableSamplersLength = Vector Sampler -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Sampler -> Int) -> Vector Sampler -> Int
forall a b. (a -> b) -> a -> b
$ (Vector Sampler
immutableSamplers)
    "descriptorSetCount" ::: Word32
descriptorCount'' <- IO ("descriptorSetCount" ::: Word32)
-> ContT b IO ("descriptorSetCount" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("descriptorSetCount" ::: Word32)
 -> ContT b IO ("descriptorSetCount" ::: Word32))
-> IO ("descriptorSetCount" ::: Word32)
-> ContT b IO ("descriptorSetCount" ::: Word32)
forall a b. (a -> b) -> a -> b
$ if ("descriptorSetCount" ::: Word32
descriptorCount) ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== "descriptorSetCount" ::: Word32
0
      then ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("descriptorSetCount" ::: Word32)
 -> IO ("descriptorSetCount" ::: Word32))
-> ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a b. (a -> b) -> a -> b
$ Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pImmutableSamplersLength
      else do
        Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pImmutableSamplersLength ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> Bool
forall a. Eq a => a -> a -> Bool
== ("descriptorSetCount" ::: Word32
descriptorCount) Bool -> Bool -> Bool
|| Int
pImmutableSamplersLength Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
          IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pImmutableSamplers must be empty or have 'descriptorCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
        ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ("descriptorSetCount" ::: Word32
descriptorCount)
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
descriptorCount'')
    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 ShaderStageFlags -> ShaderStageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr ShaderStageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr ShaderStageFlags)) (ShaderStageFlags
stageFlags)
    Ptr Sampler
pImmutableSamplers'' <- if Vector Sampler -> Bool
forall a. Vector a -> Bool
Data.Vector.null (Vector Sampler
immutableSamplers)
      then Ptr Sampler -> ContT b IO (Ptr Sampler)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr Sampler
forall a. Ptr a
nullPtr
      else do
        Ptr Sampler
pPImmutableSamplers <- ((Ptr Sampler -> IO b) -> IO b) -> ContT b IO (Ptr Sampler)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Sampler -> IO b) -> IO b) -> ContT b IO (Ptr Sampler))
-> ((Ptr Sampler -> IO b) -> IO b) -> ContT b IO (Ptr Sampler)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr Sampler -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Sampler (((Vector Sampler -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Sampler
immutableSamplers))) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)
        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
$ (Int -> Sampler -> IO ()) -> Vector Sampler -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Sampler
e -> Ptr Sampler -> Sampler -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Sampler
pPImmutableSamplers Ptr Sampler -> Int -> Ptr Sampler
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Sampler) (Sampler
e)) ((Vector Sampler
immutableSamplers))
        Ptr Sampler -> ContT b IO (Ptr Sampler)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr Sampler -> ContT b IO (Ptr Sampler))
-> Ptr Sampler -> ContT b IO (Ptr Sampler)
forall a b. (a -> b) -> a -> b
$ Ptr Sampler
pPImmutableSamplers
    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 Sampler) -> Ptr Sampler -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr (Ptr Sampler)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr Sampler))) Ptr Sampler
pImmutableSamplers''
    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 = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr DescriptorSetLayoutBinding -> IO b -> IO b
pokeZeroCStruct Ptr DescriptorSetLayoutBinding
p IO b
f = do
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    Ptr DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr DescriptorType)) (DescriptorType
forall a. Zero a => a
zero)
    Ptr ShaderStageFlags -> ShaderStageFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr ShaderStageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr ShaderStageFlags)) (ShaderStageFlags
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DescriptorSetLayoutBinding where
  peekCStruct :: Ptr DescriptorSetLayoutBinding -> IO DescriptorSetLayoutBinding
peekCStruct Ptr DescriptorSetLayoutBinding
p = do
    "descriptorSetCount" ::: Word32
binding <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32))
    DescriptorType
descriptorType <- Ptr DescriptorType -> IO DescriptorType
forall a. Storable a => Ptr a -> IO a
peek @DescriptorType ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr DescriptorType))
    "descriptorSetCount" ::: Word32
descriptorCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32))
    ShaderStageFlags
stageFlags <- Ptr ShaderStageFlags -> IO ShaderStageFlags
forall a. Storable a => Ptr a -> IO a
peek @ShaderStageFlags ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr ShaderStageFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr ShaderStageFlags))
    Ptr Sampler
pImmutableSamplers <- Ptr (Ptr Sampler) -> IO (Ptr Sampler)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Sampler) ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr (Ptr Sampler)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr (Ptr Sampler)))
    let pImmutableSamplersLength :: Int
pImmutableSamplersLength = if Ptr Sampler
pImmutableSamplers Ptr Sampler -> Ptr Sampler -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Sampler
forall a. Ptr a
nullPtr then Int
0 else (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
descriptorCount)
    Vector Sampler
pImmutableSamplers' <- Int -> (Int -> IO Sampler) -> IO (Vector Sampler)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pImmutableSamplersLength (\Int
i -> Ptr Sampler -> IO Sampler
forall a. Storable a => Ptr a -> IO a
peek @Sampler ((Ptr Sampler
pImmutableSamplers Ptr Sampler -> Int -> Ptr Sampler
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Sampler)))
    DescriptorSetLayoutBinding -> IO DescriptorSetLayoutBinding
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorSetLayoutBinding -> IO DescriptorSetLayoutBinding)
-> DescriptorSetLayoutBinding -> IO DescriptorSetLayoutBinding
forall a b. (a -> b) -> a -> b
$ ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> ("descriptorSetCount" ::: Word32)
-> ShaderStageFlags
-> Vector Sampler
-> DescriptorSetLayoutBinding
DescriptorSetLayoutBinding
             "descriptorSetCount" ::: Word32
binding DescriptorType
descriptorType "descriptorSetCount" ::: Word32
descriptorCount ShaderStageFlags
stageFlags Vector Sampler
pImmutableSamplers'

instance Zero DescriptorSetLayoutBinding where
  zero :: DescriptorSetLayoutBinding
zero = ("descriptorSetCount" ::: Word32)
-> DescriptorType
-> ("descriptorSetCount" ::: Word32)
-> ShaderStageFlags
-> Vector Sampler
-> DescriptorSetLayoutBinding
DescriptorSetLayoutBinding
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           DescriptorType
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           ShaderStageFlags
forall a. Zero a => a
zero
           Vector Sampler
forall a. Monoid a => a
mempty


-- | VkDescriptorSetLayoutCreateInfo - Structure specifying parameters of a
-- newly created descriptor set layout
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-binding-00279# The
--     'DescriptorSetLayoutBinding'::@binding@ members of the elements of
--     the @pBindings@ array /must/ each have different values
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-00280# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR',
--     then all elements of @pBindings@ /must/ not have a @descriptorType@
--     of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-02208# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR',
--     then all elements of @pBindings@ /must/ not have a @descriptorType@
--     of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-00281# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR',
--     then the total number of elements of all bindings /must/ be less
--     than or equal to
--     'Vulkan.Extensions.VK_KHR_push_descriptor.PhysicalDevicePushDescriptorPropertiesKHR'::@maxPushDescriptors@
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-04590# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR',
--     @flags@ /must/ not contain
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-04591# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR',
--     @pBindings@ /must/ not have a @descriptorType@ of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-03000# If any binding
--     has the
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT'
--     bit set, @flags@ /must/ include
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-descriptorType-03001# If any
--     binding has the
--     'Vulkan.Core12.Enums.DescriptorBindingFlagBits.DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT'
--     bit set, then all bindings /must/ not have @descriptorType@ of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC'
--     or
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-04592# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT',
--     @flags@ /must/ not contain
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-descriptorType-04593# If any
--     binding has a @descriptorType@ of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     then a
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'
--     /must/ be present in the @pNext@ chain
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-descriptorType-04594# If a
--     binding has a @descriptorType@ value of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     then @pImmutableSamplers@ /must/ be @NULL@
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-mutableDescriptorType-04595#
--     If
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.PhysicalDeviceMutableDescriptorTypeFeaturesVALVE'::@mutableDescriptorType@
--     is not enabled, @pBindings@ /must/ not contain a @descriptorType@ of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-04596# If @flags@
--     contains
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE',
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.PhysicalDeviceMutableDescriptorTypeFeaturesVALVE'::@mutableDescriptorType@
--     /must/ be enabled
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-pNext-pNext# Each @pNext@
--     member of any structure (including this one) in the @pNext@ chain
--     /must/ be either @NULL@ or a pointer to a valid instance of
--     'Vulkan.Core12.Promoted_From_VK_EXT_descriptor_indexing.DescriptorSetLayoutBindingFlagsCreateInfo'
--     or
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-sType-unique# The @sType@
--     value of each struct in the @pNext@ chain /must/ be unique
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-flags-parameter# @flags@
--     /must/ be a valid combination of
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DescriptorSetLayoutCreateFlagBits'
--     values
--
-- -   #VUID-VkDescriptorSetLayoutCreateInfo-pBindings-parameter# If
--     @bindingCount@ is not @0@, @pBindings@ /must/ be a valid pointer to
--     an array of @bindingCount@ valid 'DescriptorSetLayoutBinding'
--     structures
--
-- = See Also
--
-- 'DescriptorSetLayoutBinding',
-- 'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DescriptorSetLayoutCreateFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createDescriptorSetLayout',
-- 'Vulkan.Core11.Promoted_From_VK_KHR_maintenance3.getDescriptorSetLayoutSupport',
-- 'Vulkan.Extensions.VK_KHR_maintenance3.getDescriptorSetLayoutSupportKHR'
data DescriptorSetLayoutCreateInfo (es :: [Type]) = DescriptorSetLayoutCreateInfo
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    DescriptorSetLayoutCreateInfo es -> Chain es
next :: Chain es
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DescriptorSetLayoutCreateFlagBits'
    -- specifying options for descriptor set layout creation.
    DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
flags :: DescriptorSetLayoutCreateFlags
  , -- | @pBindings@ is a pointer to an array of 'DescriptorSetLayoutBinding'
    -- structures.
    DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
bindings :: Vector DescriptorSetLayoutBinding
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorSetLayoutCreateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (DescriptorSetLayoutCreateInfo es)

instance Extensible DescriptorSetLayoutCreateInfo where
  extensibleTypeName :: String
extensibleTypeName = String
"DescriptorSetLayoutCreateInfo"
  setNext :: DescriptorSetLayoutCreateInfo ds
-> Chain es -> DescriptorSetLayoutCreateInfo es
setNext DescriptorSetLayoutCreateInfo ds
x Chain es
next = DescriptorSetLayoutCreateInfo ds
x{$sel:next:DescriptorSetLayoutCreateInfo :: Chain es
next = Chain es
next}
  getNext :: DescriptorSetLayoutCreateInfo es -> Chain es
getNext DescriptorSetLayoutCreateInfo{Vector DescriptorSetLayoutBinding
Chain es
DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
flags :: DescriptorSetLayoutCreateFlags
next :: Chain es
$sel:bindings:DescriptorSetLayoutCreateInfo :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
$sel:flags:DescriptorSetLayoutCreateInfo :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
$sel:next:DescriptorSetLayoutCreateInfo :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorSetLayoutCreateInfo e => b) -> Maybe b
  extends :: proxy e
-> (Extends DescriptorSetLayoutCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorSetLayoutCreateInfo e => b
f
    | Just e :~: MutableDescriptorTypeCreateInfoVALVE
Refl <- (Typeable e, Typeable MutableDescriptorTypeCreateInfoVALVE) =>
Maybe (e :~: MutableDescriptorTypeCreateInfoVALVE)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @MutableDescriptorTypeCreateInfoVALVE = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorSetLayoutCreateInfo e => b
f
    | Just e :~: DescriptorSetLayoutBindingFlagsCreateInfo
Refl <- (Typeable e, Typeable DescriptorSetLayoutBindingFlagsCreateInfo) =>
Maybe (e :~: DescriptorSetLayoutBindingFlagsCreateInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @DescriptorSetLayoutBindingFlagsCreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorSetLayoutCreateInfo e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss DescriptorSetLayoutCreateInfo es, PokeChain es) => ToCStruct (DescriptorSetLayoutCreateInfo es) where
  withCStruct :: DescriptorSetLayoutCreateInfo es
-> (Ptr (DescriptorSetLayoutCreateInfo es) -> IO b) -> IO b
withCStruct DescriptorSetLayoutCreateInfo es
x Ptr (DescriptorSetLayoutCreateInfo es) -> IO b
f = Int -> (Ptr (DescriptorSetLayoutCreateInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr (DescriptorSetLayoutCreateInfo es) -> IO b) -> IO b)
-> (Ptr (DescriptorSetLayoutCreateInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (DescriptorSetLayoutCreateInfo es)
p -> Ptr (DescriptorSetLayoutCreateInfo es)
-> DescriptorSetLayoutCreateInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p DescriptorSetLayoutCreateInfo es
x (Ptr (DescriptorSetLayoutCreateInfo es) -> IO b
f Ptr (DescriptorSetLayoutCreateInfo es)
p)
  pokeCStruct :: Ptr (DescriptorSetLayoutCreateInfo es)
-> DescriptorSetLayoutCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p DescriptorSetLayoutCreateInfo{Vector DescriptorSetLayoutBinding
Chain es
DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
flags :: DescriptorSetLayoutCreateFlags
next :: Chain es
$sel:bindings:DescriptorSetLayoutCreateInfo :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
$sel:flags:DescriptorSetLayoutCreateInfo :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
$sel:next:DescriptorSetLayoutCreateInfo :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
..} 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 ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    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 DescriptorSetLayoutCreateFlags
-> DescriptorSetLayoutCreateFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr DescriptorSetLayoutCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSetLayoutCreateFlags)) (DescriptorSetLayoutCreateFlags
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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector DescriptorSetLayoutBinding -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayoutBinding -> Int)
-> Vector DescriptorSetLayoutBinding -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorSetLayoutBinding
bindings)) :: Word32))
    Ptr DescriptorSetLayoutBinding
pPBindings' <- ((Ptr DescriptorSetLayoutBinding -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorSetLayoutBinding)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorSetLayoutBinding -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorSetLayoutBinding))
-> ((Ptr DescriptorSetLayoutBinding -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorSetLayoutBinding)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr DescriptorSetLayoutBinding -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorSetLayoutBinding ((Vector DescriptorSetLayoutBinding -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayoutBinding
bindings)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
24)
    (Int -> DescriptorSetLayoutBinding -> ContT b IO ())
-> Vector DescriptorSetLayoutBinding -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorSetLayoutBinding
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 DescriptorSetLayoutBinding
-> DescriptorSetLayoutBinding -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr DescriptorSetLayoutBinding
pPBindings' Ptr DescriptorSetLayoutBinding
-> Int -> Ptr DescriptorSetLayoutBinding
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSetLayoutBinding) (DescriptorSetLayoutBinding
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 DescriptorSetLayoutBinding
bindings)
    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 DescriptorSetLayoutBinding)
-> Ptr DescriptorSetLayoutBinding -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr (Ptr DescriptorSetLayoutBinding)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DescriptorSetLayoutBinding))) (Ptr DescriptorSetLayoutBinding
pPBindings')
    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 = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr (DescriptorSetLayoutCreateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p 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 ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    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 (Extendss DescriptorSetLayoutCreateInfo es, PeekChain es) => FromCStruct (DescriptorSetLayoutCreateInfo es) where
  peekCStruct :: Ptr (DescriptorSetLayoutCreateInfo es)
-> IO (DescriptorSetLayoutCreateInfo es)
peekCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    DescriptorSetLayoutCreateFlags
flags <- Ptr DescriptorSetLayoutCreateFlags
-> IO DescriptorSetLayoutCreateFlags
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSetLayoutCreateFlags ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr DescriptorSetLayoutCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSetLayoutCreateFlags))
    "descriptorSetCount" ::: Word32
bindingCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
    Ptr DescriptorSetLayoutBinding
pBindings <- Ptr (Ptr DescriptorSetLayoutBinding)
-> IO (Ptr DescriptorSetLayoutBinding)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorSetLayoutBinding) ((Ptr (DescriptorSetLayoutCreateInfo es)
p Ptr (DescriptorSetLayoutCreateInfo es)
-> Int -> Ptr (Ptr DescriptorSetLayoutBinding)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DescriptorSetLayoutBinding)))
    Vector DescriptorSetLayoutBinding
pBindings' <- Int
-> (Int -> IO DescriptorSetLayoutBinding)
-> IO (Vector DescriptorSetLayoutBinding)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
bindingCount) (\Int
i -> Ptr DescriptorSetLayoutBinding -> IO DescriptorSetLayoutBinding
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DescriptorSetLayoutBinding ((Ptr DescriptorSetLayoutBinding
pBindings Ptr DescriptorSetLayoutBinding
-> Int -> Ptr DescriptorSetLayoutBinding
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
24 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSetLayoutBinding)))
    DescriptorSetLayoutCreateInfo es
-> IO (DescriptorSetLayoutCreateInfo es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorSetLayoutCreateInfo es
 -> IO (DescriptorSetLayoutCreateInfo es))
-> DescriptorSetLayoutCreateInfo es
-> IO (DescriptorSetLayoutCreateInfo es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> DescriptorSetLayoutCreateFlags
-> Vector DescriptorSetLayoutBinding
-> DescriptorSetLayoutCreateInfo es
forall (es :: [*]).
Chain es
-> DescriptorSetLayoutCreateFlags
-> Vector DescriptorSetLayoutBinding
-> DescriptorSetLayoutCreateInfo es
DescriptorSetLayoutCreateInfo
             Chain es
next DescriptorSetLayoutCreateFlags
flags Vector DescriptorSetLayoutBinding
pBindings'

instance es ~ '[] => Zero (DescriptorSetLayoutCreateInfo es) where
  zero :: DescriptorSetLayoutCreateInfo es
zero = Chain es
-> DescriptorSetLayoutCreateFlags
-> Vector DescriptorSetLayoutBinding
-> DescriptorSetLayoutCreateInfo es
forall (es :: [*]).
Chain es
-> DescriptorSetLayoutCreateFlags
-> Vector DescriptorSetLayoutBinding
-> DescriptorSetLayoutCreateInfo es
DescriptorSetLayoutCreateInfo
           ()
           DescriptorSetLayoutCreateFlags
forall a. Zero a => a
zero
           Vector DescriptorSetLayoutBinding
forall a. Monoid a => a
mempty


-- | VkDescriptorPoolSize - Structure specifying descriptor pool size
--
-- = Description
--
-- Note
--
-- When creating a descriptor pool that will contain descriptors for
-- combined image samplers of multi-planar formats, an application needs to
-- account for non-trivial descriptor consumption when choosing the
-- @descriptorCount@ value, as indicated by
-- 'Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion.SamplerYcbcrConversionImageFormatProperties'::@combinedImageSamplerDescriptorCount@.
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorPoolSize-descriptorCount-00302# @descriptorCount@
--     /must/ be greater than @0@
--
-- -   #VUID-VkDescriptorPoolSize-type-02218# If @type@ is
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
--     then @descriptorCount@ /must/ be a multiple of @4@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorPoolSize-type-parameter# @type@ /must/ be a valid
--     'Vulkan.Core10.Enums.DescriptorType.DescriptorType' value
--
-- = See Also
--
-- 'DescriptorPoolCreateInfo',
-- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType'
data DescriptorPoolSize = DescriptorPoolSize
  { -- | @type@ is the type of descriptor.
    DescriptorPoolSize -> DescriptorType
type' :: DescriptorType
  , -- | @descriptorCount@ is the number of descriptors of that type to allocate.
    -- If @type@ is
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT'
    -- then @descriptorCount@ is the number of bytes to allocate for
    -- descriptors of this type.
    DescriptorPoolSize -> "descriptorSetCount" ::: Word32
descriptorCount :: Word32
  }
  deriving (Typeable, DescriptorPoolSize -> DescriptorPoolSize -> Bool
(DescriptorPoolSize -> DescriptorPoolSize -> Bool)
-> (DescriptorPoolSize -> DescriptorPoolSize -> Bool)
-> Eq DescriptorPoolSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
$c/= :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
== :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
$c== :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorPoolSize)
#endif
deriving instance Show DescriptorPoolSize

instance ToCStruct DescriptorPoolSize where
  withCStruct :: DescriptorPoolSize -> (Ptr DescriptorPoolSize -> IO b) -> IO b
withCStruct DescriptorPoolSize
x Ptr DescriptorPoolSize -> IO b
f = Int -> (Ptr DescriptorPoolSize -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
8 ((Ptr DescriptorPoolSize -> IO b) -> IO b)
-> (Ptr DescriptorPoolSize -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr DescriptorPoolSize
p -> Ptr DescriptorPoolSize -> DescriptorPoolSize -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorPoolSize
p DescriptorPoolSize
x (Ptr DescriptorPoolSize -> IO b
f Ptr DescriptorPoolSize
p)
  pokeCStruct :: Ptr DescriptorPoolSize -> DescriptorPoolSize -> IO b -> IO b
pokeCStruct Ptr DescriptorPoolSize
p DescriptorPoolSize{"descriptorSetCount" ::: Word32
DescriptorType
descriptorCount :: "descriptorSetCount" ::: Word32
type' :: DescriptorType
$sel:descriptorCount:DescriptorPoolSize :: DescriptorPoolSize -> "descriptorSetCount" ::: Word32
$sel:type':DescriptorPoolSize :: DescriptorPoolSize -> DescriptorType
..} IO b
f = do
    Ptr DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DescriptorType)) (DescriptorType
type')
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
descriptorCount)
    IO b
f
  cStructSize :: Int
cStructSize = Int
8
  cStructAlignment :: Int
cStructAlignment = Int
4
  pokeZeroCStruct :: Ptr DescriptorPoolSize -> IO b -> IO b
pokeZeroCStruct Ptr DescriptorPoolSize
p IO b
f = do
    Ptr DescriptorType -> DescriptorType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DescriptorType)) (DescriptorType
forall a. Zero a => a
zero)
    Ptr ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DescriptorPoolSize where
  peekCStruct :: Ptr DescriptorPoolSize -> IO DescriptorPoolSize
peekCStruct Ptr DescriptorPoolSize
p = do
    DescriptorType
type' <- Ptr DescriptorType -> IO DescriptorType
forall a. Storable a => Ptr a -> IO a
peek @DescriptorType ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize -> Int -> Ptr DescriptorType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr DescriptorType))
    "descriptorSetCount" ::: Word32
descriptorCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32))
    DescriptorPoolSize -> IO DescriptorPoolSize
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorPoolSize -> IO DescriptorPoolSize)
-> DescriptorPoolSize -> IO DescriptorPoolSize
forall a b. (a -> b) -> a -> b
$ DescriptorType
-> ("descriptorSetCount" ::: Word32) -> DescriptorPoolSize
DescriptorPoolSize
             DescriptorType
type' "descriptorSetCount" ::: Word32
descriptorCount

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

instance Zero DescriptorPoolSize where
  zero :: DescriptorPoolSize
zero = DescriptorType
-> ("descriptorSetCount" ::: Word32) -> DescriptorPoolSize
DescriptorPoolSize
           DescriptorType
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero


-- | VkDescriptorPoolCreateInfo - Structure specifying parameters of a newly
-- created descriptor pool
--
-- = Description
--
-- If multiple 'DescriptorPoolSize' structures containing the same
-- descriptor type appear in the @pPoolSizes@ array then the pool will be
-- created with enough storage for the total number of descriptors of each
-- type.
--
-- Fragmentation of a descriptor pool is possible and /may/ lead to
-- descriptor set allocation failures. A failure due to fragmentation is
-- defined as failing a descriptor set allocation despite the sum of all
-- outstanding descriptor set allocations from the pool plus the requested
-- allocation requiring no more than the total number of descriptors
-- requested at pool creation. Implementations provide certain guarantees
-- of when fragmentation /must/ not cause allocation failure, as described
-- below.
--
-- If a descriptor pool has not had any descriptor sets freed since it was
-- created or most recently reset then fragmentation /must/ not cause an
-- allocation failure (note that this is always the case for a pool created
-- without the
-- 'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT'
-- bit set). Additionally, if all sets allocated from the pool since it was
-- created or most recently reset use the same number of descriptors (of
-- each type) and the requested allocation also uses that same number of
-- descriptors (of each type), then fragmentation /must/ not cause an
-- allocation failure.
--
-- If an allocation failure occurs due to fragmentation, an application
-- /can/ create an additional descriptor pool to perform further descriptor
-- set allocations.
--
-- If @flags@ has the
-- 'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
-- bit set, descriptor pool creation /may/ fail with the error
-- 'Vulkan.Core10.Enums.Result.ERROR_FRAGMENTATION' if the total number of
-- descriptors across all pools (including this one) created with this bit
-- set exceeds @maxUpdateAfterBindDescriptorsInAllPools@, or if
-- fragmentation of the underlying hardware resources occurs.
--
-- If a @pPoolSizes@[i]::@type@ is
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE', a
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'
-- struct in the @pNext@ chain /can/ be used to specify which mutable
-- descriptor types /can/ be allocated from the pool. If present in the
-- @pNext@ chain,
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'::@pMutableDescriptorTypeLists@[i]
-- specifies which kind of
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
-- descriptors /can/ be allocated from this pool entry. If
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'
-- does not exist in the @pNext@ chain, or
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'::@pMutableDescriptorTypeLists@[i]
-- is out of range, the descriptor pool allocates enough memory to be able
-- to allocate a
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
-- descriptor with any supported
-- 'Vulkan.Core10.Enums.DescriptorType.DescriptorType' as a mutable
-- descriptor. A mutable descriptor /can/ be allocated from a pool entry if
-- the type list in 'DescriptorSetLayoutCreateInfo' is a subset of the type
-- list declared in the descriptor pool, or if the pool entry is created
-- without a descriptor type list. Multiple @pPoolSizes@ entries with
-- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE' /can/
-- be declared. When multiple such pool entries are present in
-- @pPoolSizes@, they specify sets of supported descriptor types which
-- either fully overlap, partially overlap, or are disjoint. Two sets fully
-- overlap if the sets of supported descriptor types are equal. If the sets
-- are not disjoint they partially overlap. A pool entry without a
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeListVALVE'
-- assigned to it is considered to partially overlap any other pool entry
-- which has a
-- 'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeListVALVE'
-- assigned to it. The application /must/ ensure that partial overlap does
-- not exist in @pPoolSizes@.
--
-- Note
--
-- The requirement of no partial overlap is intended to resolve ambiguity
-- for validation as there is no confusion which @pPoolSizes@ entries will
-- be allocated from. An implementation is not expected to depend on this
-- requirement.
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorPoolCreateInfo-maxSets-00301# @maxSets@ /must/ be
--     greater than @0@
--
-- -   #VUID-VkDescriptorPoolCreateInfo-flags-04607# If @flags@ has the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE'
--     bit set, then the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     bit /must/ not be set
--
-- -   #VUID-VkDescriptorPoolCreateInfo-mutableDescriptorType-04608# If
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.PhysicalDeviceMutableDescriptorTypeFeaturesVALVE'::@mutableDescriptorType@
--     is not enabled, @pPoolSizes@ /must/ not contain a @descriptorType@
--     of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--
-- -   #VUID-VkDescriptorPoolCreateInfo-flags-04609# If @flags@ has the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE'
--     bit set,
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.PhysicalDeviceMutableDescriptorTypeFeaturesVALVE'::@mutableDescriptorType@
--     /must/ be enabled
--
-- -   #VUID-VkDescriptorPoolCreateInfo-pPoolSizes-04787# If @pPoolSizes@
--     contains a @descriptorType@ of
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE',
--     any other
--     'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_MUTABLE_VALVE'
--     element in @pPoolSizes@ /must/ not have sets of supported descriptor
--     types which partially overlap
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorPoolCreateInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO'
--
-- -   #VUID-VkDescriptorPoolCreateInfo-pNext-pNext# Each @pNext@ member of
--     any structure (including this one) in the @pNext@ chain /must/ be
--     either @NULL@ or a pointer to a valid instance of
--     'Vulkan.Extensions.VK_EXT_inline_uniform_block.DescriptorPoolInlineUniformBlockCreateInfoEXT'
--     or
--     'Vulkan.Extensions.VK_VALVE_mutable_descriptor_type.MutableDescriptorTypeCreateInfoVALVE'
--
-- -   #VUID-VkDescriptorPoolCreateInfo-sType-unique# The @sType@ value of
--     each struct in the @pNext@ chain /must/ be unique
--
-- -   #VUID-VkDescriptorPoolCreateInfo-flags-parameter# @flags@ /must/ be
--     a valid combination of
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DescriptorPoolCreateFlagBits'
--     values
--
-- -   #VUID-VkDescriptorPoolCreateInfo-pPoolSizes-parameter# @pPoolSizes@
--     /must/ be a valid pointer to an array of @poolSizeCount@ valid
--     'DescriptorPoolSize' structures
--
-- -   #VUID-VkDescriptorPoolCreateInfo-poolSizeCount-arraylength#
--     @poolSizeCount@ /must/ be greater than @0@
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DescriptorPoolCreateFlags',
-- 'DescriptorPoolSize', 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createDescriptorPool'
data DescriptorPoolCreateInfo (es :: [Type]) = DescriptorPoolCreateInfo
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    DescriptorPoolCreateInfo es -> Chain es
next :: Chain es
  , -- | @flags@ is a bitmask of
    -- 'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DescriptorPoolCreateFlagBits'
    -- specifying certain supported operations on the pool.
    DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
flags :: DescriptorPoolCreateFlags
  , -- | @maxSets@ is the maximum number of descriptor sets that /can/ be
    -- allocated from the pool.
    DescriptorPoolCreateInfo es -> "descriptorSetCount" ::: Word32
maxSets :: Word32
  , -- | @pPoolSizes@ is a pointer to an array of 'DescriptorPoolSize'
    -- structures, each containing a descriptor type and number of descriptors
    -- of that type to be allocated in the pool.
    DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
poolSizes :: Vector DescriptorPoolSize
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorPoolCreateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (DescriptorPoolCreateInfo es)

instance Extensible DescriptorPoolCreateInfo where
  extensibleTypeName :: String
extensibleTypeName = String
"DescriptorPoolCreateInfo"
  setNext :: DescriptorPoolCreateInfo ds
-> Chain es -> DescriptorPoolCreateInfo es
setNext DescriptorPoolCreateInfo ds
x Chain es
next = DescriptorPoolCreateInfo ds
x{$sel:next:DescriptorPoolCreateInfo :: Chain es
next = Chain es
next}
  getNext :: DescriptorPoolCreateInfo es -> Chain es
getNext DescriptorPoolCreateInfo{"descriptorSetCount" ::: Word32
Vector DescriptorPoolSize
Chain es
DescriptorPoolCreateFlags
poolSizes :: Vector DescriptorPoolSize
maxSets :: "descriptorSetCount" ::: Word32
flags :: DescriptorPoolCreateFlags
next :: Chain es
$sel:poolSizes:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
$sel:maxSets:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> "descriptorSetCount" ::: Word32
$sel:flags:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
$sel:next:DescriptorPoolCreateInfo :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorPoolCreateInfo e => b) -> Maybe b
  extends :: proxy e -> (Extends DescriptorPoolCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorPoolCreateInfo e => b
f
    | Just e :~: MutableDescriptorTypeCreateInfoVALVE
Refl <- (Typeable e, Typeable MutableDescriptorTypeCreateInfoVALVE) =>
Maybe (e :~: MutableDescriptorTypeCreateInfoVALVE)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @MutableDescriptorTypeCreateInfoVALVE = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorPoolCreateInfo e => b
f
    | Just e :~: DescriptorPoolInlineUniformBlockCreateInfoEXT
Refl <- (Typeable e,
 Typeable DescriptorPoolInlineUniformBlockCreateInfoEXT) =>
Maybe (e :~: DescriptorPoolInlineUniformBlockCreateInfoEXT)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @DescriptorPoolInlineUniformBlockCreateInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorPoolCreateInfo e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss DescriptorPoolCreateInfo es, PokeChain es) => ToCStruct (DescriptorPoolCreateInfo es) where
  withCStruct :: DescriptorPoolCreateInfo es
-> (Ptr (DescriptorPoolCreateInfo es) -> IO b) -> IO b
withCStruct DescriptorPoolCreateInfo es
x Ptr (DescriptorPoolCreateInfo es) -> IO b
f = Int -> (Ptr (DescriptorPoolCreateInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((Ptr (DescriptorPoolCreateInfo es) -> IO b) -> IO b)
-> (Ptr (DescriptorPoolCreateInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (DescriptorPoolCreateInfo es)
p -> Ptr (DescriptorPoolCreateInfo es)
-> DescriptorPoolCreateInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (DescriptorPoolCreateInfo es)
p DescriptorPoolCreateInfo es
x (Ptr (DescriptorPoolCreateInfo es) -> IO b
f Ptr (DescriptorPoolCreateInfo es)
p)
  pokeCStruct :: Ptr (DescriptorPoolCreateInfo es)
-> DescriptorPoolCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorPoolCreateInfo es)
p DescriptorPoolCreateInfo{"descriptorSetCount" ::: Word32
Vector DescriptorPoolSize
Chain es
DescriptorPoolCreateFlags
poolSizes :: Vector DescriptorPoolSize
maxSets :: "descriptorSetCount" ::: Word32
flags :: DescriptorPoolCreateFlags
next :: Chain es
$sel:poolSizes:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
$sel:maxSets:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> "descriptorSetCount" ::: Word32
$sel:flags:DescriptorPoolCreateInfo :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
$sel:next:DescriptorPoolCreateInfo :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
..} 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 ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    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 DescriptorPoolCreateFlags -> DescriptorPoolCreateFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr DescriptorPoolCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorPoolCreateFlags)) (DescriptorPoolCreateFlags
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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) ("descriptorSetCount" ::: Word32
maxSets)
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector DescriptorPoolSize -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorPoolSize -> Int)
-> Vector DescriptorPoolSize -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorPoolSize
poolSizes)) :: Word32))
    Ptr DescriptorPoolSize
pPPoolSizes' <- ((Ptr DescriptorPoolSize -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorPoolSize)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorPoolSize -> IO b) -> IO b)
 -> ContT b IO (Ptr DescriptorPoolSize))
-> ((Ptr DescriptorPoolSize -> IO b) -> IO b)
-> ContT b IO (Ptr DescriptorPoolSize)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr DescriptorPoolSize -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorPoolSize ((Vector DescriptorPoolSize -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorPoolSize
poolSizes)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)
    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
$ (Int -> DescriptorPoolSize -> IO ())
-> Vector DescriptorPoolSize -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorPoolSize
e -> Ptr DescriptorPoolSize -> DescriptorPoolSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DescriptorPoolSize
pPPoolSizes' Ptr DescriptorPoolSize -> Int -> Ptr DescriptorPoolSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorPoolSize) (DescriptorPoolSize
e)) (Vector DescriptorPoolSize
poolSizes)
    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 DescriptorPoolSize) -> Ptr DescriptorPoolSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr (Ptr DescriptorPoolSize)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr DescriptorPoolSize))) (Ptr DescriptorPoolSize
pPPoolSizes')
    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 = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr (DescriptorPoolCreateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (DescriptorPoolCreateInfo es)
p 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 ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) ("descriptorSetCount" ::: 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 (Extendss DescriptorPoolCreateInfo es, PeekChain es) => FromCStruct (DescriptorPoolCreateInfo es) where
  peekCStruct :: Ptr (DescriptorPoolCreateInfo es)
-> IO (DescriptorPoolCreateInfo es)
peekCStruct Ptr (DescriptorPoolCreateInfo es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    DescriptorPoolCreateFlags
flags <- Ptr DescriptorPoolCreateFlags -> IO DescriptorPoolCreateFlags
forall a. Storable a => Ptr a -> IO a
peek @DescriptorPoolCreateFlags ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr DescriptorPoolCreateFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorPoolCreateFlags))
    "descriptorSetCount" ::: Word32
maxSets <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
    "descriptorSetCount" ::: Word32
poolSizeCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    Ptr DescriptorPoolSize
pPoolSizes <- Ptr (Ptr DescriptorPoolSize) -> IO (Ptr DescriptorPoolSize)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorPoolSize) ((Ptr (DescriptorPoolCreateInfo es)
p Ptr (DescriptorPoolCreateInfo es)
-> Int -> Ptr (Ptr DescriptorPoolSize)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr DescriptorPoolSize)))
    Vector DescriptorPoolSize
pPoolSizes' <- Int
-> (Int -> IO DescriptorPoolSize) -> IO (Vector DescriptorPoolSize)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
poolSizeCount) (\Int
i -> Ptr DescriptorPoolSize -> IO DescriptorPoolSize
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @DescriptorPoolSize ((Ptr DescriptorPoolSize
pPoolSizes Ptr DescriptorPoolSize -> Int -> Ptr DescriptorPoolSize
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorPoolSize)))
    DescriptorPoolCreateInfo es -> IO (DescriptorPoolCreateInfo es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorPoolCreateInfo es -> IO (DescriptorPoolCreateInfo es))
-> DescriptorPoolCreateInfo es -> IO (DescriptorPoolCreateInfo es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> DescriptorPoolCreateFlags
-> ("descriptorSetCount" ::: Word32)
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
forall (es :: [*]).
Chain es
-> DescriptorPoolCreateFlags
-> ("descriptorSetCount" ::: Word32)
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
DescriptorPoolCreateInfo
             Chain es
next DescriptorPoolCreateFlags
flags "descriptorSetCount" ::: Word32
maxSets Vector DescriptorPoolSize
pPoolSizes'

instance es ~ '[] => Zero (DescriptorPoolCreateInfo es) where
  zero :: DescriptorPoolCreateInfo es
zero = Chain es
-> DescriptorPoolCreateFlags
-> ("descriptorSetCount" ::: Word32)
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
forall (es :: [*]).
Chain es
-> DescriptorPoolCreateFlags
-> ("descriptorSetCount" ::: Word32)
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
DescriptorPoolCreateInfo
           ()
           DescriptorPoolCreateFlags
forall a. Zero a => a
zero
           "descriptorSetCount" ::: Word32
forall a. Zero a => a
zero
           Vector DescriptorPoolSize
forall a. Monoid a => a
mempty


-- | VkDescriptorSetAllocateInfo - Structure specifying the allocation
-- parameters for descriptor sets
--
-- == Valid Usage
--
-- -   #VUID-VkDescriptorSetAllocateInfo-pSetLayouts-00308# Each element of
--     @pSetLayouts@ /must/ not have been created with
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR'
--     set
--
-- -   #VUID-VkDescriptorSetAllocateInfo-pSetLayouts-03044# If any element
--     of @pSetLayouts@ was created with the
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT'
--     bit set, @descriptorPool@ /must/ have been created with the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT'
--     flag set
--
-- -   #VUID-VkDescriptorSetAllocateInfo-pSetLayouts-04610# If any element
--     of @pSetLayouts@ was created with the
--     'Vulkan.Core10.Enums.DescriptorSetLayoutCreateFlagBits.DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE'
--     bit set, @descriptorPool@ /must/ have been created with the
--     'Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits.DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE'
--     flag set
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkDescriptorSetAllocateInfo-sType-sType# @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO'
--
-- -   #VUID-VkDescriptorSetAllocateInfo-pNext-pNext# @pNext@ /must/ be
--     @NULL@ or a pointer to a valid instance of
--     'Vulkan.Core12.Promoted_From_VK_EXT_descriptor_indexing.DescriptorSetVariableDescriptorCountAllocateInfo'
--
-- -   #VUID-VkDescriptorSetAllocateInfo-sType-unique# The @sType@ value of
--     each struct in the @pNext@ chain /must/ be unique
--
-- -   #VUID-VkDescriptorSetAllocateInfo-descriptorPool-parameter#
--     @descriptorPool@ /must/ be a valid
--     'Vulkan.Core10.Handles.DescriptorPool' handle
--
-- -   #VUID-VkDescriptorSetAllocateInfo-pSetLayouts-parameter#
--     @pSetLayouts@ /must/ be a valid pointer to an array of
--     @descriptorSetCount@ valid
--     'Vulkan.Core10.Handles.DescriptorSetLayout' handles
--
-- -   #VUID-VkDescriptorSetAllocateInfo-descriptorSetCount-arraylength#
--     @descriptorSetCount@ /must/ be greater than @0@
--
-- -   #VUID-VkDescriptorSetAllocateInfo-commonparent# Both of
--     @descriptorPool@, and the elements of @pSetLayouts@ /must/ have been
--     created, allocated, or retrieved from the same
--     'Vulkan.Core10.Handles.Device'
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.DescriptorPool',
-- 'Vulkan.Core10.Handles.DescriptorSetLayout',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'allocateDescriptorSets'
data DescriptorSetAllocateInfo (es :: [Type]) = DescriptorSetAllocateInfo
  { -- | @pNext@ is @NULL@ or a pointer to a structure extending this structure.
    DescriptorSetAllocateInfo es -> Chain es
next :: Chain es
  , -- | @descriptorPool@ is the pool which the sets will be allocated from.
    DescriptorSetAllocateInfo es -> DescriptorPool
descriptorPool :: DescriptorPool
  , -- | @pSetLayouts@ is a pointer to an array of descriptor set layouts, with
    -- each member specifying how the corresponding descriptor set is
    -- allocated.
    DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
setLayouts :: Vector DescriptorSetLayout
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorSetAllocateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (DescriptorSetAllocateInfo es)

instance Extensible DescriptorSetAllocateInfo where
  extensibleTypeName :: String
extensibleTypeName = String
"DescriptorSetAllocateInfo"
  setNext :: DescriptorSetAllocateInfo ds
-> Chain es -> DescriptorSetAllocateInfo es
setNext DescriptorSetAllocateInfo ds
x Chain es
next = DescriptorSetAllocateInfo ds
x{$sel:next:DescriptorSetAllocateInfo :: Chain es
next = Chain es
next}
  getNext :: DescriptorSetAllocateInfo es -> Chain es
getNext DescriptorSetAllocateInfo{Vector DescriptorSetLayout
Chain es
DescriptorPool
setLayouts :: Vector DescriptorSetLayout
descriptorPool :: DescriptorPool
next :: Chain es
$sel:next:DescriptorSetAllocateInfo :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
$sel:descriptorPool:DescriptorSetAllocateInfo :: forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
$sel:setLayouts:DescriptorSetAllocateInfo :: forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
..} = Chain es
next
  extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorSetAllocateInfo e => b) -> Maybe b
  extends :: proxy e -> (Extends DescriptorSetAllocateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorSetAllocateInfo e => b
f
    | Just e :~: DescriptorSetVariableDescriptorCountAllocateInfo
Refl <- (Typeable e,
 Typeable DescriptorSetVariableDescriptorCountAllocateInfo) =>
Maybe (e :~: DescriptorSetVariableDescriptorCountAllocateInfo)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @DescriptorSetVariableDescriptorCountAllocateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorSetAllocateInfo e => b
f
    | Bool
otherwise = Maybe b
forall a. Maybe a
Nothing

instance (Extendss DescriptorSetAllocateInfo es, PokeChain es) => ToCStruct (DescriptorSetAllocateInfo es) where
  withCStruct :: DescriptorSetAllocateInfo es
-> (Ptr (DescriptorSetAllocateInfo es) -> IO b) -> IO b
withCStruct DescriptorSetAllocateInfo es
x Ptr (DescriptorSetAllocateInfo es) -> IO b
f = Int -> (Ptr (DescriptorSetAllocateInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 ((Ptr (DescriptorSetAllocateInfo es) -> IO b) -> IO b)
-> (Ptr (DescriptorSetAllocateInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (DescriptorSetAllocateInfo es)
p -> Ptr (DescriptorSetAllocateInfo es)
-> DescriptorSetAllocateInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetAllocateInfo es)
p DescriptorSetAllocateInfo es
x (Ptr (DescriptorSetAllocateInfo es) -> IO b
f Ptr (DescriptorSetAllocateInfo es)
p)
  pokeCStruct :: Ptr (DescriptorSetAllocateInfo es)
-> DescriptorSetAllocateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetAllocateInfo es)
p DescriptorSetAllocateInfo{Vector DescriptorSetLayout
Chain es
DescriptorPool
setLayouts :: Vector DescriptorSetLayout
descriptorPool :: DescriptorPool
next :: Chain es
$sel:next:DescriptorSetAllocateInfo :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
$sel:descriptorPool:DescriptorSetAllocateInfo :: forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
$sel:setLayouts:DescriptorSetAllocateInfo :: forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
..} 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 ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO)
    Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
    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
$ ("pDescriptorPool" ::: Ptr DescriptorPool)
-> DescriptorPool -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> "pDescriptorPool" ::: Ptr DescriptorPool
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorPool)) (DescriptorPool
descriptorPool)
    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 ("descriptorSetCount" ::: Word32)
-> ("descriptorSetCount" ::: Word32) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ((Int -> "descriptorSetCount" ::: Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector DescriptorSetLayout -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayout -> Int)
-> Vector DescriptorSetLayout -> Int
forall a b. (a -> b) -> a -> b
$ (Vector DescriptorSetLayout
setLayouts)) :: Word32))
    "pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayouts' <- ((("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO b) -> IO b)
-> ContT b IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO b) -> IO b)
 -> ContT b IO ("pSetLayout" ::: Ptr DescriptorSetLayout))
-> ((("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO b) -> IO b)
-> ContT b IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a b. (a -> b) -> a -> b
$ Int -> (("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @DescriptorSetLayout ((Vector DescriptorSetLayout -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector DescriptorSetLayout
setLayouts)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8)
    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
$ (Int -> DescriptorSetLayout -> IO ())
-> Vector DescriptorSetLayout -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i DescriptorSetLayout
e -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> DescriptorSetLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ("pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayouts' ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> Int -> "pSetLayout" ::: Ptr DescriptorSetLayout
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSetLayout) (DescriptorSetLayout
e)) (Vector DescriptorSetLayout
setLayouts)
    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 ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> ("pSetLayout" ::: Ptr DescriptorSetLayout) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> Ptr ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr DescriptorSetLayout))) ("pSetLayout" ::: Ptr DescriptorSetLayout
pPSetLayouts')
    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 = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: Ptr (DescriptorSetAllocateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (DescriptorSetAllocateInfo es)
p 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 ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO)
    Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
    -> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
    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 ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
    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
$ ("pDescriptorPool" ::: Ptr DescriptorPool)
-> DescriptorPool -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> "pDescriptorPool" ::: Ptr DescriptorPool
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorPool)) (DescriptorPool
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 (Extendss DescriptorSetAllocateInfo es, PeekChain es) => FromCStruct (DescriptorSetAllocateInfo es) where
  peekCStruct :: Ptr (DescriptorSetAllocateInfo es)
-> IO (DescriptorSetAllocateInfo es)
peekCStruct Ptr (DescriptorSetAllocateInfo es)
p = do
    Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
    Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
    DescriptorPool
descriptorPool <- ("pDescriptorPool" ::: Ptr DescriptorPool) -> IO DescriptorPool
forall a. Storable a => Ptr a -> IO a
peek @DescriptorPool ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> "pDescriptorPool" ::: Ptr DescriptorPool
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorPool))
    "descriptorSetCount" ::: Word32
descriptorSetCount <- Ptr ("descriptorSetCount" ::: Word32)
-> IO ("descriptorSetCount" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> Ptr ("descriptorSetCount" ::: Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    "pSetLayout" ::: Ptr DescriptorSetLayout
pSetLayouts <- Ptr ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr DescriptorSetLayout) ((Ptr (DescriptorSetAllocateInfo es)
p Ptr (DescriptorSetAllocateInfo es)
-> Int -> Ptr ("pSetLayout" ::: Ptr DescriptorSetLayout)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr DescriptorSetLayout)))
    Vector DescriptorSetLayout
pSetLayouts' <- Int
-> (Int -> IO DescriptorSetLayout)
-> IO (Vector DescriptorSetLayout)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("descriptorSetCount" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral "descriptorSetCount" ::: Word32
descriptorSetCount) (\Int
i -> ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a. Storable a => Ptr a -> IO a
peek @DescriptorSetLayout (("pSetLayout" ::: Ptr DescriptorSetLayout
pSetLayouts ("pSetLayout" ::: Ptr DescriptorSetLayout)
-> Int -> "pSetLayout" ::: Ptr DescriptorSetLayout
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr DescriptorSetLayout)))
    DescriptorSetAllocateInfo es -> IO (DescriptorSetAllocateInfo es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DescriptorSetAllocateInfo es -> IO (DescriptorSetAllocateInfo es))
-> DescriptorSetAllocateInfo es
-> IO (DescriptorSetAllocateInfo es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> DescriptorPool
-> Vector DescriptorSetLayout
-> DescriptorSetAllocateInfo es
forall (es :: [*]).
Chain es
-> DescriptorPool
-> Vector DescriptorSetLayout
-> DescriptorSetAllocateInfo es
DescriptorSetAllocateInfo
             Chain es
next DescriptorPool
descriptorPool Vector DescriptorSetLayout
pSetLayouts'

instance es ~ '[] => Zero (DescriptorSetAllocateInfo es) where
  zero :: DescriptorSetAllocateInfo es
zero = Chain es
-> DescriptorPool
-> Vector DescriptorSetLayout
-> DescriptorSetAllocateInfo es
forall (es :: [*]).
Chain es
-> DescriptorPool
-> Vector DescriptorSetLayout
-> DescriptorSetAllocateInfo es
DescriptorSetAllocateInfo
           ()
           DescriptorPool
forall a. Zero a => a
zero
           Vector DescriptorSetLayout
forall a. Monoid a => a
mempty