| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Utils.Pipeline.Internal
Description
Shared graphics-pipeline construction behind the two rendering paths, Vulkan.Utils.RenderPass and Vulkan.Utils.DynamicRendering. Not meant for direct use — import one of those modules instead.
The only difference between the paths is whether the pipeline references a
RenderPass or carries a PipelineRenderingCreateInfo in its pNext chain,
so everything else (the vanilla rasterizerblenddynamic-state config, the
transient empty layout, the shader-module lifetime) lives here once.
Synopsis
- basePipelineCreateInfo :: PipelineLayout -> Maybe RenderPass -> Int -> Bool -> PipelineVertexInputStateCreateInfo ('[] :: [Type]) -> Vector DynamicState -> Vector (SomeStruct PipelineShaderStageCreateInfo) -> GraphicsPipelineCreateInfo ('[] :: [Type])
- buildColorPipeline :: (MonadResource m, MonadFail m) => Device -> Maybe PipelineLayout -> (PipelineLayout -> SomeStruct GraphicsPipelineCreateInfo) -> m (ReleaseKey, Pipeline)
- withCompiledStages :: (MonadResource m, MonadUnliftIO m, Specialization spec) => Device -> spec -> [(ShaderStageFlagBits, ByteString)] -> (Vector (SomeStruct PipelineShaderStageCreateInfo) -> m a) -> m a
Documentation
basePipelineCreateInfo Source #
Arguments
| :: PipelineLayout | |
| -> Maybe RenderPass | |
| -> Int | Colour attachment count (blend attachments); |
| -> Bool | Whether a depth attachment is present. |
| -> PipelineVertexInputStateCreateInfo ('[] :: [Type]) | Vertex input (bindings + attributes); |
| -> Vector DynamicState | |
| -> Vector (SomeStruct PipelineShaderStageCreateInfo) | |
| -> GraphicsPipelineCreateInfo ('[] :: [Type]) |
The shared body of the vanilla graphics pipeline: the given dynamicStates,
colorAttachmentCount identical non-blended color attachments, an optional
depth-stencil state, and empty vertex input. The static values left in the
create-info (cull mode, topology, …) are the baked defaults for any state not
listed dynamic; states that are listed dynamic ignore them, so callers MUST emit
the matching cmdSet* before drawing.
The colour and depth shape MUST match the attachments the pipeline renders to —
the render pass (render-pass path) or the PipelineRenderingCreateInfo formats
(dynamic-rendering path):
colorAttachmentCount == 0omitscolorBlendStateentirely (a depth-only pipeline); otherwise one RGBA, non-blended attachment per colour target.depthadds a zeroeddepthStencilState— present (non-NULL) is required whenever a depth attachment is used; the actual test config is dynamic, so a zeroed struct is correct.
Pass Just the target render pass (render-pass path), or Nothing and attach
a PipelineRenderingCreateInfo to the returned struct's pNext chain
(dynamic-rendering path).
buildColorPipeline :: (MonadResource m, MonadFail m) => Device -> Maybe PipelineLayout -> (PipelineLayout -> SomeStruct GraphicsPipelineCreateInfo) -> m (ReleaseKey, Pipeline) Source #
Build a single graphics pipeline from the given create-info builder. With
Nothing, a transient empty pipeline layout is allocated and freed after the
build (the historical behaviour: no descriptor sets, no push constants); with
Just layout, the caller's layout is used and remains owned (and kept alive)
by the caller. The returned ReleaseKey frees the pipeline.
withCompiledStages :: (MonadResource m, MonadUnliftIO m, Specialization spec) => Device -> spec -> [(ShaderStageFlagBits, ByteString)] -> (Vector (SomeStruct PipelineShaderStageCreateInfo) -> m a) -> m a Source #
Compile each (stage, SPIR-V) pair into a shader module, run the
continuation with the resulting stages, then release the now-redundant
module handles. Shader modules are only needed during pipeline creation, so
the continuation typically returns the built pipeline.