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