-
Notifications
You must be signed in to change notification settings - Fork 11
Home
Johan Verwey edited this page May 24, 2018
·
67 revisions
- [Higher order functions] (wiki/Why-write-shaders-in-F%23%3F)
- Targeting multiple platforms
- Code Sharing
- Unit Testing
- Syntactic sugar
- Because it's FUN!
SharpShaders is still in its infancy and there are many F# features which cannot be translated to HLSL yet. Keep in mind though that the hardware architecture of GPUs have some limitations of its own. Even something as simple as an if then else statement is expensive on GPUs. For this reason, advanced F# features such as such as pattern matching will probably not be supported any time soon.
- Runtime code compilation
- It should be possible to edit an F# shader and immediately see the result at runtime.
- Geometry, Hull, Domain, Compute Shaders
- Translate tail recursive functions into while statements.
- Dynamic Shader Linking
- The Dynamic attribute on shader functions should indicate that this function can be swapped at runtime
let marble = ...
let lumpy = ...
let crinkled = ...
[<Dynamic>]
member m.surface = marble
[<PixelShader>]
member m.pixel(input:PSInput) =
surface input
At runtime the surface shader can be swapped:
ps.surface <- ps.crinkled