Skip to content

Releases: gnlow/lilgpu

0.2.0-alpha.2

29 May 08:16

Choose a tag to compare

0.2.0-alpha.2 Pre-release
Pre-release
feat: topology option

0.2.0-alpha.1

29 May 06:07

Choose a tag to compare

0.2.0-alpha.1 Pre-release
Pre-release
feat: split renderPipeline and computePipeline

0.2.0-alpha.0

26 May 15:05

Choose a tag to compare

0.2.0-alpha.0 Pre-release
Pre-release
make able to init without canvas

0.1.2

22 May 13:27

Choose a tag to compare

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.3
    • 0.5.4-0.5.7 occurs runtime error

0.1.1

29 Jan 05:08

Choose a tag to compare

Fix

  • can't animate (browser)

0.1.0

21 Jan 17:32

Choose a tag to compare

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())