Skip to content

v0.3.0

Compare
Choose a tag to compare
@sockmaster27 sockmaster27 released this 27 Sep 11:52
· 166 commits to master since this release

Changes

WGSL entrypoint changed from fragmentMain to main

Example

@group(0) @binding(0) var<uniform> resolution: vec2f;
@group(0) @binding(1) var<uniform> offset: vec2f;

@fragment
- fn fragmentMain(@builtin(position) raw_pos: vec4f) -> @location(0) vec4f {
+ fn main(@builtin(position) raw_pos: vec4f) -> @location(0) vec4f {
    let pos = raw_pos.xy + offset;
    let st = pos / resolution;
    return vec4f(st, 0.0, 1.0);
}

WebGPU parameter type is changed to optional storage flag

Example

<WebGpuFragmentShader
    width="500px"
    height="500px"
    code={shaderCode}
    parameters={[
        {
            label: "Resolution",
            binding: 0,
-           type: "uniform",
            data: "resolution",
        },
        {
            label: "Offset",
            binding: 1,
-           type: "storage",
+           storage: true,
            data: "offset",
        },
    ]}
 >
</WebGpuFragmentShader>

Drop support for fadeInDuration for all components

Example

<WebGpuFragmentShader
-   fadeInDuration=5
    width="500px"
    height="500px"
    code={shaderCode}
    parameters={[
        {
            label: "Resolution",
            binding: 0,
            data: "resolution",
        },
        {
            label: "Offset",
            binding: 1,
            data: "offset",
        },
    ]}
 >
</WebGpuFragmentShader>

Support dynamically sized storage buffers in WebGPU

When passing in a storage buffer as a parameter to a WebGPU shader, the buffer will now be reallocated when the data changes its size.

Support passing in readonly parameter list

Fixes the type declarations, such that it's now possible to pass in a parameter list marked as readonly when using TypeScript.

Fixes

Both WebGPU and WebGL shaders will now explicitly destroy their resources when the component is dismounted.