| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Utils.DynamicRendering
Description
The VK_KHR_dynamic_rendering (Vulkan 1.3 core) drawing path: no
RenderPass and no framebuffers. The swapchain image's layout transitions
are handled by explicit pipeline barriers, and the rendering region is opened
with cmdUseRendering against a RenderingInfo pointing straight at an
image view. The pipeline carries a PipelineRenderingCreateInfo instead of a
render pass.
This is one of two self-contained alternatives — see Vulkan.Utils.RenderPass
for the classic path. Pick one and import only it. Callers must have enabled
the dynamicRendering feature on the device.
Synopsis
- data PipelineConfig = PipelineConfig {
- colorFormats :: [Format]
- depthFormat :: Maybe Format
- vertexInput :: PipelineVertexInputStateCreateInfo ('[] :: [Type])
- dynamicStates :: Maybe (Vector DynamicState)
- layout :: Maybe PipelineLayout
- allocatePipeline :: (MonadResource m, MonadFail m) => Device -> PipelineConfig -> Vector (SomeStruct PipelineShaderStageCreateInfo) -> m (ReleaseKey, Pipeline)
- allocatePipelineFromShaders :: (MonadResource m, MonadUnliftIO m, MonadFail m, Specialization spec) => Device -> PipelineConfig -> spec -> [(ShaderStageFlagBits, ByteString)] -> m (ReleaseKey, Pipeline)
- dynamicRenderingRequirements :: [DeviceRequirement]
- colorAttachmentRenderingInfo :: Rect2D -> ImageView -> ClearColorValue -> RenderingInfo ('[] :: [Type])
- renderingInfo :: Rect2D -> Vector (ImageView, ClearColorValue) -> Maybe (ImageView, Float) -> RenderingInfo ('[] :: [Type])
Pipeline
data PipelineConfig Source #
Attachment + fixed-function knobs for a dynamic-rendering pipeline.
Construct with zero and override what differs, e.g.
zero { Dynamic.colorFormats = [fmt], Dynamic.depthFormat = Just d }.
Constructors
| PipelineConfig | |
Fields
| |
Instances
| Zero PipelineConfig Source # | |
Defined in Vulkan.Utils.DynamicRendering Methods | |
allocatePipeline :: (MonadResource m, MonadFail m) => Device -> PipelineConfig -> Vector (SomeStruct PipelineShaderStageCreateInfo) -> m (ReleaseKey, Pipeline) Source #
Build a graphics pipeline for the dynamic-rendering path: no render pass, the
attachment formats carried in a PipelineRenderingCreateInfo on the pNext chain.
The attachment shape — colorFormats and depthFormat — selects the pipeline kind:
[fmt]+Nothing— a single-colour pipeline (as the classic path).[fmt]+Just d— colour + depth (depth driven dynamically).[]+Just d— depth-only (e.g. a shadow map / z-prepass).[f0, f1, …]— multiple colour attachments (MRT / G-buffer).
Stencil is out of scope: no stencilAttachmentFormat is declared, matching
renderingInfo, which never supplies a stencil attachment (declaring one
without supplying it is invalid at draw time). For stencil, build the
PipelineRenderingCreateInfo and RenderingInfo by hand. The formats MUST
match the views passed to cmdUseRendering at draw time (see renderingInfo).
Intended to be used qualified, e.g. Dynamic.allocatePipeline.
allocatePipelineFromShaders Source #
Arguments
| :: (MonadResource m, MonadUnliftIO m, MonadFail m, Specialization spec) | |
| => Device | |
| -> PipelineConfig | |
| -> spec | Specialization shared by every stage (see Vulkan.Utils.Pipeline.Specialization); |
| -> [(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.
Device requirements
dynamicRenderingRequirements :: [DeviceRequirement] Source #
The device requirements for this path: the VK_KHR_dynamic_rendering
extension (core since Vulkan 1.3) and the dynamicRendering feature it gates.
Use it directly as — or append it to — a consumer's device requirements (e.g.
WindowedBoot's wcDeviceReqs) so callers need not spell out the feature.
Rendering
colorAttachmentRenderingInfo Source #
Arguments
| :: Rect2D | Render area (typically the full swapchain extent). |
| -> ImageView | Target color attachment view. |
| -> ClearColorValue | Clear color applied by the |
| -> RenderingInfo ('[] :: [Type]) |
A RenderingInfo targeting a single color attachment that is cleared
on load and stored on completion. The attachment is expected to already be in
IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL (e.g. via
transitionColorAttachment). The single-colour special
case of renderingInfo.
Arguments
| :: Rect2D | Render area (typically the full swapchain extent). |
| -> Vector (ImageView, ClearColorValue) | Colour attachment views with the clear colour applied by |
| -> Maybe (ImageView, Float) | Optional depth attachment view with the clear depth applied by |
| -> RenderingInfo ('[] :: [Type]) |
A RenderingInfo over any number of colour attachments plus an optional
depth attachment, each cleared on load and stored on completion. Colour
attachments are expected in IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL and the depth
attachment in IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL (e.g. via
transitionColorAttachment /
transitionDepthAttachment). The attachment shape MUST
match the pipeline (allocatePipeline). No stencil attachment is supplied,
matching allocatePipeline never declaring one.