Releases: gnlow/lilgpu
Releases · gnlow/lilgpu
0.2.0-alpha.2
feat: topology option
0.2.0-alpha.1
feat: split renderPipeline and computePipeline
0.2.0-alpha.0
make able to init without canvas
0.1.2
feat
Define program using class extension
import { d, Lil, uniform } from "https://esm.sh/gh/gnlow/lilgpu/browser.ts"
class MyProgram extends Lil {
vertShader = `... GLSL code ...`
fragShader = `... GLSL code ...`
@uniform(d.struct({
x: d.u32,
y: d.u32,
}))
accessor span = { x: 10, y: 20 }
@uniform(d.f32)
accessor blue = 0.5
}
const app = new MyProgram()
const g = await app.init(document.querySelector("canvas")!)
g.draw(4 /* The number of vertices */)
const tick = () => new Promise(requestAnimationFrame)
while (true) {
await tick()
basic.blue = Math.sin(Date.now()/1000)/2+0.5
g.draw(4)
}dependency
- Update
typegpu@0.3.2->0.5.30.5.4-0.5.7occurs runtime error
0.1.1
0.1.0
import { initCanvas, d } from "https://esm.sh/gh/gnlow/lilgpu@0.1.0/browser.ts"
const g = await initCanvas({
vertShader: `
@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
let x = f32(i32(in_vertex_index) - 1);
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
return vec4<f32>(x, y, 0.0, 1.0);
}
`,
fragShader: `
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
`,
canvas: document.querySelector("canvas"),
})
g.draw(3)import { initDeno, d } from "https://esm.sh/gh/gnlow/lilgpu@0.1.0/deno.ts"
const g = await initDeno({
vertShader: `
@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
let x = f32(i32(in_vertex_index) - 1);
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
return vec4<f32>(x, y, 0.0, 1.0);
}
`,
fragShader: `
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
`,
width: 200,
height: 200,
})
g.draw(3)
await Deno.writeFile("./triangle.png", await g.getImage())