HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulevulkan-utils-0.5.11.0Haskell2010

Vulkan.Utils.DynamicState

The Vulkan-1.3-core "always-on" dynamic state: the set of pipeline state that can be made dynamic without any vendor or experimental extension, so a single pipeline object serves every combination instead of permuting into one Pipeline per variation. See allocatePipeline and allocatePipeline.

Because these states are declared dynamic, the matching cmdSet* MUST be issued before each draw (an unset dynamic state is undefined behaviour). The DynamicState record carries the whole set with safe defaults; amend it with the per-frame situation (the swapchain extent via dynamicStateFor) and emit the lot in one go with applyDynamicStates over allDynamicStates.

Defaults mirror Vulkan's zero-initialized values, deviating only where a non-zero is required for validity (lineWidth = 1) or to match the pipeline's baked topology class (topology = TRIANGLE_LIST). They are feature-free (no wideLines, no depthBounds) and valid with a colour-only attachment (all depth/stencil tests disabled).

  • 1 type
  • 13 values

The dynamic-state record

3 declarations
datadata DynamicState
#

Every Vulkan-1.3-core always-on dynamic state, as plain values. Field types match the cmdSet* argument shapes. The stencil ops apply to STENCIL_FACE_FRONT_AND_BACK.

Applying it

1 declaration

The state set (pipeline dynamicStates ⇆ apply, single source of truth)

8 declarations

Declare nothing dynamic: every state is baked into the pipeline, so no cmdSet* need be issued (skip applyDynamicStates entirely). Pass it where a builder takes Maybe (Vector Vk.DynamicState).

The pipeline must then carry a complete static state — crucially a baked viewport and scissor — so this suits a builder that bakes those (typically a fixed-size offscreen target). The colour-pipeline builders here instead leave viewport and scissor dynamic, so they pair with Nothing / allDynamicStates, not this.

Whole-extent viewport/scissor

2 declarations