{-# language CPP #-}
module Vulkan.Core10.ComputePipeline ( createComputePipelines
, withComputePipelines
, destroyPipeline
, SpecializationMapEntry(..)
, SpecializationInfo(..)
, PipelineShaderStageCreateInfo(..)
, ComputePipelineCreateInfo(..)
, Pipeline(..)
, ShaderStageFlagBits(..)
, ShaderStageFlags
, PipelineCreateFlagBits(..)
, PipelineCreateFlags
, PipelineShaderStageCreateFlagBits(..)
, PipelineShaderStageCreateFlags
, PipelineLayoutCreateFlagBits(..)
, PipelineLayoutCreateFlags
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Foldable (traverse_)
import Data.Typeable (eqT)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import Foreign.Marshal.Utils (maybePeek)
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 Data.ByteString (packCString)
import Data.ByteString (useAsCString)
import Data.Coerce (coerce)
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 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.C.Types (CChar)
import Foreign.C.Types (CSize)
import Foreign.C.Types (CSize(..))
import Foreign.C.Types (CSize(CSize))
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.ByteString (ByteString)
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 (peekSomeCStruct)
import Vulkan.CStruct.Extends (pokeSomeCStruct)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.CStruct.Extends (Chain)
import {-# SOURCE #-} Vulkan.Extensions.VK_NV_device_generated_commands_compute (ComputePipelineIndirectBufferInfoNV)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_debug_utils (DebugUtilsObjectNameInfoEXT)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkCreateComputePipelines))
import Vulkan.Dynamic (DeviceCmds(pVkDestroyPipeline))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import Vulkan.Core10.Handles (Pipeline)
import Vulkan.Core10.Handles (Pipeline(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_KHR_pipeline_binary (PipelineBinaryInfoKHR)
import Vulkan.Core10.Handles (PipelineCache)
import Vulkan.Core10.Handles (PipelineCache(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_AMD_pipeline_compiler_control (PipelineCompilerControlCreateInfoAMD)
import Vulkan.Core10.Enums.PipelineCreateFlagBits (PipelineCreateFlags)
import {-# SOURCE #-} Vulkan.Core14.Promoted_From_VK_KHR_maintenance5Roadmap (PipelineCreateFlags2CreateInfo)
import {-# SOURCE #-} Vulkan.Core13.Promoted_From_VK_EXT_pipeline_creation_feedback (PipelineCreationFeedbackCreateInfo)
import Vulkan.Core10.Handles (PipelineLayout)
import {-# SOURCE #-} Vulkan.Core14.Promoted_From_VK_EXT_pipeline_robustnessAdditionalFunctionality' (PipelineRobustnessCreateInfo)
import Vulkan.Core10.Enums.PipelineShaderStageCreateFlagBits (PipelineShaderStageCreateFlags)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_shader_module_identifier (PipelineShaderStageModuleIdentifierCreateInfoEXT)
import {-# SOURCE #-} Vulkan.Extensions.VK_AMDX_shader_enqueue (PipelineShaderStageNodeCreateInfoAMDX)
import {-# SOURCE #-} Vulkan.Core13.Promoted_From_VK_EXT_subgroup_size_control (PipelineShaderStageRequiredSubgroupSizeCreateInfo)
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_descriptor_heap (ShaderDescriptorSetAndBindingMappingInfoEXT)
import Vulkan.Core10.Handles (ShaderModule)
import {-# SOURCE #-} Vulkan.Core10.Shader (ShaderModuleCreateInfo)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_validation_cache (ShaderModuleValidationCacheCreateInfoEXT)
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlagBits)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.CStruct.Extends (SomeStruct(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import {-# SOURCE #-} Vulkan.Extensions.VK_HUAWEI_subpass_shading (SubpassShadingPipelineCreateInfoHUAWEI)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.Handles (Pipeline(..))
import Vulkan.Core10.Enums.PipelineCreateFlagBits (PipelineCreateFlagBits(..))
import Vulkan.Core10.Enums.PipelineCreateFlagBits (PipelineCreateFlags)
import Vulkan.Core10.Enums.PipelineLayoutCreateFlagBits (PipelineLayoutCreateFlagBits(..))
import Vulkan.Core10.Enums.PipelineLayoutCreateFlagBits (PipelineLayoutCreateFlags)
import Vulkan.Core10.Enums.PipelineShaderStageCreateFlagBits (PipelineShaderStageCreateFlagBits(..))
import Vulkan.Core10.Enums.PipelineShaderStageCreateFlagBits (PipelineShaderStageCreateFlags)
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlagBits(..))
import Vulkan.Core10.Enums.ShaderStageFlagBits (ShaderStageFlags)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkCreateComputePipelines
:: FunPtr (Ptr Device_T -> PipelineCache -> Word32 -> Ptr (SomeStruct ComputePipelineCreateInfo) -> Ptr AllocationCallbacks -> Ptr Pipeline -> IO Result) -> Ptr Device_T -> PipelineCache -> Word32 -> Ptr (SomeStruct ComputePipelineCreateInfo) -> Ptr AllocationCallbacks -> Ptr Pipeline -> IO Result
createComputePipelines :: forall io
. (MonadIO io)
=>
Device
->
PipelineCache
->
("createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo))
->
("allocator" ::: Maybe AllocationCallbacks)
-> io (Result, ("pipelines" ::: Vector Pipeline))
createComputePipelines :: forall (io :: * -> *).
MonadIO io =>
Device
-> PipelineCache
-> ("createInfos"
::: Vector (SomeStruct ComputePipelineCreateInfo))
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io (Result, "pipelines" ::: Vector Pipeline)
createComputePipelines Device
device
PipelineCache
pipelineCache
"createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo)
createInfos
"allocator" ::: Maybe AllocationCallbacks
allocator = IO (Result, "pipelines" ::: Vector Pipeline)
-> io (Result, "pipelines" ::: Vector Pipeline)
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, "pipelines" ::: Vector Pipeline)
-> io (Result, "pipelines" ::: Vector Pipeline))
-> (ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Result, "pipelines" ::: Vector Pipeline)
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Result, "pipelines" ::: Vector Pipeline)
-> io (Result, "pipelines" ::: Vector Pipeline)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Result, "pipelines" ::: Vector Pipeline)
-> IO (Result, "pipelines" ::: Vector Pipeline)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Result, "pipelines" ::: Vector Pipeline)
-> io (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Result, "pipelines" ::: Vector Pipeline)
-> io (Result, "pipelines" ::: Vector Pipeline)
forall a b. (a -> b) -> a -> b
$ do
let vkCreateComputePipelinesPtr :: FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
vkCreateComputePipelinesPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
pVkCreateComputePipelines (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT (Result, "pipelines" ::: Vector Pipeline) IO ()
forall (m :: * -> *) a.
Monad m =>
m a -> ContT (Result, "pipelines" ::: Vector Pipeline) m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, "pipelines" ::: Vector Pipeline) IO ())
-> IO () -> ContT (Result, "pipelines" ::: Vector Pipeline) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
vkCreateComputePipelinesPtr FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
-> FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCreateComputePipelines is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkCreateComputePipelines' :: Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result
vkCreateComputePipelines' = FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
-> Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result
mkVkCreateComputePipelines FunPtr
(Ptr Device_T
-> PipelineCache
-> Word32
-> Ptr (SomeStruct ComputePipelineCreateInfo)
-> Ptr AllocationCallbacks
-> Ptr Pipeline
-> IO Result)
vkCreateComputePipelinesPtr
pPCreateInfos <- ((Ptr (ComputePipelineCreateInfo (ZonkAny 0))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr (ComputePipelineCreateInfo (ZonkAny 0)))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (ComputePipelineCreateInfo (ZonkAny 0))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr (ComputePipelineCreateInfo (ZonkAny 0))))
-> ((Ptr (ComputePipelineCreateInfo (ZonkAny 0))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr (ComputePipelineCreateInfo (ZonkAny 0)))
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @(ComputePipelineCreateInfo _) ((("createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo))
-> Int
forall a. Vector a -> Int
Data.Vector.length ("createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo)
createInfos)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
96)
Data.Vector.imapM_ (\Int
i SomeStruct ComputePipelineCreateInfo
e -> ((() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT (Result, "pipelines" ::: Vector Pipeline) IO ()
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT (Result, "pipelines" ::: Vector Pipeline) IO ())
-> ((() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT (Result, "pipelines" ::: Vector Pipeline) IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (SomeStruct ComputePipelineCreateInfo)
-> SomeStruct ComputePipelineCreateInfo
-> IO (Result, "pipelines" ::: Vector Pipeline)
-> IO (Result, "pipelines" ::: Vector Pipeline)
forall (a :: [*] -> *) b.
(forall (es :: [*]).
(Extendss a es, PokeChain es) =>
ToCStruct (a es)) =>
Ptr (SomeStruct a) -> SomeStruct a -> IO b -> IO b
pokeSomeCStruct (Ptr (ComputePipelineCreateInfo (ZonkAny 1))
-> Ptr (SomeStruct ComputePipelineCreateInfo)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (ComputePipelineCreateInfo (ZonkAny 0))
pPCreateInfos Ptr (ComputePipelineCreateInfo (ZonkAny 0))
-> Int -> Ptr (ComputePipelineCreateInfo w)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
96 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr (ComputePipelineCreateInfo _))) (SomeStruct ComputePipelineCreateInfo
e) (IO (Result, "pipelines" ::: Vector Pipeline)
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ((() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> (() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO (Result, "pipelines" ::: Vector Pipeline))
-> () -> IO (Result, "pipelines" ::: Vector Pipeline)
forall a b. (a -> b) -> a -> b
$ ())) (createInfos)
pAllocator <- case (allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr AllocationCallbacks)
forall a. a -> ContT (Result, "pipelines" ::: Vector Pipeline) IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> ContT
(Result, "pipelines" ::: Vector Pipeline)
IO
(Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks
-> (Ptr AllocationCallbacks
-> IO (Result, "pipelines" ::: Vector Pipeline))
-> IO (Result, "pipelines" ::: Vector Pipeline)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
pPPipelines <- ContT $ bracket (callocBytes @Pipeline ((fromIntegral ((fromIntegral (Data.Vector.length $ (createInfos)) :: Word32))) * 8)) free
r <- lift $ traceAroundEvent "vkCreateComputePipelines" (vkCreateComputePipelines'
(deviceHandle (device))
(pipelineCache)
((fromIntegral (Data.Vector.length $ (createInfos)) :: Word32))
(forgetExtensions (pPCreateInfos))
pAllocator
(pPPipelines))
lift $ when (r < SUCCESS) (throwIO (VulkanException r))
pPipelines <- lift $ generateM (fromIntegral ((fromIntegral (Data.Vector.length $ (createInfos)) :: Word32))) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Pipeline ((Ptr Pipeline
pPPipelines Ptr Pipeline -> Int -> Ptr Pipeline
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Pipeline)))
pure $ (r, pPipelines)
withComputePipelines :: forall io r . MonadIO io => Device -> PipelineCache -> Vector (SomeStruct ComputePipelineCreateInfo) -> Maybe AllocationCallbacks -> (io (Result, Vector Pipeline) -> ((Result, Vector Pipeline) -> io ()) -> r) -> r
withComputePipelines :: forall (io :: * -> *) r.
MonadIO io =>
Device
-> PipelineCache
-> ("createInfos"
::: Vector (SomeStruct ComputePipelineCreateInfo))
-> ("allocator" ::: Maybe AllocationCallbacks)
-> (io (Result, "pipelines" ::: Vector Pipeline)
-> ((Result, "pipelines" ::: Vector Pipeline) -> io ()) -> r)
-> r
withComputePipelines Device
device PipelineCache
pipelineCache "createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo)
pCreateInfos "allocator" ::: Maybe AllocationCallbacks
pAllocator io (Result, "pipelines" ::: Vector Pipeline)
-> ((Result, "pipelines" ::: Vector Pipeline) -> io ()) -> r
b =
io (Result, "pipelines" ::: Vector Pipeline)
-> ((Result, "pipelines" ::: Vector Pipeline) -> io ()) -> r
b (Device
-> PipelineCache
-> ("createInfos"
::: Vector (SomeStruct ComputePipelineCreateInfo))
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io (Result, "pipelines" ::: Vector Pipeline)
forall (io :: * -> *).
MonadIO io =>
Device
-> PipelineCache
-> ("createInfos"
::: Vector (SomeStruct ComputePipelineCreateInfo))
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io (Result, "pipelines" ::: Vector Pipeline)
createComputePipelines Device
device PipelineCache
pipelineCache "createInfos" ::: Vector (SomeStruct ComputePipelineCreateInfo)
pCreateInfos "allocator" ::: Maybe AllocationCallbacks
pAllocator)
(\(Result
_, "pipelines" ::: Vector Pipeline
o1) -> (Pipeline -> io ()) -> ("pipelines" ::: Vector Pipeline) -> io ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_ (\Pipeline
o1Elem -> Device
-> Pipeline -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
forall (io :: * -> *).
MonadIO io =>
Device
-> Pipeline -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
destroyPipeline Device
device
Pipeline
o1Elem
"allocator" ::: Maybe AllocationCallbacks
pAllocator) "pipelines" ::: Vector Pipeline
o1)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkDestroyPipeline
:: FunPtr (Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ()) -> Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ()
destroyPipeline :: forall io
. (MonadIO io)
=>
Device
->
Pipeline
->
("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroyPipeline :: forall (io :: * -> *).
MonadIO io =>
Device
-> Pipeline -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
destroyPipeline Device
device Pipeline
pipeline "allocator" ::: Maybe AllocationCallbacks
allocator = IO () -> io ()
forall a. IO a -> io a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
let vkDestroyPipelinePtr :: FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
vkDestroyPipelinePtr = DeviceCmds
-> FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
pVkDestroyPipeline (case Device
device of Device{DeviceCmds
deviceCmds :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
IO () -> ContT () IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT () m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
vkDestroyPipelinePtr FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
-> FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. (HasCallStack, Exception e) => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkDestroyPipeline is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkDestroyPipeline' :: Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ()
vkDestroyPipeline' = FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
-> Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ()
mkVkDestroyPipeline FunPtr
(Ptr Device_T -> Pipeline -> Ptr AllocationCallbacks -> IO ())
vkDestroyPipelinePtr
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> Ptr AllocationCallbacks -> ContT () IO (Ptr AllocationCallbacks)
forall a. a -> ContT () IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr AllocationCallbacks
forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks))
-> ((Ptr AllocationCallbacks -> IO ()) -> IO ())
-> ContT () IO (Ptr AllocationCallbacks)
forall a b. (a -> b) -> a -> b
$ AllocationCallbacks -> (Ptr AllocationCallbacks -> IO ()) -> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
AllocationCallbacks -> (Ptr AllocationCallbacks -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
lift $ traceAroundEvent "vkDestroyPipeline" (vkDestroyPipeline'
(deviceHandle (device))
(pipeline)
pAllocator)
pure $ ()
data SpecializationMapEntry = SpecializationMapEntry
{
SpecializationMapEntry -> Word32
constantID :: Word32
,
SpecializationMapEntry -> Word32
offset :: Word32
,
SpecializationMapEntry -> Word64
size :: Word64
}
deriving (Typeable, SpecializationMapEntry -> SpecializationMapEntry -> Bool
(SpecializationMapEntry -> SpecializationMapEntry -> Bool)
-> (SpecializationMapEntry -> SpecializationMapEntry -> Bool)
-> Eq SpecializationMapEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SpecializationMapEntry -> SpecializationMapEntry -> Bool
== :: SpecializationMapEntry -> SpecializationMapEntry -> Bool
$c/= :: SpecializationMapEntry -> SpecializationMapEntry -> Bool
/= :: SpecializationMapEntry -> SpecializationMapEntry -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SpecializationMapEntry)
#endif
deriving instance Show SpecializationMapEntry
instance ToCStruct SpecializationMapEntry where
withCStruct :: forall b.
SpecializationMapEntry
-> (Ptr SpecializationMapEntry -> IO b) -> IO b
withCStruct SpecializationMapEntry
x Ptr SpecializationMapEntry -> IO b
f = Int -> (Ptr SpecializationMapEntry -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
16 ((Ptr SpecializationMapEntry -> IO b) -> IO b)
-> (Ptr SpecializationMapEntry -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr SpecializationMapEntry
p -> Ptr SpecializationMapEntry
-> SpecializationMapEntry -> IO b -> IO b
forall b.
Ptr SpecializationMapEntry
-> SpecializationMapEntry -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpecializationMapEntry
p SpecializationMapEntry
x (Ptr SpecializationMapEntry -> IO b
f Ptr SpecializationMapEntry
p)
pokeCStruct :: forall b.
Ptr SpecializationMapEntry
-> SpecializationMapEntry -> IO b -> IO b
pokeCStruct Ptr SpecializationMapEntry
p SpecializationMapEntry{Word32
Word64
constantID :: SpecializationMapEntry -> Word32
offset :: SpecializationMapEntry -> Word32
size :: SpecializationMapEntry -> Word64
constantID :: Word32
offset :: Word32
size :: Word64
..} IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (Word32
constantID)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (Word32
offset)
Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
size))
IO b
f
cStructSize :: Int
cStructSize = Int
16
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr SpecializationMapEntry -> IO b -> IO b
pokeZeroCStruct Ptr SpecializationMapEntry
p IO b
f = do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
Ptr CSize -> CSize -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr CSize
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr CSize)) (Word64 -> CSize
CSize (Word64
forall a. Zero a => a
zero))
IO b
f
instance FromCStruct SpecializationMapEntry where
peekCStruct :: Ptr SpecializationMapEntry -> IO SpecializationMapEntry
peekCStruct Ptr SpecializationMapEntry
p = do
constantID <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SpecializationMapEntry
p Ptr SpecializationMapEntry -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32))
offset <- peek @Word32 ((p `plusPtr` 4 :: Ptr Word32))
size <- peek @CSize ((p `plusPtr` 8 :: Ptr CSize))
pure $ SpecializationMapEntry
constantID offset (coerce @CSize @Word64 size)
instance Storable SpecializationMapEntry where
sizeOf :: SpecializationMapEntry -> Int
sizeOf ~SpecializationMapEntry
_ = Int
16
alignment :: SpecializationMapEntry -> Int
alignment ~SpecializationMapEntry
_ = Int
8
peek :: Ptr SpecializationMapEntry -> IO SpecializationMapEntry
peek = Ptr SpecializationMapEntry -> IO SpecializationMapEntry
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr SpecializationMapEntry -> SpecializationMapEntry -> IO ()
poke Ptr SpecializationMapEntry
ptr SpecializationMapEntry
poked = Ptr SpecializationMapEntry
-> SpecializationMapEntry -> IO () -> IO ()
forall b.
Ptr SpecializationMapEntry
-> SpecializationMapEntry -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpecializationMapEntry
ptr SpecializationMapEntry
poked (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero SpecializationMapEntry where
zero :: SpecializationMapEntry
zero = Word32 -> Word32 -> Word64 -> SpecializationMapEntry
SpecializationMapEntry
Word32
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
Word64
forall a. Zero a => a
zero
data SpecializationInfo = SpecializationInfo
{
SpecializationInfo -> Vector SpecializationMapEntry
mapEntries :: Vector SpecializationMapEntry
,
SpecializationInfo -> Word64
dataSize :: Word64
,
SpecializationInfo -> Ptr ()
data' :: Ptr ()
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SpecializationInfo)
#endif
deriving instance Show SpecializationInfo
instance ToCStruct SpecializationInfo where
withCStruct :: forall b.
SpecializationInfo -> (Ptr SpecializationInfo -> IO b) -> IO b
withCStruct SpecializationInfo
x Ptr SpecializationInfo -> IO b
f = Int -> (Ptr SpecializationInfo -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 ((Ptr SpecializationInfo -> IO b) -> IO b)
-> (Ptr SpecializationInfo -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr SpecializationInfo
p -> Ptr SpecializationInfo -> SpecializationInfo -> IO b -> IO b
forall b.
Ptr SpecializationInfo -> SpecializationInfo -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SpecializationInfo
p SpecializationInfo
x (Ptr SpecializationInfo -> IO b
f Ptr SpecializationInfo
p)
pokeCStruct :: forall b.
Ptr SpecializationInfo -> SpecializationInfo -> IO b -> IO b
pokeCStruct Ptr SpecializationInfo
p SpecializationInfo{Word64
Ptr ()
Vector SpecializationMapEntry
mapEntries :: SpecializationInfo -> Vector SpecializationMapEntry
dataSize :: SpecializationInfo -> Word64
data' :: SpecializationInfo -> Ptr ()
mapEntries :: Vector SpecializationMapEntry
dataSize :: Word64
data' :: Ptr ()
..} IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationInfo
p Ptr SpecializationInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector SpecializationMapEntry -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SpecializationMapEntry -> Int)
-> Vector SpecializationMapEntry -> Int
forall a b. (a -> b) -> a -> b
$ (Vector SpecializationMapEntry
mapEntries)) :: Word32))
pPMapEntries' <- ((Ptr SpecializationMapEntry -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationMapEntry)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SpecializationMapEntry -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationMapEntry))
-> ((Ptr SpecializationMapEntry -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationMapEntry)
forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @SpecializationMapEntry ((Vector SpecializationMapEntry -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SpecializationMapEntry
mapEntries)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
16)
lift $ Data.Vector.imapM_ (\Int
i SpecializationMapEntry
e -> Ptr SpecializationMapEntry -> SpecializationMapEntry -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SpecializationMapEntry
pPMapEntries' Ptr SpecializationMapEntry -> Int -> Ptr SpecializationMapEntry
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
16 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SpecializationMapEntry) (SpecializationMapEntry
e)) (mapEntries)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr SpecializationMapEntry))) (pPMapEntries')
lift $ poke ((p `plusPtr` 16 :: Ptr CSize)) (CSize (dataSize))
lift $ poke ((p `plusPtr` 24 :: Ptr (Ptr ()))) (data')
lift $ f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr SpecializationInfo -> IO b -> IO b
pokeZeroCStruct Ptr SpecializationInfo
p IO b
f = do
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SpecializationInfo
p Ptr SpecializationInfo -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ()))) (Ptr ()
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct SpecializationInfo where
peekCStruct :: Ptr SpecializationInfo -> IO SpecializationInfo
peekCStruct Ptr SpecializationInfo
p = do
mapEntryCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SpecializationInfo
p Ptr SpecializationInfo -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word32))
pMapEntries <- peek @(Ptr SpecializationMapEntry) ((p `plusPtr` 8 :: Ptr (Ptr SpecializationMapEntry)))
pMapEntries' <- generateM (fromIntegral mapEntryCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SpecializationMapEntry ((Ptr SpecializationMapEntry
pMapEntries Ptr SpecializationMapEntry -> Int -> Ptr SpecializationMapEntry
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
16 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SpecializationMapEntry)))
dataSize <- peek @CSize ((p `plusPtr` 16 :: Ptr CSize))
pData <- peek @(Ptr ()) ((p `plusPtr` 24 :: Ptr (Ptr ())))
pure $ SpecializationInfo
pMapEntries' (coerce @CSize @Word64 dataSize) pData
instance Zero SpecializationInfo where
zero :: SpecializationInfo
zero = Vector SpecializationMapEntry
-> Word64 -> Ptr () -> SpecializationInfo
SpecializationInfo
Vector SpecializationMapEntry
forall a. Monoid a => a
mempty
Word64
forall a. Zero a => a
zero
Ptr ()
forall a. Zero a => a
zero
data PipelineShaderStageCreateInfo (es :: [Type]) = PipelineShaderStageCreateInfo
{
forall (es :: [*]). PipelineShaderStageCreateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]).
PipelineShaderStageCreateInfo es -> PipelineShaderStageCreateFlags
flags :: PipelineShaderStageCreateFlags
,
forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderStageFlagBits
stage :: ShaderStageFlagBits
,
forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderModule
module' :: ShaderModule
,
forall (es :: [*]). PipelineShaderStageCreateInfo es -> ByteString
name :: ByteString
,
forall (es :: [*]).
PipelineShaderStageCreateInfo es -> Maybe SpecializationInfo
specializationInfo :: Maybe SpecializationInfo
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineShaderStageCreateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (PipelineShaderStageCreateInfo es)
instance Extensible PipelineShaderStageCreateInfo where
extensibleTypeName :: String
extensibleTypeName = String
"PipelineShaderStageCreateInfo"
setNext :: forall (ds :: [*]) (es :: [*]).
PipelineShaderStageCreateInfo ds
-> Chain es -> PipelineShaderStageCreateInfo es
setNext PipelineShaderStageCreateInfo{Maybe SpecializationInfo
ByteString
ShaderStageFlagBits
PipelineShaderStageCreateFlags
ShaderModule
Chain ds
next :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> Chain es
flags :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> PipelineShaderStageCreateFlags
stage :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderStageFlagBits
module' :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderModule
name :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> ByteString
specializationInfo :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> Maybe SpecializationInfo
next :: Chain ds
flags :: PipelineShaderStageCreateFlags
stage :: ShaderStageFlagBits
module' :: ShaderModule
name :: ByteString
specializationInfo :: Maybe SpecializationInfo
..} Chain es
next' = PipelineShaderStageCreateInfo{next :: Chain es
next = Chain es
next', Maybe SpecializationInfo
ByteString
ShaderStageFlagBits
PipelineShaderStageCreateFlags
ShaderModule
flags :: PipelineShaderStageCreateFlags
stage :: ShaderStageFlagBits
module' :: ShaderModule
name :: ByteString
specializationInfo :: Maybe SpecializationInfo
flags :: PipelineShaderStageCreateFlags
stage :: ShaderStageFlagBits
module' :: ShaderModule
name :: ByteString
specializationInfo :: Maybe SpecializationInfo
..}
getNext :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> Chain es
getNext PipelineShaderStageCreateInfo{Maybe SpecializationInfo
ByteString
ShaderStageFlagBits
PipelineShaderStageCreateFlags
ShaderModule
Chain es
next :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> Chain es
flags :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> PipelineShaderStageCreateFlags
stage :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderStageFlagBits
module' :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderModule
name :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> ByteString
specializationInfo :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> Maybe SpecializationInfo
next :: Chain es
flags :: PipelineShaderStageCreateFlags
stage :: ShaderStageFlagBits
module' :: ShaderModule
name :: ByteString
specializationInfo :: Maybe SpecializationInfo
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends PipelineShaderStageCreateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e
-> (Extends PipelineShaderStageCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: ShaderDescriptorSetAndBindingMappingInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @ShaderDescriptorSetAndBindingMappingInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: PipelineShaderStageNodeCreateInfoAMDX
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineShaderStageNodeCreateInfoAMDX = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: PipelineRobustnessCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineRobustnessCreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: PipelineShaderStageModuleIdentifierCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineShaderStageModuleIdentifierCreateInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: PipelineShaderStageRequiredSubgroupSizeCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineShaderStageRequiredSubgroupSizeCreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: DebugUtilsObjectNameInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @DebugUtilsObjectNameInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: ShaderModuleValidationCacheCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @ShaderModuleValidationCacheCreateInfoEXT = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Just e :~: ShaderModuleCreateInfo '[]
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @(ShaderModuleCreateInfo '[]) = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends PipelineShaderStageCreateInfo e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance ( Extendss PipelineShaderStageCreateInfo es
, PokeChain es ) => ToCStruct (PipelineShaderStageCreateInfo es) where
withCStruct :: forall b.
PipelineShaderStageCreateInfo es
-> (Ptr (PipelineShaderStageCreateInfo es) -> IO b) -> IO b
withCStruct PipelineShaderStageCreateInfo es
x Ptr (PipelineShaderStageCreateInfo es) -> IO b
f = Int -> (Ptr (PipelineShaderStageCreateInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
48 ((Ptr (PipelineShaderStageCreateInfo es) -> IO b) -> IO b)
-> (Ptr (PipelineShaderStageCreateInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (PipelineShaderStageCreateInfo es)
p -> Ptr (PipelineShaderStageCreateInfo es)
-> PipelineShaderStageCreateInfo es -> IO b -> IO b
forall b.
Ptr (PipelineShaderStageCreateInfo es)
-> PipelineShaderStageCreateInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (PipelineShaderStageCreateInfo es)
p PipelineShaderStageCreateInfo es
x (Ptr (PipelineShaderStageCreateInfo es) -> IO b
f Ptr (PipelineShaderStageCreateInfo es)
p)
pokeCStruct :: forall b.
Ptr (PipelineShaderStageCreateInfo es)
-> PipelineShaderStageCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (PipelineShaderStageCreateInfo es)
p PipelineShaderStageCreateInfo{Maybe SpecializationInfo
ByteString
ShaderStageFlagBits
PipelineShaderStageCreateFlags
ShaderModule
Chain es
next :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> Chain es
flags :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> PipelineShaderStageCreateFlags
stage :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderStageFlagBits
module' :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> ShaderModule
name :: forall (es :: [*]). PipelineShaderStageCreateInfo es -> ByteString
specializationInfo :: forall (es :: [*]).
PipelineShaderStageCreateInfo es -> Maybe SpecializationInfo
next :: Chain es
flags :: PipelineShaderStageCreateFlags
stage :: ShaderStageFlagBits
module' :: ShaderModule
name :: ByteString
specializationInfo :: Maybe SpecializationInfo
..} IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (PipelineShaderStageCreateInfo es)
p Ptr (PipelineShaderStageCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr PipelineShaderStageCreateFlags)) (flags)
lift $ poke ((p `plusPtr` 20 :: Ptr ShaderStageFlagBits)) (stage)
lift $ poke ((p `plusPtr` 24 :: Ptr ShaderModule)) (module')
pName'' <- ContT $ useAsCString (name)
lift $ poke ((p `plusPtr` 32 :: Ptr (Ptr CChar))) pName''
pSpecializationInfo'' <- case (specializationInfo) of
Maybe SpecializationInfo
Nothing -> Ptr SpecializationInfo -> ContT b IO (Ptr SpecializationInfo)
forall a. a -> ContT b IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Ptr SpecializationInfo
forall a. Ptr a
nullPtr
Just SpecializationInfo
j -> ((Ptr SpecializationInfo -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationInfo)
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SpecializationInfo -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationInfo))
-> ((Ptr SpecializationInfo -> IO b) -> IO b)
-> ContT b IO (Ptr SpecializationInfo)
forall a b. (a -> b) -> a -> b
$ SpecializationInfo -> (Ptr SpecializationInfo -> IO b) -> IO b
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
forall b.
SpecializationInfo -> (Ptr SpecializationInfo -> IO b) -> IO b
withCStruct (SpecializationInfo
j)
lift $ poke ((p `plusPtr` 40 :: Ptr (Ptr SpecializationInfo))) pSpecializationInfo''
lift $ f
cStructSize :: Int
cStructSize = Int
48
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr (PipelineShaderStageCreateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (PipelineShaderStageCreateInfo es)
p IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (PipelineShaderStageCreateInfo es)
p Ptr (PipelineShaderStageCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
lift $ poke ((p `plusPtr` 20 :: Ptr ShaderStageFlagBits)) (zero)
pName'' <- ContT $ useAsCString (mempty)
lift $ poke ((p `plusPtr` 32 :: Ptr (Ptr CChar))) pName''
lift $ f
instance ( Extendss PipelineShaderStageCreateInfo es
, PeekChain es ) => FromCStruct (PipelineShaderStageCreateInfo es) where
peekCStruct :: Ptr (PipelineShaderStageCreateInfo es)
-> IO (PipelineShaderStageCreateInfo es)
peekCStruct Ptr (PipelineShaderStageCreateInfo es)
p = do
pNext <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (PipelineShaderStageCreateInfo es)
p Ptr (PipelineShaderStageCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
next <- peekChain (castPtr pNext)
flags <- peek @PipelineShaderStageCreateFlags ((p `plusPtr` 16 :: Ptr PipelineShaderStageCreateFlags))
stage <- peek @ShaderStageFlagBits ((p `plusPtr` 20 :: Ptr ShaderStageFlagBits))
module' <- peek @ShaderModule ((p `plusPtr` 24 :: Ptr ShaderModule))
pName <- packCString =<< peek ((p `plusPtr` 32 :: Ptr (Ptr CChar)))
pSpecializationInfo <- peek @(Ptr SpecializationInfo) ((p `plusPtr` 40 :: Ptr (Ptr SpecializationInfo)))
pSpecializationInfo' <- maybePeek (\Ptr SpecializationInfo
j -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SpecializationInfo (Ptr SpecializationInfo
j)) pSpecializationInfo
pure $ PipelineShaderStageCreateInfo
next flags stage module' pName pSpecializationInfo'
instance es ~ '[] => Zero (PipelineShaderStageCreateInfo es) where
zero :: PipelineShaderStageCreateInfo es
zero = Chain es
-> PipelineShaderStageCreateFlags
-> ShaderStageFlagBits
-> ShaderModule
-> ByteString
-> Maybe SpecializationInfo
-> PipelineShaderStageCreateInfo es
forall (es :: [*]).
Chain es
-> PipelineShaderStageCreateFlags
-> ShaderStageFlagBits
-> ShaderModule
-> ByteString
-> Maybe SpecializationInfo
-> PipelineShaderStageCreateInfo es
PipelineShaderStageCreateInfo
()
PipelineShaderStageCreateFlags
forall a. Zero a => a
zero
ShaderStageFlagBits
forall a. Zero a => a
zero
ShaderModule
forall a. Zero a => a
zero
ByteString
forall a. Monoid a => a
mempty
Maybe SpecializationInfo
forall a. Maybe a
Nothing
data ComputePipelineCreateInfo (es :: [Type]) = ComputePipelineCreateInfo
{
forall (es :: [*]). ComputePipelineCreateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]).
ComputePipelineCreateInfo es -> PipelineCreateFlags
flags :: PipelineCreateFlags
,
forall (es :: [*]).
ComputePipelineCreateInfo es
-> SomeStruct PipelineShaderStageCreateInfo
stage :: SomeStruct PipelineShaderStageCreateInfo
,
forall (es :: [*]). ComputePipelineCreateInfo es -> PipelineLayout
layout :: PipelineLayout
,
forall (es :: [*]). ComputePipelineCreateInfo es -> Pipeline
basePipelineHandle :: Pipeline
,
forall (es :: [*]). ComputePipelineCreateInfo es -> Int32
basePipelineIndex :: Int32
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ComputePipelineCreateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (ComputePipelineCreateInfo es)
instance Extensible ComputePipelineCreateInfo where
extensibleTypeName :: String
extensibleTypeName = String
"ComputePipelineCreateInfo"
setNext :: forall (ds :: [*]) (es :: [*]).
ComputePipelineCreateInfo ds
-> Chain es -> ComputePipelineCreateInfo es
setNext ComputePipelineCreateInfo{Int32
PipelineCreateFlags
PipelineLayout
Pipeline
Chain ds
SomeStruct PipelineShaderStageCreateInfo
next :: forall (es :: [*]). ComputePipelineCreateInfo es -> Chain es
flags :: forall (es :: [*]).
ComputePipelineCreateInfo es -> PipelineCreateFlags
stage :: forall (es :: [*]).
ComputePipelineCreateInfo es
-> SomeStruct PipelineShaderStageCreateInfo
layout :: forall (es :: [*]). ComputePipelineCreateInfo es -> PipelineLayout
basePipelineHandle :: forall (es :: [*]). ComputePipelineCreateInfo es -> Pipeline
basePipelineIndex :: forall (es :: [*]). ComputePipelineCreateInfo es -> Int32
next :: Chain ds
flags :: PipelineCreateFlags
stage :: SomeStruct PipelineShaderStageCreateInfo
layout :: PipelineLayout
basePipelineHandle :: Pipeline
basePipelineIndex :: Int32
..} Chain es
next' = ComputePipelineCreateInfo{next :: Chain es
next = Chain es
next', Int32
PipelineCreateFlags
PipelineLayout
Pipeline
SomeStruct PipelineShaderStageCreateInfo
flags :: PipelineCreateFlags
stage :: SomeStruct PipelineShaderStageCreateInfo
layout :: PipelineLayout
basePipelineHandle :: Pipeline
basePipelineIndex :: Int32
flags :: PipelineCreateFlags
stage :: SomeStruct PipelineShaderStageCreateInfo
layout :: PipelineLayout
basePipelineHandle :: Pipeline
basePipelineIndex :: Int32
..}
getNext :: forall (es :: [*]). ComputePipelineCreateInfo es -> Chain es
getNext ComputePipelineCreateInfo{Int32
PipelineCreateFlags
PipelineLayout
Pipeline
Chain es
SomeStruct PipelineShaderStageCreateInfo
next :: forall (es :: [*]). ComputePipelineCreateInfo es -> Chain es
flags :: forall (es :: [*]).
ComputePipelineCreateInfo es -> PipelineCreateFlags
stage :: forall (es :: [*]).
ComputePipelineCreateInfo es
-> SomeStruct PipelineShaderStageCreateInfo
layout :: forall (es :: [*]). ComputePipelineCreateInfo es -> PipelineLayout
basePipelineHandle :: forall (es :: [*]). ComputePipelineCreateInfo es -> Pipeline
basePipelineIndex :: forall (es :: [*]). ComputePipelineCreateInfo es -> Int32
next :: Chain es
flags :: PipelineCreateFlags
stage :: SomeStruct PipelineShaderStageCreateInfo
layout :: PipelineLayout
basePipelineHandle :: Pipeline
basePipelineIndex :: Int32
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends ComputePipelineCreateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e -> (Extends ComputePipelineCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends ComputePipelineCreateInfo e => b
f
| Just e :~: PipelineRobustnessCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineRobustnessCreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: PipelineCompilerControlCreateInfoAMD
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineCompilerControlCreateInfoAMD = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: SubpassShadingPipelineCreateInfoHUAWEI
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @SubpassShadingPipelineCreateInfoHUAWEI = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: PipelineCreationFeedbackCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineCreationFeedbackCreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: PipelineBinaryInfoKHR
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineBinaryInfoKHR = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: PipelineCreateFlags2CreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @PipelineCreateFlags2CreateInfo = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Just e :~: ComputePipelineIndirectBufferInfoNV
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
forall a b. (Typeable a, Typeable b) => Maybe (a :~: b)
eqT @e @ComputePipelineIndirectBufferInfoNV = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends ComputePipelineCreateInfo e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance ( Extendss ComputePipelineCreateInfo es
, PokeChain es ) => ToCStruct (ComputePipelineCreateInfo es) where
withCStruct :: forall b.
ComputePipelineCreateInfo es
-> (Ptr (ComputePipelineCreateInfo es) -> IO b) -> IO b
withCStruct ComputePipelineCreateInfo es
x Ptr (ComputePipelineCreateInfo es) -> IO b
f = Int -> (Ptr (ComputePipelineCreateInfo es) -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
96 ((Ptr (ComputePipelineCreateInfo es) -> IO b) -> IO b)
-> (Ptr (ComputePipelineCreateInfo es) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr (ComputePipelineCreateInfo es)
p -> Ptr (ComputePipelineCreateInfo es)
-> ComputePipelineCreateInfo es -> IO b -> IO b
forall b.
Ptr (ComputePipelineCreateInfo es)
-> ComputePipelineCreateInfo es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (ComputePipelineCreateInfo es)
p ComputePipelineCreateInfo es
x (Ptr (ComputePipelineCreateInfo es) -> IO b
f Ptr (ComputePipelineCreateInfo es)
p)
pokeCStruct :: forall b.
Ptr (ComputePipelineCreateInfo es)
-> ComputePipelineCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (ComputePipelineCreateInfo es)
p ComputePipelineCreateInfo{Int32
PipelineCreateFlags
PipelineLayout
Pipeline
Chain es
SomeStruct PipelineShaderStageCreateInfo
next :: forall (es :: [*]). ComputePipelineCreateInfo es -> Chain es
flags :: forall (es :: [*]).
ComputePipelineCreateInfo es -> PipelineCreateFlags
stage :: forall (es :: [*]).
ComputePipelineCreateInfo es
-> SomeStruct PipelineShaderStageCreateInfo
layout :: forall (es :: [*]). ComputePipelineCreateInfo es -> PipelineLayout
basePipelineHandle :: forall (es :: [*]). ComputePipelineCreateInfo es -> Pipeline
basePipelineIndex :: forall (es :: [*]). ComputePipelineCreateInfo es -> Int32
next :: Chain es
flags :: PipelineCreateFlags
stage :: SomeStruct PipelineShaderStageCreateInfo
layout :: PipelineLayout
basePipelineHandle :: Pipeline
basePipelineIndex :: Int32
..} IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ComputePipelineCreateInfo es)
p Ptr (ComputePipelineCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO)
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
forall a. Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext''
lift $ poke ((p `plusPtr` 16 :: Ptr PipelineCreateFlags)) (flags)
ContT $ pokeSomeCStruct (forgetExtensions ((p `plusPtr` 24 :: Ptr (PipelineShaderStageCreateInfo _)))) (stage) . ($ ())
lift $ poke ((p `plusPtr` 72 :: Ptr PipelineLayout)) (layout)
lift $ poke ((p `plusPtr` 80 :: Ptr Pipeline)) (basePipelineHandle)
lift $ poke ((p `plusPtr` 88 :: Ptr Int32)) (basePipelineIndex)
lift $ f
cStructSize :: Int
cStructSize = Int
96
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr (ComputePipelineCreateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (ComputePipelineCreateInfo es)
p IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
IO () -> ContT b IO ()
forall (m :: * -> *) a. Monad m => m a -> ContT b m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (ComputePipelineCreateInfo es)
p Ptr (ComputePipelineCreateInfo es) -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO)
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> ContT b IO a -> ContT b IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr ()))) pNext'
ContT $ pokeSomeCStruct (forgetExtensions ((p `plusPtr` 24 :: Ptr (PipelineShaderStageCreateInfo _)))) ((SomeStruct zero)) . ($ ())
lift $ poke ((p `plusPtr` 88 :: Ptr Int32)) (zero)
lift $ f
instance ( Extendss ComputePipelineCreateInfo es
, PeekChain es ) => FromCStruct (ComputePipelineCreateInfo es) where
peekCStruct :: Ptr (ComputePipelineCreateInfo es)
-> IO (ComputePipelineCreateInfo es)
peekCStruct Ptr (ComputePipelineCreateInfo es)
p = do
pNext <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (ComputePipelineCreateInfo es)
p Ptr (ComputePipelineCreateInfo es) -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
next <- peekChain (castPtr pNext)
flags <- peek @PipelineCreateFlags ((p `plusPtr` 16 :: Ptr PipelineCreateFlags))
stage <- peekSomeCStruct (forgetExtensions ((p `plusPtr` 24 :: Ptr (PipelineShaderStageCreateInfo _))))
layout <- peek @PipelineLayout ((p `plusPtr` 72 :: Ptr PipelineLayout))
basePipelineHandle <- peek @Pipeline ((p `plusPtr` 80 :: Ptr Pipeline))
basePipelineIndex <- peek @Int32 ((p `plusPtr` 88 :: Ptr Int32))
pure $ ComputePipelineCreateInfo
next flags stage layout basePipelineHandle basePipelineIndex
instance es ~ '[] => Zero (ComputePipelineCreateInfo es) where
zero :: ComputePipelineCreateInfo es
zero = Chain es
-> PipelineCreateFlags
-> SomeStruct PipelineShaderStageCreateInfo
-> PipelineLayout
-> Pipeline
-> Int32
-> ComputePipelineCreateInfo es
forall (es :: [*]).
Chain es
-> PipelineCreateFlags
-> SomeStruct PipelineShaderStageCreateInfo
-> PipelineLayout
-> Pipeline
-> Int32
-> ComputePipelineCreateInfo es
ComputePipelineCreateInfo
()
PipelineCreateFlags
forall a. Zero a => a
zero
(PipelineShaderStageCreateInfo '[]
-> SomeStruct PipelineShaderStageCreateInfo
forall (a :: [*] -> *) (es :: [*]).
(Extendss a es, PokeChain es, Show (Chain es)) =>
a es -> SomeStruct a
SomeStruct PipelineShaderStageCreateInfo '[]
forall a. Zero a => a
zero)
PipelineLayout
forall a. Zero a => a
zero
Pipeline
forall a. Zero a => a
zero
Int32
forall a. Zero a => a
zero