vulkan-utils-0.5.0: Utils for the vulkan package
Safe HaskellNone
LanguageHaskell2010

Vulkan.Utils.ShaderQQ.HLSL

Synopsis

Documentation

hlsl :: QuasiQuoter Source #

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 \$

An explicit example (interactive is from doctest):

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

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