Skip to content
rookboom edited this page Nov 13, 2012 · 67 revisions

####SharpShaders - A library for crafting GPU shader code in F#.

ColoredCube Golfball Marbled Lumpy Crinkled

####Why write shaders in F#?

####The Secret Sauce: Code Quotations ####Examples

####Future Work

  • Runtime code compilation
    • It should be possible to edit an F# shader and immediately see the result at runtime (if the changed shader compiles of course)
  • Geometry, Hull, Domain, Compute Shaders
  • Dynamic Shader Linking
    • The Dynamic attribute on shader functions should indicate that this function can be swapped at runtime
[<Dynamic>]
let marble = ...
[<Dynamic>]
let lumpy = ...
[<Dynamic>]
let crinkled = ...

let mutable surface = marble

[<PixelShader>]
member m.pixel(input:PSInput) =
    surface input

At runtime the surface shader can be swapped:

ps.surface <- ps.crinkled
Clone this wiki locally