Yet Another Shading Language.
A strong typed functional(not really) IR that compiles to GLSL.
See doc for syntax definition.
WARN
This is a demo project at very early stage. The code generation logic only works with primitive data and structs, GLSL opaque types like
sampler
are not supported.The compiler only emits fragment shader and we provide a shader toy style viewer.
- OCaml 4.11
- C++ 17
- Python 3
git clone https://github.com/huisedenanhai/YASL.git
To build the YASL to GLSL compiler
cd compiler
dune build
To build the viewer
First update dependencies
cd viewer/third_party/shaderc/utils
python3 git-sync-deps
Then build the viewer project with default cmake options
Compile YASL to GLSL
yasl [-ast] filename [-o output]
-ast dump ast
-o set output file name
-help Display this list of options
--help Display this list of options
Default output name is filename.gen.frag
Then feed the compiled fragment shader to the viewer
viewer filename.gen.frag
Sample YASL prorgams are in compiler/samples
.
If one does correctly for the sample fractal.ysl
, a fractal shape will be shown in the viewer.
The viewer provides following uniforms
uniform iTime: float /* Time from start */
uniform iResolution: vec2 /* Screen resolution */