Skip to content

Releases: CodyJasonBennett/shaderkit

v0.3.1

13 Feb 05:22

Choose a tag to compare

What's Changed

Full Changelog: v0.3.0...v0.3.1

v0.3.0

13 Feb 04:37

Choose a tag to compare

What's Changed

This release includes a rewrite to the AST parser and generator, with minor fixes to the tokenizer and minifier (note this will be rewritten once WGSL AST is implemented #21).

Both GLSL and WGSL are supported by the tokenizer and minifier, but only GLSL is supported so far by the parser and generator (#20).

This enables code modification and reflection of GLSL programs, although a visitor API does not yet exist, and AST nodes must be manually recursed.

import { type Program, parse, generate } from 'shaderkit'

// https://github.com/CodyJasonBennett/shaderkit#ast
const program: Program = parse(glsl)

// optionally reflect program here (e.g. collect all global uniforms)
const uniforms: string[] = []
for (const node of program.body) {
  if (node.type === 'VariableDeclaration') {
    for (const declaration of node.declarations) {
      if (declaration.qualifiers.includes('uniform') {
        uniforms.push(declaration.id.name)
      }
    }
  }
}

// optionally modify program here (e.g. remove version header)
if (program.body[0].type === 'PreprocessorStatement') program.body.shift()

// Compile back into GLSL
const output: string = generate(program, { target: 'GLSL' })

Full Changelog: v0.2.1...v0.3.0

v0.2.1

26 Dec 09:18

Choose a tag to compare

What's Changed

Full Changelog: v0.2.0...v0.2.1

v0.2.0

21 Nov 14:20

Choose a tag to compare

What's Changed

Full Changelog: v0.1.14...v0.2.0

v0.1.14

08 Nov 08:58

Choose a tag to compare

What's Changed

Full Changelog: v0.1.13...v0.1.14

v0.1.13

07 Nov 19:22

Choose a tag to compare

What's Changed

Full Changelog: v0.1.12...v0.1.13

v0.1.12

07 Nov 18:06

Choose a tag to compare

What's Changed

Full Changelog: v0.1.11...v0.1.12

v0.1.11

06 Nov 07:58

Choose a tag to compare

What's Changed

Full Changelog: v0.1.10...v0.1.11

v0.1.10

20 Jun 06:35

Choose a tag to compare

What's Changed

Full Changelog: v0.1.9...v0.1.10

v0.1.9

04 Apr 06:20

Choose a tag to compare

What's Changed

Full Changelog: v0.1.8...v0.1.9