Skip to content

Instantly share code, notes, and snippets.

@falsycat
Created August 22, 2021 02:52
Show Gist options
  • Save falsycat/1ae3f31e431e281defba63487f2302eb to your computer and use it in GitHub Desktop.
Save falsycat/1ae3f31e431e281defba63487f2302eb to your computer and use it in GitHub Desktop.
#version 330
#extension GL_ARB_explicit_uniform_location : enable
out vec4 o_color;
void main(void) {
o_color = vec4(1.);
}
local glp = ctx.pathfind("/home/a.glp"):await();
local lk = ctx.pathfind("/sys/upd.graphics.gl3.pipeline.linker"):await();
local lk_stream = ctx.req.prog.exec(lk:lock():await()):await():lockEx():await();
ctx.req.dstream.write(lk_stream, std.msgpack.pack({
target = glp:id(),
}, {})):await();
local tex = 0
while tex == 0 do
local raw = ctx.req.dstream.read(lk_stream):await();
local result = std.msgpack.unpack(raw);
if result then
tex = (result.output and result.output.OUT) or 0;
ctx.send("target: "..tex.."\n")
if tex == 0 then
ctx.send("linker error\n")
return
end
end
ctx.sleep(1000)
end
local view = ctx.pathfind("/sys/upd.graphics.gl3.view"):await();
local view_stream = ctx.req.prog.exec(view:lock():await()):await():lockEx():await();
ctx.req.dstream.write(view_stream, std.msgpack.pack({
interface = "encoder",
command = "init",
param = {
utimeDen = 1,
utimeNum = 1,
}
}, {
interface = "encoder",
command = "frame",
param = {
time = 1,
file = tex,
}
})):await();
ctx.send("done!")
ctx.sleep(10000)
ctx.send("bye!")
lk_stream:teardown();
view_stream:teardown();
#version 330
#extension GL_ARB_explicit_uniform_location : enable
const vec2[] vert_ = vec2[](
vec2(-1., 1.),
vec2( 0., 0.),
vec2( 0., 1.)
);
void main(void) {
gl_Position = vec4(vert_[gl_VertexID], 0., 1.);
}
in: {}
out:
OUT: [4, 32, 32]
fb:
FB:
color0: OUT
va:
VA: {}
step:
- draw : TRIANGLES
va : VA
dst : FB
count : 3
viewport: [32, 32]
uni : {}
shader :
- /home/a.vsh
- /home/a.fsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment