Progress
It’s buggy as hell right now but I’ve been working on a new way (for cepl) to write and compose shaders.
You now write gpu functions and compose them using defpipeline, the gpu functions can be used as stages or as regular functions and varjo will compile them correctly for each task. We also have lost explicit return in favour of implicit tail returns, just like in regular common lisp.
A quick code sample
(defun-g v ((vert g-pc))
(values (v! (cgl:pos vert) 1.0)
(:smooth (cgl:col vert))))
(defun-g f ((color :vec4))
color)
(defpipeline prog-1 (g-> v f))
Compiles to
// vertex shader
#version 330
layout(location = 0) in vec3 fk_vert_position;
layout(location = 1) in vec4 fk_vert_color;
smooth out vec4 out_86v;
void main() {
vec4 return1;
vec4 v_tmp_83v_84v = vec4(fk_vert_position,1.0f);
return1 = fk_vert_color;
gl_Position = v_tmp_83v_84v;
out_86v = return1;
}
// fragment shader
#version 330
in vec4 out_86v;
layout(location = 0) out vec4 output_color_87v;
void main() {
output_color_87v = out_86v;
}