Eventually I would like to include a post effect / shader system into the the drawing API.
May look something like the following:
var myShader = new Shader(Files.OpenStream(...));
myShader.Set("thickness", 2);
...
ctx.Shader = myShader;
ctx.Draw(...)
Ideally the shader source will be GLSL or some simplistic DSL language. In either case, restrictions are placed on the shader for vertex input and texture systems. A DSL may be more complicated to implement, but I feel may make the act of writing shaders simpler. An additional benefit may be the DSL parser can emit GLSL, HLSL or Spir-V or whatever is consumed by the target platform.
simple.shader
Image image;
Color color;
Color frag_main(Vector uv) {
return sampleImage(image, uv) * color;
}
The other option is to use an augmented version of GLSL with restrictions / requirements.
default.vert
#include "standard/standard.vert"
vec2 vert_main(vec2 position)
{
// Simply forward vertex position
return position;
}
default.frag
#include "standard/standard.frag"
vec4 frag_main(in vec2 uv)
{
// Simply sample image
return sampleImage(uv);
}