| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Utils.RenderPass
Contents
Description
The classic render-pass drawing path: a RenderPass over one or more
colour attachments (and an optional depth attachment), framebuffers over the
swapchain image views, and a vanilla pipeline that targets the render pass.
This is one of two self-contained alternatives — see
Vulkan.Utils.DynamicRendering for the VK_KHR_dynamic_rendering path, which
needs neither a render pass nor framebuffers. Pick one and import only it.
Synopsis
- allocateRenderPass :: MonadResource m => Device -> Vector (Format, ImageLayout) -> Maybe Format -> m (ReleaseKey, RenderPass)
- allocateColorRenderPass :: MonadResource m => Device -> Format -> ImageLayout -> m (ReleaseKey, RenderPass)
- data PipelineConfig = PipelineConfig {
- colorFormats :: [Format]
- depthFormat :: Maybe Format
- vertexInput :: PipelineVertexInputStateCreateInfo ('[] :: [Type])
- dynamicStates :: Maybe (Vector DynamicState)
- layout :: Maybe PipelineLayout
- allocatePipeline :: (MonadResource m, MonadFail m) => Device -> RenderPass -> PipelineConfig -> Vector (SomeStruct PipelineShaderStageCreateInfo) -> m (ReleaseKey, Pipeline)
- allocatePipelineFromShaders :: (MonadResource m, MonadUnliftIO m, MonadFail m, Specialization spec) => Device -> RenderPass -> PipelineConfig -> spec -> [(ShaderStageFlagBits, ByteString)] -> m (ReleaseKey, Pipeline)
Render pass
Arguments
| :: MonadResource m | |
| => Device | |
| -> Vector (Format, ImageLayout) | Colour attachments: |
| -> Maybe Format | Optional depth attachment format. |
| -> m (ReleaseKey, RenderPass) |
A render pass with colors colour attachments (each (format, finalLayout))
and an optional depth attachment, all cleared on load and stored on completion, in
a single graphics subpass. Attachment indices are the colours 0..N-1 then the
depth attachment at N — the colour-then-depth order the framebuffer's
attachments must follow. The external
dependency synchronizes colour output and, when present, the
depth fragment tests.
allocateColorRenderPass Source #
Arguments
| :: MonadResource m | |
| => Device | |
| -> Format | Color attachment format. |
| -> ImageLayout | Final layout. |
| -> m (ReleaseKey, RenderPass) |
The single-colour render pass: one attachment cleared on load and stored,
ending in finalLayout (e.g. PRESENT_SRC_KHR for swapchains,
TRANSFER_SRC_OPTIMAL for offscreen images). The common special case of
allocateRenderPass.
Pipeline
data PipelineConfig Source #
Attachment + fixed-function knobs for a render-pass pipeline.
Construct with zero and override what differs, e.g.
zero { RenderPass.colorFormats = [fmt], RenderPass.depthFormat = Just d }. The
attachment shape — colorFormats count and whether depthFormat is present — MUST
match the render pass; the formats themselves live in the render pass, so only the
count and depth presence are read here.
Constructors
| PipelineConfig | |
Fields
| |
Instances
| Zero PipelineConfig Source # | |
Defined in Vulkan.Utils.RenderPass Methods | |
allocatePipeline :: (MonadResource m, MonadFail m) => Device -> RenderPass -> PipelineConfig -> Vector (SomeStruct PipelineShaderStageCreateInfo) -> m (ReleaseKey, Pipeline) Source #
A vanilla vertex+fragment pipeline targeting renderPass (subpass 0). The
PipelineConfig attachment shape MUST match renderPass. Whatever dynamic state
is selected MUST be set before drawing. Intended to be used qualified, e.g.
RenderPass.allocatePipeline.
allocatePipelineFromShaders Source #
Arguments
| :: (MonadResource m, MonadUnliftIO m, MonadFail m, Specialization spec) | |
| => Device | |
| -> RenderPass | |
| -> PipelineConfig | |
| -> spec | Specialization shared by every stage; |
| -> [(ShaderStageFlagBits, ByteString)] | |
| -> m (ReleaseKey, Pipeline) |
allocatePipeline from (stage, SPIR-V) pairs: compile each into a shader
module, build the pipeline, then release the now-redundant module handles.
spec is one specialization shared by every stage (see
Specialization); pass () for none.