{-# language CPP #-}
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 {-# SOURCE #-} Vulkan.Extensions.VK_ARM_data_graph (DataGraphProcessingEngineCreateInfoARM)
import Vulkan.Core10.Handles (DescriptorPool)
import Vulkan.Core10.Handles (DescriptorPool(..))
import Vulkan.Core10.Enums.DescriptorPoolCreateFlagBits (DescriptorPoolCreateFlags)
import {-# SOURCE #-} Vulkan.Core13.Promoted_From_VK_EXT_inline_uniform_block (DescriptorPoolInlineUniformBlockCreateInfo)
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.Core10.Handles (Device(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_EXT_mutable_descriptor_type (MutableDescriptorTypeCreateInfoEXT)
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.Core13.Promoted_From_VK_EXT_inline_uniform_block (WriteDescriptorSetInlineUniformBlock)
import {-# SOURCE #-} Vulkan.Extensions.VK_ARM_tensors (WriteDescriptorSetTensorARM)
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
createDescriptorSetLayout :: forall a io
. ( Extendss DescriptorSetLayoutCreateInfo a
, PokeChain a
, MonadIO io )
=>
Device
->
(DescriptorSetLayoutCreateInfo a)
->
("allocator" ::: Maybe AllocationCallbacks)
-> io (DescriptorSetLayout)
createDescriptorSetLayout :: forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorSetLayoutCreateInfo a, PokeChain a,
MonadIO io) =>
Device
-> DescriptorSetLayoutCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorSetLayout
createDescriptorSetLayout Device
device DescriptorSetLayoutCreateInfo a
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = IO DescriptorSetLayout -> io DescriptorSetLayout
forall a. IO a -> io a
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
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
vkCreateDescriptorSetLayoutPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
pVkCreateDescriptorSetLayout (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT DescriptorSetLayout IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT DescriptorSetLayout m a
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
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
vkCreateDescriptorSetLayoutPtr FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> 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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateDescriptorSetLayout is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkCreateDescriptorSetLayout' :: Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result
vkCreateDescriptorSetLayout' = 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
mkVkCreateDescriptorSetLayout FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetLayoutCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorSetLayout
-> IO Result)
vkCreateDescriptorSetLayoutPtr
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
forall b.
DescriptorSetLayoutCreateInfo a
-> (Ptr (DescriptorSetLayoutCreateInfo a) -> IO b) -> IO b
withCStruct (DescriptorSetLayoutCreateInfo a
createInfo)
pAllocator <- case (allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks
-> ContT DescriptorSetLayout IO (Ptr AllocationCallbacks)
forall a. a -> ContT DescriptorSetLayout IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout)
-> ContT DescriptorSetLayout IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout)
-> ContT DescriptorSetLayout IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout)
-> ContT DescriptorSetLayout IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (Ptr AllocationCallbacks -> IO DescriptorSetLayout)
-> IO DescriptorSetLayout
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
pPSetLayout <- ContT $ bracket (callocBytes @DescriptorSetLayout 8) free
r <- lift $ traceAroundEvent "vkCreateDescriptorSetLayout" (vkCreateDescriptorSetLayout'
(deviceHandle (device))
(forgetExtensions pCreateInfo)
pAllocator
(pPSetLayout))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
pSetLayout <- lift $ peek @DescriptorSetLayout pPSetLayout
pure $ (pSetLayout)
withDescriptorSetLayout :: forall a io r . (Extendss DescriptorSetLayoutCreateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorSetLayoutCreateInfo a -> Maybe AllocationCallbacks -> (io DescriptorSetLayout -> (DescriptorSetLayout -> io ()) -> r) -> r
withDescriptorSetLayout :: forall (a :: [*]) (io :: * -> *) r.
(Extendss DescriptorSetLayoutCreateInfo a, PokeChain a,
MonadIO io) =>
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 ()
destroyDescriptorSetLayout :: forall io
. (MonadIO io)
=>
Device
->
DescriptorSetLayout
->
("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorSetLayout :: forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorSetLayout
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorSetLayout Device
device
DescriptorSetLayout
descriptorSetLayout
"allocator" ::: Maybe AllocationCallbacks
allocator = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkDestroyDescriptorSetLayoutPtr :: FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorSetLayoutPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
pVkDestroyDescriptorSetLayout (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorSetLayoutPtr FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
-> FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkDestroyDescriptorSetLayout is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkDestroyDescriptorSetLayout' :: Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ()
vkDestroyDescriptorSetLayout' = FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
-> Ptr Device_T
-> DescriptorSetLayout
-> Ptr AllocationCallbacks
-> IO ()
mkVkDestroyDescriptorSetLayout FunPtr
(Ptr Device_T
-> DescriptorSetLayout -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorSetLayoutPtr
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks -> ContT () IO (Ptr AllocationCallbacks)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks -> (Ptr AllocationCallbacks -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
lift $ traceAroundEvent "vkDestroyDescriptorSetLayout" (vkDestroyDescriptorSetLayout'
(deviceHandle (device))
(descriptorSetLayout)
pAllocator)
pure $ ()
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
createDescriptorPool :: forall a io
. ( Extendss DescriptorPoolCreateInfo a
, PokeChain a
, MonadIO io )
=>
Device
->
(DescriptorPoolCreateInfo a)
->
("allocator" ::: Maybe AllocationCallbacks)
-> io (DescriptorPool)
createDescriptorPool :: forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io) =>
Device
-> DescriptorPoolCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io DescriptorPool
createDescriptorPool Device
device DescriptorPoolCreateInfo a
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = IO DescriptorPool -> io DescriptorPool
forall a. IO a -> io a
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
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
vkCreateDescriptorPoolPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
pVkCreateDescriptorPool (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT DescriptorPool IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT DescriptorPool m a
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
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
vkCreateDescriptorPoolPtr FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> 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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateDescriptorPool is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkCreateDescriptorPool' :: Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result
vkCreateDescriptorPool' = 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
mkVkCreateDescriptorPool FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorPoolCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr DescriptorPool
-> IO Result)
vkCreateDescriptorPoolPtr
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
forall b.
DescriptorPoolCreateInfo a
-> (Ptr (DescriptorPoolCreateInfo a) -> IO b) -> IO b
withCStruct (DescriptorPoolCreateInfo a
createInfo)
pAllocator <- case (allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks
-> ContT DescriptorPool IO (Ptr AllocationCallbacks)
forall a. a -> ContT DescriptorPool IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO DescriptorPool)
-> IO DescriptorPool)
-> ContT DescriptorPool IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO DescriptorPool)
-> IO DescriptorPool)
-> ContT DescriptorPool IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO DescriptorPool)
-> IO DescriptorPool)
-> ContT DescriptorPool IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (Ptr AllocationCallbacks -> IO DescriptorPool)
-> IO DescriptorPool
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
pPDescriptorPool <- ContT $ bracket (callocBytes @DescriptorPool 8) free
r <- lift $ traceAroundEvent "vkCreateDescriptorPool" (vkCreateDescriptorPool'
(deviceHandle (device))
(forgetExtensions pCreateInfo)
pAllocator
(pPDescriptorPool))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
pDescriptorPool <- lift $ peek @DescriptorPool pPDescriptorPool
pure $ (pDescriptorPool)
withDescriptorPool :: forall a io r . (Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorPoolCreateInfo a -> Maybe AllocationCallbacks -> (io DescriptorPool -> (DescriptorPool -> io ()) -> r) -> r
withDescriptorPool :: forall (a :: [*]) (io :: * -> *) r.
(Extendss DescriptorPoolCreateInfo a, PokeChain a, MonadIO io) =>
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 ()
destroyDescriptorPool :: forall io
. (MonadIO io)
=>
Device
->
DescriptorPool
->
("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorPool :: forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorPool
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyDescriptorPool Device
device DescriptorPool
descriptorPool "allocator" ::: Maybe AllocationCallbacks
allocator = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkDestroyDescriptorPoolPtr :: FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorPoolPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
pVkDestroyDescriptorPool (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorPoolPtr FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
-> FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkDestroyDescriptorPool is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkDestroyDescriptorPool' :: Ptr Device_T -> DescriptorPool -> Ptr AllocationCallbacks -> IO ()
vkDestroyDescriptorPool' = FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
-> Ptr Device_T
-> DescriptorPool
-> Ptr AllocationCallbacks
-> IO ()
mkVkDestroyDescriptorPool FunPtr
(Ptr Device_T
-> DescriptorPool -> Ptr AllocationCallbacks -> IO ())
vkDestroyDescriptorPoolPtr
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks -> ContT () IO (Ptr AllocationCallbacks)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks -> (Ptr AllocationCallbacks -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
lift $ traceAroundEvent "vkDestroyDescriptorPool" (vkDestroyDescriptorPool'
(deviceHandle (device))
(descriptorPool)
pAllocator)
pure $ ()
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
resetDescriptorPool :: forall io
. (MonadIO io)
=>
Device
->
DescriptorPool
->
DescriptorPoolResetFlags
-> io ()
resetDescriptorPool :: forall (io :: * -> *).
MonadIO io =>
Device -> DescriptorPool -> DescriptorPoolResetFlags -> io ()
resetDescriptorPool Device
device DescriptorPool
descriptorPool DescriptorPoolResetFlags
flags = IO () -> io ()
forall a. IO a -> io a
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 (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for 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
r <- 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))
when (r < SUCCESS) (throwIO (VulkanException r))
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
allocateDescriptorSets :: forall a io
. ( Extendss DescriptorSetAllocateInfo a
, PokeChain a
, MonadIO io )
=>
Device
->
(DescriptorSetAllocateInfo a)
-> io (("descriptorSets" ::: Vector DescriptorSet))
allocateDescriptorSets :: forall (a :: [*]) (io :: * -> *).
(Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io) =>
Device
-> DescriptorSetAllocateInfo a
-> io ("descriptorSets" ::: Vector DescriptorSet)
allocateDescriptorSets Device
device DescriptorSetAllocateInfo a
allocateInfo = IO ("descriptorSets" ::: Vector DescriptorSet)
-> io ("descriptorSets" ::: Vector DescriptorSet)
forall a. IO a -> io a
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
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
vkAllocateDescriptorSetsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
pVkAllocateDescriptorSets (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT ("descriptorSets" ::: Vector DescriptorSet) IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT ("descriptorSets" ::: Vector DescriptorSet) m a
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
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
vkAllocateDescriptorSetsPtr FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> 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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkAllocateDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkAllocateDescriptorSets' :: Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result
vkAllocateDescriptorSets' = FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
-> Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result
mkVkAllocateDescriptorSets FunPtr
(Ptr Device_T
-> Ptr (SomeStruct DescriptorSetAllocateInfo)
-> Ptr DescriptorSet
-> IO Result)
vkAllocateDescriptorSetsPtr
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
forall b.
DescriptorSetAllocateInfo a
-> (Ptr (DescriptorSetAllocateInfo a) -> IO b) -> IO b
withCStruct (DescriptorSetAllocateInfo a
allocateInfo)
pPDescriptorSets <- ContT $ bracket (callocBytes @DescriptorSet ((fromIntegral . Data.Vector.length . setLayouts $ (allocateInfo)) * 8)) free
r <- lift $ traceAroundEvent "vkAllocateDescriptorSets" (vkAllocateDescriptorSets'
(deviceHandle (device))
(forgetExtensions pAllocateInfo)
(pPDescriptorSets))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
pDescriptorSets <- lift $ generateM (fromIntegral . Data.Vector.length . setLayouts $ (allocateInfo)) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet ((Ptr DescriptorSet
pPDescriptorSets Ptr DescriptorSet -> Int -> 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)))
pure $ (pDescriptorSets)
withDescriptorSets :: forall a io r . (Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io) => Device -> DescriptorSetAllocateInfo a -> (io (Vector DescriptorSet) -> (Vector DescriptorSet -> io ()) -> r) -> r
withDescriptorSets :: forall (a :: [*]) (io :: * -> *) r.
(Extendss DescriptorSetAllocateInfo a, PokeChain a, MonadIO io) =>
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
freeDescriptorSets :: forall io
. (MonadIO io)
=>
Device
->
DescriptorPool
->
("descriptorSets" ::: Vector DescriptorSet)
-> io ()
freeDescriptorSets :: forall (io :: * -> *).
MonadIO io =>
Device
-> DescriptorPool
-> ("descriptorSets" ::: Vector DescriptorSet)
-> io ()
freeDescriptorSets Device
device
DescriptorPool
descriptorPool
"descriptorSets" ::: Vector DescriptorSet
descriptorSets = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkFreeDescriptorSetsPtr :: FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
vkFreeDescriptorSetsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
pVkFreeDescriptorSets (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
vkFreeDescriptorSetsPtr FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
-> FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> 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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkFreeDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkFreeDescriptorSets' :: Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result
vkFreeDescriptorSets' = FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
-> Ptr Device_T
-> DescriptorPool
-> Word32
-> Ptr DescriptorSet
-> IO Result
mkVkFreeDescriptorSets FunPtr
(Ptr Device_T
-> DescriptorPool -> Word32 -> Ptr DescriptorSet -> IO Result)
vkFreeDescriptorSetsPtr
pPDescriptorSets <- ((Ptr DescriptorSet -> IO ()) -> IO ())
-> ContT () IO (Ptr DescriptorSet)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr DescriptorSet -> IO ()) -> IO ())
-> ContT () IO (Ptr DescriptorSet))
-> ((Ptr DescriptorSet -> IO ()) -> IO ())
-> ContT () IO (Ptr DescriptorSet)
forall a b. (a -> b) -> a -> b
$ 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)
lift $ Data.Vector.imapM_ (\Int
i DescriptorSet
e -> Ptr DescriptorSet -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DescriptorSet
pPDescriptorSets Ptr DescriptorSet -> Int -> 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)
r <- lift $ traceAroundEvent "vkFreeDescriptorSets" (vkFreeDescriptorSets'
(deviceHandle (device))
(descriptorPool)
((fromIntegral (Data.Vector.length $ (descriptorSets)) :: Word32))
(pPDescriptorSets))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
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 ()
updateDescriptorSets :: forall io
. (MonadIO io)
=>
Device
->
("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
->
("descriptorCopies" ::: Vector CopyDescriptorSet)
-> io ()
updateDescriptorSets :: forall (io :: * -> *).
MonadIO io =>
Device
-> ("descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet))
-> ("descriptorCopies" ::: Vector CopyDescriptorSet)
-> io ()
updateDescriptorSets Device
device
"descriptorWrites" ::: Vector (SomeStruct WriteDescriptorSet)
descriptorWrites
"descriptorCopies" ::: Vector CopyDescriptorSet
descriptorCopies = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkUpdateDescriptorSetsPtr :: FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
vkUpdateDescriptorSetsPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
pVkUpdateDescriptorSets (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
vkUpdateDescriptorSetsPtr FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
-> FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkUpdateDescriptorSets is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkUpdateDescriptorSets' :: Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ()
vkUpdateDescriptorSets' = FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
-> Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ()
mkVkUpdateDescriptorSets FunPtr
(Ptr Device_T
-> Word32
-> Ptr (SomeStruct WriteDescriptorSet)
-> Word32
-> Ptr CopyDescriptorSet
-> IO ())
vkUpdateDescriptorSetsPtr
pPDescriptorWrites <- ((Ptr (WriteDescriptorSet (ZonkAny 0)) -> IO ()) -> IO ())
-> ContT () IO (Ptr (WriteDescriptorSet (ZonkAny 0)))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (WriteDescriptorSet (ZonkAny 0)) -> IO ()) -> IO ())
-> ContT () IO (Ptr (WriteDescriptorSet (ZonkAny 0))))
-> ((Ptr (WriteDescriptorSet (ZonkAny 0)) -> IO ()) -> IO ())
-> ContT () IO (Ptr (WriteDescriptorSet (ZonkAny 0)))
forall a b. (a -> b) -> a -> b
$ 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)
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
$ 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 (ZonkAny 1))
-> Ptr (SomeStruct WriteDescriptorSet)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (WriteDescriptorSet (ZonkAny 0))
pPDescriptorWrites Ptr (WriteDescriptorSet (ZonkAny 0))
-> Int -> Ptr (WriteDescriptorSet w)
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)
pPDescriptorCopies <- ContT $ allocaBytes @CopyDescriptorSet ((Data.Vector.length (descriptorCopies)) * 56)
lift $ Data.Vector.imapM_ (\Int
i CopyDescriptorSet
e -> Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CopyDescriptorSet
pPDescriptorCopies Ptr CopyDescriptorSet -> Int -> 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)
lift $ traceAroundEvent "vkUpdateDescriptorSets" (vkUpdateDescriptorSets'
(deviceHandle (device))
((fromIntegral (Data.Vector.length $ (descriptorWrites)) :: Word32))
(forgetExtensions (pPDescriptorWrites))
((fromIntegral (Data.Vector.length $ (descriptorCopies)) :: Word32))
(pPDescriptorCopies))
pure $ ()
data DescriptorBufferInfo = DescriptorBufferInfo
{
DescriptorBufferInfo -> Buffer
buffer :: Buffer
,
DescriptorBufferInfo -> DeviceSize
offset :: DeviceSize
,
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
$c== :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
== :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
$c/= :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
/= :: DescriptorBufferInfo -> DescriptorBufferInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorBufferInfo)
#endif
deriving instance Show DescriptorBufferInfo
instance ToCStruct DescriptorBufferInfo where
withCStruct :: forall b.
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 b.
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 :: forall b.
Ptr DescriptorBufferInfo -> DescriptorBufferInfo -> IO b -> IO b
pokeCStruct Ptr DescriptorBufferInfo
p DescriptorBufferInfo{DeviceSize
Buffer
buffer :: DescriptorBufferInfo -> Buffer
offset :: DescriptorBufferInfo -> DeviceSize
range :: DescriptorBufferInfo -> DeviceSize
buffer :: Buffer
offset :: DeviceSize
range :: DeviceSize
..} 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 :: forall b. 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 <- 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))
offset <- peek @DeviceSize ((p `plusPtr` 8 :: Ptr DeviceSize))
range <- peek @DeviceSize ((p `plusPtr` 16 :: Ptr DeviceSize))
pure $ DescriptorBufferInfo
buffer offset 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 b.
Ptr DescriptorBufferInfo -> DescriptorBufferInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorBufferInfo
ptr DescriptorBufferInfo
poked (() -> IO ()
forall a. a -> IO a
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
data DescriptorImageInfo = DescriptorImageInfo
{
DescriptorImageInfo -> Sampler
sampler :: Sampler
,
DescriptorImageInfo -> ImageView
imageView :: ImageView
,
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
$c== :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
== :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
$c/= :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
/= :: DescriptorImageInfo -> DescriptorImageInfo -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorImageInfo)
#endif
deriving instance Show DescriptorImageInfo
instance ToCStruct DescriptorImageInfo where
withCStruct :: forall b.
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 b.
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 :: forall b.
Ptr DescriptorImageInfo -> DescriptorImageInfo -> IO b -> IO b
pokeCStruct Ptr DescriptorImageInfo
p DescriptorImageInfo{ImageLayout
Sampler
ImageView
sampler :: DescriptorImageInfo -> Sampler
imageView :: DescriptorImageInfo -> ImageView
imageLayout :: DescriptorImageInfo -> ImageLayout
sampler :: Sampler
imageView :: ImageView
imageLayout :: ImageLayout
..} 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 :: forall b. 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 <- 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 <- peek @ImageView ((p `plusPtr` 8 :: Ptr ImageView))
imageLayout <- peek @ImageLayout ((p `plusPtr` 16 :: Ptr ImageLayout))
pure $ DescriptorImageInfo
sampler imageView 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 b.
Ptr DescriptorImageInfo -> DescriptorImageInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorImageInfo
ptr DescriptorImageInfo
poked (() -> IO ()
forall a. a -> IO a
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
data WriteDescriptorSet (es :: [Type]) = WriteDescriptorSet
{
forall (es :: [*]). WriteDescriptorSet es -> Chain es
next :: Chain es
,
forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
dstSet :: DescriptorSet
,
forall (es :: [*]). WriteDescriptorSet es -> Word32
dstBinding :: Word32
,
forall (es :: [*]). WriteDescriptorSet es -> Word32
dstArrayElement :: Word32
,
forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorCount :: Word32
,
forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
descriptorType :: DescriptorType
,
forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
imageInfo :: Vector DescriptorImageInfo
,
forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
bufferInfo :: Vector DescriptorBufferInfo
,
forall (es :: [*]). 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 :: forall (ds :: [*]) (es :: [*]).
WriteDescriptorSet ds -> Chain es -> WriteDescriptorSet es
setNext WriteDescriptorSet{Word32
Vector BufferView
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
DescriptorType
DescriptorSet
Chain ds
next :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
dstSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
dstBinding :: forall (es :: [*]). WriteDescriptorSet es -> Word32
dstArrayElement :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorCount :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorType :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
imageInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
bufferInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
texelBufferView :: forall (es :: [*]). WriteDescriptorSet es -> Vector BufferView
next :: Chain ds
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
descriptorType :: DescriptorType
imageInfo :: Vector DescriptorImageInfo
bufferInfo :: Vector DescriptorBufferInfo
texelBufferView :: Vector BufferView
..} Chain es
next' = WriteDescriptorSet{next :: Chain es
next = Chain es
next', Word32
Vector BufferView
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
DescriptorType
DescriptorSet
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
descriptorType :: DescriptorType
imageInfo :: Vector DescriptorImageInfo
bufferInfo :: Vector DescriptorBufferInfo
texelBufferView :: Vector BufferView
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
descriptorType :: DescriptorType
imageInfo :: Vector DescriptorImageInfo
bufferInfo :: Vector DescriptorBufferInfo
texelBufferView :: Vector BufferView
..}
getNext :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
getNext WriteDescriptorSet{Word32
Vector BufferView
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
DescriptorType
DescriptorSet
Chain es
next :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
dstSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
dstBinding :: forall (es :: [*]). WriteDescriptorSet es -> Word32
dstArrayElement :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorCount :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorType :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
imageInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
bufferInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
texelBufferView :: forall (es :: [*]). WriteDescriptorSet es -> Vector BufferView
next :: Chain es
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
descriptorType :: DescriptorType
imageInfo :: Vector DescriptorImageInfo
bufferInfo :: Vector DescriptorBufferInfo
texelBufferView :: Vector BufferView
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends WriteDescriptorSet e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e -> (Extends WriteDescriptorSet e => b) -> Maybe b
extends proxy e
_ Extends WriteDescriptorSet e => b
f
| Just e :~: WriteDescriptorSetTensorARM
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @WriteDescriptorSetTensorARM = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends WriteDescriptorSet e => b
f
| Just e :~: WriteDescriptorSetAccelerationStructureNV
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (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 <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (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 :~: WriteDescriptorSetInlineUniformBlock
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @WriteDescriptorSetInlineUniformBlock = 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 :: forall b.
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 b.
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 :: forall b.
Ptr (WriteDescriptorSet es)
-> WriteDescriptorSet es -> IO b -> IO b
pokeCStruct Ptr (WriteDescriptorSet es)
p WriteDescriptorSet{Word32
Vector BufferView
Vector DescriptorImageInfo
Vector DescriptorBufferInfo
DescriptorType
DescriptorSet
Chain es
next :: forall (es :: [*]). WriteDescriptorSet es -> Chain es
dstSet :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorSet
dstBinding :: forall (es :: [*]). WriteDescriptorSet es -> Word32
dstArrayElement :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorCount :: forall (es :: [*]). WriteDescriptorSet es -> Word32
descriptorType :: forall (es :: [*]). WriteDescriptorSet es -> DescriptorType
imageInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorImageInfo
bufferInfo :: forall (es :: [*]).
WriteDescriptorSet es -> Vector DescriptorBufferInfo
texelBufferView :: forall (es :: [*]). WriteDescriptorSet es -> Vector BufferView
next :: Chain es
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
descriptorType :: DescriptorType
imageInfo :: Vector DescriptorImageInfo
bufferInfo :: Vector DescriptorBufferInfo
texelBufferView :: Vector BufferView
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorSet)) (dstSet)
lift $ poke ((p `plusPtr` 24 :: Ptr Word32)) (dstBinding)
lift $ poke ((p `plusPtr` 28 :: Ptr Word32)) (dstArrayElement)
let 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)
lift $ unless (fromIntegral pImageInfoLength == (descriptorCount) || pImageInfoLength == 0) $
throwIO $ IOError Nothing InvalidArgument "" "pImageInfo must be empty or have 'descriptorCount' elements" Nothing Nothing
let 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)
lift $ unless (fromIntegral pBufferInfoLength == (descriptorCount) || pBufferInfoLength == 0) $
throwIO $ IOError Nothing InvalidArgument "" "pBufferInfo must be empty or have 'descriptorCount' elements" Nothing Nothing
let 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)
lift $ unless (fromIntegral pTexelBufferViewLength == (descriptorCount) || pTexelBufferViewLength == 0) $
throwIO $ IOError Nothing InvalidArgument "" "pTexelBufferView must be empty or have 'descriptorCount' elements" Nothing Nothing
lift $ poke ((p `plusPtr` 32 :: Ptr Word32)) ((descriptorCount))
lift $ poke ((p `plusPtr` 36 :: Ptr DescriptorType)) (descriptorType)
pImageInfo'' <- if Data.Vector.null (imageInfo)
then pure nullPtr
else do
pPImageInfo <- ContT $ allocaBytes @DescriptorImageInfo (((Data.Vector.length (imageInfo))) * 24)
lift $ 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)) ((imageInfo))
pure $ pPImageInfo
lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr DescriptorImageInfo))) pImageInfo''
pBufferInfo'' <- if Data.Vector.null (bufferInfo)
then pure nullPtr
else do
pPBufferInfo <- ContT $ allocaBytes @DescriptorBufferInfo (((Data.Vector.length (bufferInfo))) * 24)
lift $ 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)) ((bufferInfo))
pure $ pPBufferInfo
lift $ poke ((p `plusPtr` 48 :: Ptr (Ptr DescriptorBufferInfo))) pBufferInfo''
pTexelBufferView'' <- if Data.Vector.null (texelBufferView)
then pure nullPtr
else do
pPTexelBufferView <- ContT $ allocaBytes @BufferView (((Data.Vector.length (texelBufferView))) * 8)
lift $ 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)) ((texelBufferView))
pure $ pPTexelBufferView
lift $ poke ((p `plusPtr` 56 :: Ptr (Ptr BufferView))) pTexelBufferView''
lift $ f
cStructSize :: Int
cStructSize = Int
64
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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 (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorSet)) (zero)
lift $ poke ((p `plusPtr` 24 :: Ptr Word32)) (zero)
lift $ poke ((p `plusPtr` 28 :: Ptr Word32)) (zero)
lift $ poke ((p `plusPtr` 36 :: Ptr DescriptorType)) (zero)
lift $ f
instance ( Extendss WriteDescriptorSet es
, PeekChain es ) => FromCStruct (WriteDescriptorSet es) where
peekCStruct :: Ptr (WriteDescriptorSet es) -> IO (WriteDescriptorSet es)
peekCStruct Ptr (WriteDescriptorSet es)
p = do
pNext <- 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 ())))
next <- peekChain (castPtr pNext)
dstSet <- peek @DescriptorSet ((p `plusPtr` 16 :: Ptr DescriptorSet))
dstBinding <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
dstArrayElement <- peek @Word32 ((p `plusPtr` 28 :: Ptr Word32))
descriptorCount <- peek @Word32 ((p `plusPtr` 32 :: Ptr Word32))
descriptorType <- peek @DescriptorType ((p `plusPtr` 36 :: Ptr DescriptorType))
pImageInfo <- peek @(Ptr DescriptorImageInfo) ((p `plusPtr` 40 :: Ptr (Ptr DescriptorImageInfo)))
let 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 (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
descriptorCount)
pImageInfo' <- generateM pImageInfoLength (\Int
i -> 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)))
pBufferInfo <- peek @(Ptr DescriptorBufferInfo) ((p `plusPtr` 48 :: Ptr (Ptr DescriptorBufferInfo)))
let 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 (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
descriptorCount)
pBufferInfo' <- generateM pBufferInfoLength (\Int
i -> 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)))
pTexelBufferView <- peek @(Ptr BufferView) ((p `plusPtr` 56 :: Ptr (Ptr BufferView)))
let 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 (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
descriptorCount)
pTexelBufferView' <- generateM pTexelBufferViewLength (\Int
i -> 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)))
pure $ WriteDescriptorSet
next
dstSet
dstBinding
dstArrayElement
descriptorCount
descriptorType
pImageInfo'
pBufferInfo'
pTexelBufferView'
instance es ~ '[] => Zero (WriteDescriptorSet es) where
zero :: WriteDescriptorSet es
zero = Chain es
-> DescriptorSet
-> Word32
-> Word32
-> Word32
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
forall (es :: [*]).
Chain es
-> DescriptorSet
-> Word32
-> Word32
-> Word32
-> DescriptorType
-> Vector DescriptorImageInfo
-> Vector DescriptorBufferInfo
-> Vector BufferView
-> WriteDescriptorSet es
WriteDescriptorSet
()
DescriptorSet
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
DescriptorType
forall a. Zero a => a
zero
Vector DescriptorImageInfo
forall a. Monoid a => a
mempty
Vector DescriptorBufferInfo
forall a. Monoid a => a
mempty
Vector BufferView
forall a. Monoid a => a
mempty
data CopyDescriptorSet = CopyDescriptorSet
{
CopyDescriptorSet -> DescriptorSet
srcSet :: DescriptorSet
,
CopyDescriptorSet -> Word32
srcBinding :: Word32
,
CopyDescriptorSet -> Word32
srcArrayElement :: Word32
,
CopyDescriptorSet -> DescriptorSet
dstSet :: DescriptorSet
,
CopyDescriptorSet -> Word32
dstBinding :: Word32
,
CopyDescriptorSet -> Word32
dstArrayElement :: Word32
,
CopyDescriptorSet -> 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
$c== :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
== :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
$c/= :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
/= :: CopyDescriptorSet -> CopyDescriptorSet -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyDescriptorSet)
#endif
deriving instance Show CopyDescriptorSet
instance ToCStruct CopyDescriptorSet where
withCStruct :: forall b.
CopyDescriptorSet -> (Ptr CopyDescriptorSet -> IO b) -> IO b
withCStruct CopyDescriptorSet
x Ptr CopyDescriptorSet -> IO b
f = Int -> (Ptr CopyDescriptorSet -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
56 ((Ptr CopyDescriptorSet -> IO b) -> IO b)
-> (Ptr CopyDescriptorSet -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr CopyDescriptorSet
p -> Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO b -> IO b
forall b.
Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyDescriptorSet
p CopyDescriptorSet
x (Ptr CopyDescriptorSet -> IO b
f Ptr CopyDescriptorSet
p)
pokeCStruct :: forall b.
Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO b -> IO b
pokeCStruct Ptr CopyDescriptorSet
p CopyDescriptorSet{Word32
DescriptorSet
srcSet :: CopyDescriptorSet -> DescriptorSet
srcBinding :: CopyDescriptorSet -> Word32
srcArrayElement :: CopyDescriptorSet -> Word32
dstSet :: CopyDescriptorSet -> DescriptorSet
dstBinding :: CopyDescriptorSet -> Word32
dstArrayElement :: CopyDescriptorSet -> Word32
descriptorCount :: CopyDescriptorSet -> Word32
srcSet :: DescriptorSet
srcBinding :: Word32
srcArrayElement :: Word32
dstSet :: DescriptorSet
dstBinding :: Word32
dstArrayElement :: Word32
descriptorCount :: Word32
..} IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p 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 ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DescriptorSet -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
srcSet)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
srcBinding)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
srcArrayElement)
Ptr DescriptorSet -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DescriptorSet)) (DescriptorSet
dstSet)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) (Word32
dstBinding)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) (Word32
dstArrayElement)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) (Word32
descriptorCount)
IO b
f
cStructSize :: Int
cStructSize = Int
56
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr CopyDescriptorSet -> IO b -> IO b
pokeZeroCStruct Ptr CopyDescriptorSet
p IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p 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 ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DescriptorSet -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet)) (DescriptorSet
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr DescriptorSet -> DescriptorSet -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr DescriptorSet)) (DescriptorSet
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct CopyDescriptorSet where
peekCStruct :: Ptr CopyDescriptorSet -> IO CopyDescriptorSet
peekCStruct Ptr CopyDescriptorSet
p = do
srcSet <- forall a. Storable a => Ptr a -> IO a
peek @DescriptorSet ((Ptr CopyDescriptorSet
p Ptr CopyDescriptorSet -> Int -> Ptr DescriptorSet
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr DescriptorSet))
srcBinding <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
srcArrayElement <- peek @Word32 ((p `plusPtr` 28 :: Ptr Word32))
dstSet <- peek @DescriptorSet ((p `plusPtr` 32 :: Ptr DescriptorSet))
dstBinding <- peek @Word32 ((p `plusPtr` 40 :: Ptr Word32))
dstArrayElement <- peek @Word32 ((p `plusPtr` 44 :: Ptr Word32))
descriptorCount <- peek @Word32 ((p `plusPtr` 48 :: Ptr Word32))
pure $ CopyDescriptorSet
srcSet
srcBinding
srcArrayElement
dstSet
dstBinding
dstArrayElement
descriptorCount
instance Storable CopyDescriptorSet where
sizeOf :: CopyDescriptorSet -> Int
sizeOf ~CopyDescriptorSet
_ = Int
56
alignment :: CopyDescriptorSet -> Int
alignment ~CopyDescriptorSet
_ = Int
8
peek :: Ptr CopyDescriptorSet -> IO CopyDescriptorSet
peek = Ptr CopyDescriptorSet -> IO CopyDescriptorSet
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO ()
poke Ptr CopyDescriptorSet
ptr CopyDescriptorSet
poked = Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO () -> IO ()
forall b.
Ptr CopyDescriptorSet -> CopyDescriptorSet -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyDescriptorSet
ptr CopyDescriptorSet
poked (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero CopyDescriptorSet where
zero :: CopyDescriptorSet
zero = DescriptorSet
-> Word32
-> Word32
-> DescriptorSet
-> Word32
-> Word32
-> Word32
-> CopyDescriptorSet
CopyDescriptorSet
DescriptorSet
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
DescriptorSet
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
data DescriptorSetLayoutBinding = DescriptorSetLayoutBinding
{
DescriptorSetLayoutBinding -> Word32
binding :: Word32
,
DescriptorSetLayoutBinding -> DescriptorType
descriptorType :: DescriptorType
,
DescriptorSetLayoutBinding -> Word32
descriptorCount :: Word32
,
DescriptorSetLayoutBinding -> ShaderStageFlags
stageFlags :: ShaderStageFlags
,
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 :: forall b.
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 b.
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 :: forall b.
Ptr DescriptorSetLayoutBinding
-> DescriptorSetLayoutBinding -> IO b -> IO b
pokeCStruct Ptr DescriptorSetLayoutBinding
p DescriptorSetLayoutBinding{Word32
Vector Sampler
ShaderStageFlags
DescriptorType
binding :: DescriptorSetLayoutBinding -> Word32
descriptorType :: DescriptorSetLayoutBinding -> DescriptorType
descriptorCount :: DescriptorSetLayoutBinding -> Word32
stageFlags :: DescriptorSetLayoutBinding -> ShaderStageFlags
immutableSamplers :: DescriptorSetLayoutBinding -> Vector Sampler
binding :: Word32
descriptorType :: DescriptorType
descriptorCount :: Word32
stageFlags :: ShaderStageFlags
immutableSamplers :: Vector Sampler
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (Word32
binding)
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
descriptorCount'' <- IO Word32 -> ContT b IO Word32
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Word32 -> ContT b IO Word32) -> IO Word32 -> ContT b IO Word32
forall a b. (a -> b) -> a -> b
$ if (Word32
descriptorCount) Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== Word32
0
then Word32 -> IO Word32
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$ Int -> 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 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pImmutableSamplersLength Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== (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. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pImmutableSamplers must be empty or have 'descriptorCount' elements" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
Word32 -> IO Word32
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Word32
descriptorCount)
lift $ poke ((p `plusPtr` 8 :: Ptr Word32)) (descriptorCount'')
lift $ poke ((p `plusPtr` 12 :: Ptr ShaderStageFlags)) (stageFlags)
pImmutableSamplers'' <- if Data.Vector.null (immutableSamplers)
then pure nullPtr
else do
pPImmutableSamplers <- ContT $ allocaBytes @Sampler (((Data.Vector.length (immutableSamplers))) * 8)
lift $ 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)) ((immutableSamplers))
pure $ pPImmutableSamplers
lift $ poke ((p `plusPtr` 16 :: Ptr (Ptr Sampler))) pImmutableSamplers''
lift $ f
cStructSize :: Int
cStructSize = Int
24
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr DescriptorSetLayoutBinding -> IO b -> IO b
pokeZeroCStruct Ptr DescriptorSetLayoutBinding
p IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (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
binding <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DescriptorSetLayoutBinding
p Ptr DescriptorSetLayoutBinding -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32))
descriptorType <- peek @DescriptorType ((p `plusPtr` 4 :: Ptr DescriptorType))
descriptorCount <- peek @Word32 ((p `plusPtr` 8 :: Ptr Word32))
stageFlags <- peek @ShaderStageFlags ((p `plusPtr` 12 :: Ptr ShaderStageFlags))
pImmutableSamplers <- peek @(Ptr Sampler) ((p `plusPtr` 16 :: Ptr (Ptr Sampler)))
let 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 (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
descriptorCount)
pImmutableSamplers' <- generateM pImmutableSamplersLength (\Int
i -> 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)))
pure $ DescriptorSetLayoutBinding
binding
descriptorType
descriptorCount
stageFlags
pImmutableSamplers'
instance Zero DescriptorSetLayoutBinding where
zero :: DescriptorSetLayoutBinding
zero = Word32
-> DescriptorType
-> Word32
-> ShaderStageFlags
-> Vector Sampler
-> DescriptorSetLayoutBinding
DescriptorSetLayoutBinding
Word32
forall a. Zero a => a
zero
DescriptorType
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
ShaderStageFlags
forall a. Zero a => a
zero
Vector Sampler
forall a. Monoid a => a
mempty
data DescriptorSetLayoutCreateInfo (es :: [Type]) = DescriptorSetLayoutCreateInfo
{
forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
flags :: DescriptorSetLayoutCreateFlags
,
forall (es :: [*]).
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 :: forall (ds :: [*]) (es :: [*]).
DescriptorSetLayoutCreateInfo ds
-> Chain es -> DescriptorSetLayoutCreateInfo es
setNext DescriptorSetLayoutCreateInfo{Vector DescriptorSetLayoutBinding
DescriptorSetLayoutCreateFlags
Chain ds
next :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
bindings :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
next :: Chain ds
flags :: DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
..} Chain es
next' = DescriptorSetLayoutCreateInfo{next :: Chain es
next = Chain es
next', Vector DescriptorSetLayoutBinding
DescriptorSetLayoutCreateFlags
flags :: DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
flags :: DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
..}
getNext :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
getNext DescriptorSetLayoutCreateInfo{Vector DescriptorSetLayoutBinding
DescriptorSetLayoutCreateFlags
Chain es
next :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
bindings :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
next :: Chain es
flags :: DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorSetLayoutCreateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e
-> (Extends DescriptorSetLayoutCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorSetLayoutCreateInfo e => b
f
| Just e :~: MutableDescriptorTypeCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @MutableDescriptorTypeCreateInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorSetLayoutCreateInfo e => b
f
| Just e :~: DescriptorSetLayoutBindingFlagsCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (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 :: forall b.
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 b.
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 :: forall b.
Ptr (DescriptorSetLayoutCreateInfo es)
-> DescriptorSetLayoutCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p DescriptorSetLayoutCreateInfo{Vector DescriptorSetLayoutBinding
DescriptorSetLayoutCreateFlags
Chain es
next :: forall (es :: [*]). DescriptorSetLayoutCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es -> DescriptorSetLayoutCreateFlags
bindings :: forall (es :: [*]).
DescriptorSetLayoutCreateInfo es
-> Vector DescriptorSetLayoutBinding
next :: Chain es
flags :: DescriptorSetLayoutCreateFlags
bindings :: Vector DescriptorSetLayoutBinding
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorSetLayoutCreateFlags)) (flags)
lift $ poke ((p `plusPtr` 20 :: Ptr Word32)) ((fromIntegral (Data.Vector.length $ (bindings)) :: Word32))
pPBindings' <- ContT $ allocaBytes @DescriptorSetLayoutBinding ((Data.Vector.length (bindings)) * 24)
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 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
$ ())) (bindings)
lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr DescriptorSetLayoutBinding))) (pPBindings')
lift $ f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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 (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
lift $ f
instance ( Extendss DescriptorSetLayoutCreateInfo es
, PeekChain es ) => FromCStruct (DescriptorSetLayoutCreateInfo es) where
peekCStruct :: Ptr (DescriptorSetLayoutCreateInfo es)
-> IO (DescriptorSetLayoutCreateInfo es)
peekCStruct Ptr (DescriptorSetLayoutCreateInfo es)
p = do
pNext <- 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 ())))
next <- peekChain (castPtr pNext)
flags <- peek @DescriptorSetLayoutCreateFlags ((p `plusPtr` 16 :: Ptr DescriptorSetLayoutCreateFlags))
bindingCount <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
pBindings <- peek @(Ptr DescriptorSetLayoutBinding) ((p `plusPtr` 24 :: Ptr (Ptr DescriptorSetLayoutBinding)))
pBindings' <- generateM (fromIntegral bindingCount) (\Int
i -> 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)))
pure $ DescriptorSetLayoutCreateInfo
next flags 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
data DescriptorPoolSize = DescriptorPoolSize
{
DescriptorPoolSize -> DescriptorType
type' :: DescriptorType
,
DescriptorPoolSize -> 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
$c== :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
== :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
$c/= :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
/= :: DescriptorPoolSize -> DescriptorPoolSize -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DescriptorPoolSize)
#endif
deriving instance Show DescriptorPoolSize
instance ToCStruct DescriptorPoolSize where
withCStruct :: forall b.
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 b.
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 :: forall b.
Ptr DescriptorPoolSize -> DescriptorPoolSize -> IO b -> IO b
pokeCStruct Ptr DescriptorPoolSize
p DescriptorPoolSize{Word32
DescriptorType
type' :: DescriptorPoolSize -> DescriptorType
descriptorCount :: DescriptorPoolSize -> Word32
type' :: DescriptorType
descriptorCount :: Word32
..} 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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (Word32
descriptorCount)
IO b
f
cStructSize :: Int
cStructSize = Int
8
cStructAlignment :: Int
cStructAlignment = Int
4
pokeZeroCStruct :: forall b. 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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DescriptorPoolSize
p Ptr DescriptorPoolSize -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct DescriptorPoolSize where
peekCStruct :: Ptr DescriptorPoolSize -> IO DescriptorPoolSize
peekCStruct Ptr DescriptorPoolSize
p = do
type' <- 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))
descriptorCount <- peek @Word32 ((p `plusPtr` 4 :: Ptr Word32))
pure $ DescriptorPoolSize
type' 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 b.
Ptr DescriptorPoolSize -> DescriptorPoolSize -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DescriptorPoolSize
ptr DescriptorPoolSize
poked (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero DescriptorPoolSize where
zero :: DescriptorPoolSize
zero = DescriptorType -> Word32 -> DescriptorPoolSize
DescriptorPoolSize
DescriptorType
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
data DescriptorPoolCreateInfo (es :: [Type]) = DescriptorPoolCreateInfo
{
forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
flags :: DescriptorPoolCreateFlags
,
forall (es :: [*]). DescriptorPoolCreateInfo es -> Word32
maxSets :: Word32
,
forall (es :: [*]).
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 :: forall (ds :: [*]) (es :: [*]).
DescriptorPoolCreateInfo ds
-> Chain es -> DescriptorPoolCreateInfo es
setNext DescriptorPoolCreateInfo{Word32
Vector DescriptorPoolSize
DescriptorPoolCreateFlags
Chain ds
next :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
maxSets :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Word32
poolSizes :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
next :: Chain ds
flags :: DescriptorPoolCreateFlags
maxSets :: Word32
poolSizes :: Vector DescriptorPoolSize
..} Chain es
next' = DescriptorPoolCreateInfo{next :: Chain es
next = Chain es
next', Word32
Vector DescriptorPoolSize
DescriptorPoolCreateFlags
flags :: DescriptorPoolCreateFlags
maxSets :: Word32
poolSizes :: Vector DescriptorPoolSize
flags :: DescriptorPoolCreateFlags
maxSets :: Word32
poolSizes :: Vector DescriptorPoolSize
..}
getNext :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
getNext DescriptorPoolCreateInfo{Word32
Vector DescriptorPoolSize
DescriptorPoolCreateFlags
Chain es
next :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
maxSets :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Word32
poolSizes :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
next :: Chain es
flags :: DescriptorPoolCreateFlags
maxSets :: Word32
poolSizes :: Vector DescriptorPoolSize
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorPoolCreateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e -> (Extends DescriptorPoolCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorPoolCreateInfo e => b
f
| Just e :~: DataGraphProcessingEngineCreateInfoARM
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @DataGraphProcessingEngineCreateInfoARM = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorPoolCreateInfo e => b
f
| Just e :~: MutableDescriptorTypeCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @MutableDescriptorTypeCreateInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends DescriptorPoolCreateInfo e => b
f
| Just e :~: DescriptorPoolInlineUniformBlockCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @DescriptorPoolInlineUniformBlockCreateInfo = 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 :: forall b.
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 b.
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 :: forall b.
Ptr (DescriptorPoolCreateInfo es)
-> DescriptorPoolCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorPoolCreateInfo es)
p DescriptorPoolCreateInfo{Word32
Vector DescriptorPoolSize
DescriptorPoolCreateFlags
Chain es
next :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Chain es
flags :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> DescriptorPoolCreateFlags
maxSets :: forall (es :: [*]). DescriptorPoolCreateInfo es -> Word32
poolSizes :: forall (es :: [*]).
DescriptorPoolCreateInfo es -> Vector DescriptorPoolSize
next :: Chain es
flags :: DescriptorPoolCreateFlags
maxSets :: Word32
poolSizes :: Vector DescriptorPoolSize
..} 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorPoolCreateFlags)) (flags)
lift $ poke ((p `plusPtr` 20 :: Ptr Word32)) (maxSets)
lift $ poke ((p `plusPtr` 24 :: Ptr Word32)) ((fromIntegral (Data.Vector.length $ (poolSizes)) :: Word32))
pPPoolSizes' <- ContT $ allocaBytes @DescriptorPoolSize ((Data.Vector.length (poolSizes)) * 8)
lift $ 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)) (poolSizes)
lift $ poke ((p `plusPtr` 32 :: Ptr (Ptr DescriptorPoolSize))) (pPPoolSizes')
lift $ f
cStructSize :: Int
cStructSize = Int
40
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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 (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
lift $ poke ((p `plusPtr` 20 :: Ptr Word32)) (zero)
lift $ f
instance ( Extendss DescriptorPoolCreateInfo es
, PeekChain es ) => FromCStruct (DescriptorPoolCreateInfo es) where
peekCStruct :: Ptr (DescriptorPoolCreateInfo es)
-> IO (DescriptorPoolCreateInfo es)
peekCStruct Ptr (DescriptorPoolCreateInfo es)
p = do
pNext <- 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 ())))
next <- peekChain (castPtr pNext)
flags <- peek @DescriptorPoolCreateFlags ((p `plusPtr` 16 :: Ptr DescriptorPoolCreateFlags))
maxSets <- peek @Word32 ((p `plusPtr` 20 :: Ptr Word32))
poolSizeCount <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
pPoolSizes <- peek @(Ptr DescriptorPoolSize) ((p `plusPtr` 32 :: Ptr (Ptr DescriptorPoolSize)))
pPoolSizes' <- generateM (fromIntegral poolSizeCount) (\Int
i -> 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)))
pure $ DescriptorPoolCreateInfo
next flags maxSets pPoolSizes'
instance es ~ '[] => Zero (DescriptorPoolCreateInfo es) where
zero :: DescriptorPoolCreateInfo es
zero = Chain es
-> DescriptorPoolCreateFlags
-> Word32
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
forall (es :: [*]).
Chain es
-> DescriptorPoolCreateFlags
-> Word32
-> Vector DescriptorPoolSize
-> DescriptorPoolCreateInfo es
DescriptorPoolCreateInfo
()
DescriptorPoolCreateFlags
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Vector DescriptorPoolSize
forall a. Monoid a => a
mempty
data DescriptorSetAllocateInfo (es :: [Type]) = DescriptorSetAllocateInfo
{
forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
descriptorPool :: DescriptorPool
,
forall (es :: [*]).
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 :: forall (ds :: [*]) (es :: [*]).
DescriptorSetAllocateInfo ds
-> Chain es -> DescriptorSetAllocateInfo es
setNext DescriptorSetAllocateInfo{Vector DescriptorSetLayout
DescriptorPool
Chain ds
setLayouts :: forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
descriptorPool :: forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
next :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
next :: Chain ds
descriptorPool :: DescriptorPool
setLayouts :: Vector DescriptorSetLayout
..} Chain es
next' = DescriptorSetAllocateInfo{next :: Chain es
next = Chain es
next', Vector DescriptorSetLayout
DescriptorPool
setLayouts :: Vector DescriptorSetLayout
descriptorPool :: DescriptorPool
descriptorPool :: DescriptorPool
setLayouts :: Vector DescriptorSetLayout
..}
getNext :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
getNext DescriptorSetAllocateInfo{Vector DescriptorSetLayout
DescriptorPool
Chain es
setLayouts :: forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
descriptorPool :: forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
next :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
next :: Chain es
descriptorPool :: DescriptorPool
setLayouts :: Vector DescriptorSetLayout
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends DescriptorSetAllocateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e -> (Extends DescriptorSetAllocateInfo e => b) -> Maybe b
extends proxy e
_ Extends DescriptorSetAllocateInfo e => b
f
| Just e :~: DescriptorSetVariableDescriptorCountAllocateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (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 :: forall b.
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 b.
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 :: forall b.
Ptr (DescriptorSetAllocateInfo es)
-> DescriptorSetAllocateInfo es -> IO b -> IO b
pokeCStruct Ptr (DescriptorSetAllocateInfo es)
p DescriptorSetAllocateInfo{Vector DescriptorSetLayout
DescriptorPool
Chain es
setLayouts :: forall (es :: [*]).
DescriptorSetAllocateInfo es -> Vector DescriptorSetLayout
descriptorPool :: forall (es :: [*]). DescriptorSetAllocateInfo es -> DescriptorPool
next :: forall (es :: [*]). DescriptorSetAllocateInfo es -> Chain es
next :: Chain es
descriptorPool :: DescriptorPool
setLayouts :: 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorPool)) (descriptorPool)
lift $ poke ((p `plusPtr` 24 :: Ptr Word32)) ((fromIntegral (Data.Vector.length $ (setLayouts)) :: Word32))
pPSetLayouts' <- ContT $ allocaBytes @DescriptorSetLayout ((Data.Vector.length (setLayouts)) * 8)
lift $ Data.Vector.imapM_ (\Int
i DescriptorSetLayout
e -> Ptr DescriptorSetLayout -> DescriptorSetLayout -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DescriptorSetLayout
pPSetLayouts' Ptr DescriptorSetLayout -> Int -> 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)) (setLayouts)
lift $ poke ((p `plusPtr` 32 :: Ptr (Ptr DescriptorSetLayout))) (pPSetLayouts')
lift $ f
cStructSize :: Int
cStructSize = Int
40
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. 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 (m :: * -> *) a. Monad m => m a -> ContT b m a
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)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
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 (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
lift $ poke ((p `plusPtr` 16 :: Ptr DescriptorPool)) (zero)
lift $ f
instance ( Extendss DescriptorSetAllocateInfo es
, PeekChain es ) => FromCStruct (DescriptorSetAllocateInfo es) where
peekCStruct :: Ptr (DescriptorSetAllocateInfo es)
-> IO (DescriptorSetAllocateInfo es)
peekCStruct Ptr (DescriptorSetAllocateInfo es)
p = do
pNext <- 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 ())))
next <- peekChain (castPtr pNext)
descriptorPool <- peek @DescriptorPool ((p `plusPtr` 16 :: Ptr DescriptorPool))
descriptorSetCount <- peek @Word32 ((p `plusPtr` 24 :: Ptr Word32))
pSetLayouts <- peek @(Ptr DescriptorSetLayout) ((p `plusPtr` 32 :: Ptr (Ptr DescriptorSetLayout)))
pSetLayouts' <- generateM (fromIntegral descriptorSetCount) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @DescriptorSetLayout ((Ptr DescriptorSetLayout
pSetLayouts Ptr DescriptorSetLayout -> Int -> 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)))
pure $ DescriptorSetAllocateInfo
next descriptorPool 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