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

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

Modulevulkan-utils-0.5.11.0Haskell2010

Vulkan.Utils.ShaderQQ.HLSL.Glslang

  • 17 values
valuehlsl :: QuasiQuoter
#

hlsl is a QuasiQuoter which produces HLSL source code with a #line directive inserted so that error locations point to the correct location in the Haskell source file. It also permits basic string interpolation.

  • Interpolated variables are prefixed with $

  • They can optionally be surrounded with braces like ${foo}

  • Interpolated variables are converted to strings with show

  • To escape a $ use \$

It is intended to be used in concert with compileShaderQ like so

myConstant = 3.141 -- Note that this will have to be in a different module
myFragmentShader = $(compileShaderQ Nothing "frag" (Just "main") [hlsl|
  static const float myConstant = ${myConstant};
  float main (){
    return myConstant;
  }
|])

An explicit example (interactive is from doctest):

Example1 expression
let foo = 450 :: Int in [hlsl|const float foo = $foo|]"#line ... \"<interactive>\"\nconst float foo = 450"

Note that line number will be thrown off if any of the interpolated variables contain newlines.

valuecomp :: QuasiQuoter
#

QuasiQuoter for creating a compute shader.

Equivalent to calling $(compileShaderQ Nothing "comp" (Just "main") [hlsl|...|]) without interpolation support.

valuefrag :: QuasiQuoter
#

QuasiQuoter for creating a fragment shader.

Equivalent to calling $(compileShaderQ Nothing "frag" (Just "main") [hlsl|...|]) without interpolation support.

valuegeom :: QuasiQuoter
#

QuasiQuoter for creating a geometry shader.

Equivalent to calling $(compileShaderQ Nothing "geom" (Just "main") [hlsl|...|]) without interpolation support.

valuetesc :: QuasiQuoter
#

QuasiQuoter for creating a tessellation control shader.

Equivalent to calling $(compileShaderQ Nothing "tesc" (Just "main") [hlsl|...|]) without interpolation support.

valuetese :: QuasiQuoter
#

QuasiQuoter for creating a tessellation evaluation shader.

Equivalent to calling $(compileShaderQ Nothing "tese" (Just "main") [hlsl|...|]) without interpolation support.

valuevert :: QuasiQuoter
#

QuasiQuoter for creating a vertex shader.

Equivalent to calling $(compileShaderQ Nothing "vert" (Just "main") [hlsl|...|]) without interpolation support.

valuergen :: QuasiQuoter
#

QuasiQuoter for creating a ray generation shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rgen" (Just "main") [hlsl|...|]) without interpolation support.

valuerint :: QuasiQuoter
#

QuasiQuoter for creating an intersection shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rint" (Just "main") [hlsl|...|]) without interpolation support.

valuerahit :: QuasiQuoter
#

QuasiQuoter for creating an any-hit shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rahit" (Just "main") [hlsl|...|]) without interpolation support.

valuerchit :: QuasiQuoter
#

QuasiQuoter for creating a closest hit shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rchit" (Just "main") [hlsl|...|]) without interpolation support.

valuermiss :: QuasiQuoter
#

QuasiQuoter for creating a miss shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rmiss" (Just "main") [hlsl|...|]) without interpolation support.

valuercall :: QuasiQuoter
#

QuasiQuoter for creating a callable shader.

Equivalent to calling $(compileShaderQ (Just "spirv1.4") "rcall" (Just "main") [hlsl|...|]) without interpolation support.

valuetask :: QuasiQuoter
#

QuasiQuoter for creating a task shader.

Equivalent to calling $(compileShaderQ Nothing "task" (Just "main") [hlsl|...|]) without interpolation support.

valuemesh :: QuasiQuoter
#

QuasiQuoter for creating a mesh shader.

Equivalent to calling $(compileShaderQ Nothing "mesh" (Just "main") [hlsl|...|]) without interpolation support.

valuecompileShaderQ
  1. :: Maybe String

    Argument to pass to `--target-env`

  2. -> String

    stage

  3. -> Maybe String

    Argument name to pass to `-e name` to specify entry-point function name

  4. -> String

    hlsl shader code

  5. -> Q Exp

    Spir-V bytecode

#

Compile a HLSL shader to spir-v using glslangValidator.

Messages are converted to GHC warnings or errors depending on compilation success.