tinyest-for-wgsl
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-alpha.2 • Public • Published

tinyest-for-wgsl

Transforms JavaScript into its 'tinyest' form, to be used in generating equivalent (or close to) WGSL code. Used by TypeGPU to allow for shaders to be written in JS.

Basic principles

tinyest-for-wgsl is responsible for transforming JS function bodies of TypeGPU declarations (e.g., tgpu.fn) into an embeddable syntax tree, gathering external names outside of the scope of the function.

`(a, b) => {
  return a + b + double(a);
}`

This can then be used to generate the following Embeddable Syntax Tree:

// Can be injected with a simple JSON.stringify of a value that can be computed in the Rollup plugin.
{b:[{r:{x:[{x:['a','+','b']},'+',{f:['double',['a']]}]}}]}

/tinyest-for-wgsl/

    Package Sidebar

    Install

    npm i tinyest-for-wgsl

    Weekly Downloads

    104

    Version

    0.1.0-alpha.2

    License

    MIT

    Unpacked Size

    49.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • iwoplaza
    • mhawryluk
    • reczkok