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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Modulevulkan-utils-0.5.11.0Haskell2010

Vulkan.Utils.Pipeline.Specialization

Specialization constants, normalized to stacks of 32-bit units.

data MySpec = MySpec { width :: Word32, height :: Word32, scale :: Float }
instance Specialization MySpec where -- ... pack the fields

withSpecialization sp \mSpec ->
  -- build a Vulkan.Core10.PipelineShaderStageCreateInfo with
  --   specializationInfo = mSpec
  ...
  • 2 classes
  • 2 values
valuewithSpecialization
  1. :: (Specialization spec, MonadUnliftIO m)
  2. => spec
  3. -> Maybe SpecializationInfo -> m a
  4. -> m a
#

Provide a SpecializationInfo describing spec to the callback.

The info (and the buffer its data' pointer references) is valid only for the duration of the callback, which is exactly the window in which it needs to live: pipeline creation copies the constant values out. Build and create the pipeline inside the continuation.

An empty specialization (e.g. () or an empty list) yields Nothing, so the shader stage's specializationInfo stays unset.

classclass Specialization a where
#

A value that flattens to a stack of 32-bit specialization constants, in constant_id order starting from zero.

Methods

Instances11Specialization, …
classclass SpecializationConst a where
#

A single scalar specialization constant, reinterpreted into its 32-bit representation.

Per the GL_KHR_vulkan_glsl spec a constant_id may only decorate a scalar int, float or bool; uint works in practice too. All of these are 32 bits wide.

Methods

Instances4SpecializationConst