Skip to content

Releases: software-mansion/TypeGPU

typegpu v0.11.4, @typegpu/react (+more)

12 May 10:19
9d62851

Choose a tag to compare

typegpu v0.11.4

🚀 Features

Low-level array buffer manipulation APIs

The functions previously used internally by buffer.write, buffer.patch and buffer.write APIs are now exposed, allowing you to read from and write into ArrayBuffers using TypeGPU schemas. More about this here.

const buffer = new ArrayBuffer(d.sizeOf(Boid));

// update entire buffer
writeToArrayBuffer(buffer, Boid, { pos: d.vec3f(1, 2, 3), vel: d.vec3f(0, 1, 0) });

// patch just the velocity
patchArrayBuffer(buffer, Boid, { vel: d.vec3f(0, 0, 1) });

// read
const boid = readFromArrayBuffer(buffer, Boid);

Resolution errors now hint at solutions referring to original source code

There is JavaScript code that we restrict users from writing, and when we detect such a case, we throw a descriptive error of what was done incorrectly, and how to fix it. Up until now, those hints referred to the generated WGSL code, but that was sometimes hard to relate back to the original source code the user wrote.

In typegpu v0.11.4, hints are now surfaced in JavaScript, which should allow you to locate the errors much faster.

withPerformanceCallback on guarded compute pipelines

const pipeline = root
  .createGuardedComputePipeline(() => {
    // ...
  })
  .withPerformanceCallback((start, end) => {
    const durationNs = Number(end - start);
    console.log(`Pipeline execution time: ${durationNs} ns`);
  });

🗿 Fixes / Stability

📖 Docs

🔧 Internal / Refactors

@typegpu/react v0.11.0 (first release 🚀)

This new package introduces hooks that make working with TypeGPU in React and React Native simple and straightforward.
For more info, head over to the Tutorial and Documentation.

unplugin-typegpu v0.11.3

  • fix: Add missing unplugin-typegpu/rolldown-browser entrypoint by @iwoplaza in #2427

Full Changelog: v0.11.3...v0.11.4

typegpu v0.11.3, @typegpu/radiance-cascades (+more)

28 Apr 18:32

Choose a tag to compare

This batch of releases includes improvements to TypeGPU 0.11, a Jump Flooding algorithm implementation in @typegpu/sdf, as well as a brand new package @typegpu/radiance-cascades by @reczkok: an efficient and customizable Radiance Cascades implementation.

New examples 🎉

🌊 Developer experience

🗿 Stability / Bug fixes

  • fix: Better std.range internal variables type inference by @cieplypolar in #2384
  • fix: Export half-precision vector instance types from 'typegpu/data' by @iwoplaza in #2387
  • fix: Choose f32 when trying to find a type common with abstractFloat and i32 (or u32) by @iwoplaza in #2396
  • fix: console.log implicit pointers by @aleksanderkatan in #2398
  • fix(unplugin-typegpu): Make unplugin-typegpu/babel work in the browser again by @iwoplaza in #2394
  • fix: Improvement to argument usage tracking by @iwoplaza in #2359

📖 Docs

  • docs: More intuitive navigation on the examples page by @iwoplaza in #2406

⚙️ Internal / Repository

  • chore: Use public API in test utilities (extractSnippet, ...) by @iwoplaza in #2388

Full Changelog: v0.11.0...v0.11.3

v0.11.0

14 Apr 16:39
0fa88ae

Choose a tag to compare

New examples:

Blog post: https://docs.swmansion.com/TypeGPU/blog/typegpu-011/

Efficient write APIs

When writing to a buffer with an array of vectors, it's no longer required to create vector instances (e.g. d.vec3f()).

const positionsMutable = root.createMutable(d.arrayOf(d.vec3f, 3));

// before
positionsMutable.write([d.vec3f(0, 1, 2), d.vec3f(3, 4, 5), d.vec3f(6, 7, 8)]);
// now
positionsMutable.write([[0, 1, 2], [3, 4, 5], [6, 7, 8]]); // tuples
positionsMutable.write(new Float32Array([0, 1, 2, 0, 3, 4, 5, 0, 6, 7, 8, 0])); // typed arrays (mind the padding)
// and more...

Each one is more efficient than the previous, so you can choose the appropriate API for your efficiency needs.
More about these new APIs here.

Lint Plugin

@aleksanderkatan has been working on behind the scenes on an ESLint/Oxlint plugin, capable of catching user errors that types cannot. This plugin is now available to install as:

npm install eslint-plugin-typegpu

Documentation: https://docs.swmansion.com/TypeGPU/tooling/eslint-plugin-typegpu/
Relevant PRs: #2235, #2374, #2302

Features

  • feat: Bit operation on vectors by @cieplypolar in #2276
  • impr: More capable and performant write API by @reczkok in #2279
  • feat: Dedent comptime-known nested if/else by @aleksanderkatan in #2308
  • feat: std.range() by @iwoplaza in #2314
  • feat(@typegpu/color): hexToRgb, hexToRgba and hexToOklab utilities by @iwoplaza in #2284
  • feat(eslint-plugin-typegpu): RuleEnhancer & unwrapped POJOs rule by @aleksanderkatan in #2127
  • feat(eslint-plugin-typegpu): More lint rules by @aleksanderkatan in #2153
  • feat: std.textureSampleGrad (+ docs: POM example) by @reczkok in #2366
  • feat(typegpu): infer tgpu.const array length from value for partial d.arrayOf(...) by @Copilot in #2325
  • impr: Add a common.writeSoA(buffer, data) for compatible buffers and extend the initial data field for more flexibility by @reczkok in #2320, #2329
  • impr: Do not pack entry-point variables by @reczkok in #2303
  • feat: More convenient TgpuVertexFn.AutoIn and TgpuVertexFn.AutoOut types by @iwoplaza in #2282
  • feat: Stabilize samplers and textures by @iwoplaza in #2347
  • feat: A type alias for no-custom auto inputs by @iwoplaza in #2344
  • impr: Deprecate the partialWrite API and add patch API that better matches the write features by @reczkok in #2355
  • impr: Short-circuit evaluation for operators && and || by @cieplypolar in #2361
  • feat: Support for PrimitiveOffsetInfo in render pipeline draw...Indirect methods by @cieplypolar in #2337
  • feat: unary operator ! support and std.not by @cieplypolar in #2346

Fixes / Stability

  • fix: Allow guarded pipeline with encoder by @reczkok in #2273
  • refactor: Unplugin 3 by @iwoplaza in #2294
  • fix: Lift limitation on passing tgpu.const references as arguments by @iwoplaza in #2286
  • fix: Deref implicit pointers in shell-less entry function output by @iwoplaza in #2285
  • refactor: Single component props in Vec4 are in a weird order by @iwoplaza in #2296
  • Add unroll coverage for tgpu.const fixed-size array access by @Copilot in #2323
  • fix: Inconsistent whitespace in WGSL functions by @iwoplaza in #2338
  • fix: Make d.Infer assignable to d.InferInput by @iwoplaza in #2335
  • impr: Better withPerformanceCallback API by @reczkok in #2309
  • fix: Use InferGPU in function shell types by @iwoplaza in #2295

Internal DX

Docs

Experimental

  • feat(@typegpu/gl): Type instantiation deferred to shader generator by @iwoplaza in #2278
  • feat: Add @typegpu/sort scaffolding with simple bitonic sort implementation by @reczkok in #2142
  • @typegpu/geometry Simplify variable width lines implementation by @deluksic in #1935

New Contributors

Full Changelog: v0.10.2...v0.11.0

typegpu v0.10.2, unplugin-typegpu v0.10.1 (tinyest-for-wgsl v0.3.1), @typegpu/three v0.10.1

06 Mar 16:08

Choose a tag to compare

This release improves the build output of the typegpu package, dramatically improving tree-shaking and reducing the package size by 60%! It also fixes a few paper cuts introduced along with new shell-less render pipelines (and a few others).

For WebGPU interop enthusiasts, TypeGPU pipelines can now be executed as part of an existing command encoder, render pass, or render bundle encoder! (docs coming soon)

🪄 New examples

🚀 Features

  • feat: Render bundle, .with(pass) and .with(encoder) support by @jerzakm in #2200

🗿 Bug fixes / Stability

📖 Docs / DX

New Contributors

Full Changelog: v0.10.0...v0.10.2

v0.10.1

25 Feb 19:20

Choose a tag to compare

This version makes operator overloading function correctly outside of our codebase (tsdown was stripping type defs that it shouldn't have)

What's Changed

  • fix: Allow arguments in rhs of compound assignment by @iwoplaza in #2219
  • fix: Adjust 'typegpu' package import in our Example monaco instance by @iwoplaza in #2218
  • fix: Operator overloading types were erased during build by @iwoplaza in #2225

Full Changelog: v0.10.0...v0.10.1

v0.10.0

24 Feb 17:53
e4b42f9

Choose a tag to compare

TypeGPU v0.10 take ergonomics to the next level, including but not limited to:

  • Operator overloading for vectors and matrices (thanks to "tsover")
  • Shell-less pipelines, with better defaults
  • Compile time ternary operator support
  • for ... of loop support, as well as loop unrolling
  • .rgba swizzles
  • Indirect compute
  • Stabilized tgpu.comptime, tgpu.accessor, tgpu.lazy, pipelines and entry functions

And many more! Check for more details below.

🪄 New examples

🚀 Features

🗿 Bug fixes / Stability

  • fix: Collisions with builtins by @aleksanderkatan in #2002
  • chore: Remove the deprecated asUsage api by @aleksanderkatan in #1999
  • test: Interpolate an array of elements, generic over the size of the array. by @iwoplaza in #2011
  • fix: correct indentation of nested code blocks in wgslGenerator by @Copilot in #2025
  • fix(@typegpu/three): Let Three.js infer type of new THREE.Color() passed into t3.uniform() by @iwoplaza in #2035
  • bump: @typegpu/three 0.9.1 by @iwoplaza in #2036
  • fix: Better error message when assigning to a value defined outside TGSL by @aleksanderkatan in #1981
  • fix: Remove unnecessary any in @typegpu/three internals by @iwoplaza in #2045
  • fix: Remove redundant .with slot calls & chore: Cleanup ItemStateStack by @aleksanderkatan in #1853
  • impr: Name on a bound fn by @aleksanderkatan in #2070
  • fix/feat: Fix type in textureSampleCompare and add textureSampleCompareLevel by @reczkok in #2006
  • feat: Variance annotation overrides to achieve better type behavior by @iwoplaza in #2073
  • fix: More tree-shakeable and convenient exports by @iwoplaza in #2068
  • feat: More predictable dual-impl behavior by @iwoplaza in #2085
  • fix: Improve perlin noise internals and API with accessors by @iwoplaza in #2065
  • refactor: Double down on BaseData by @iwoplaza in #2092
  • impr: Ignore console.logs in vertex shaders by @aleksanderkatan in #1985
  • fix: Proper type coersion for vector & scalar operations by @iwoplaza in #2106
  • feat: Better errors for illegal arguments in shellless by @aleksanderkatan in #2124
  • fix: Better no color attachment handling by @reczkok in #2148
  • impr: Refine std function and conversion handling by @reczkok in #2126
  • feat: Limit overflow suggestions by @aleksanderkatan in #2146
  • fix: intermediate representation of array expression by @cieplypolar in #2021
  • impr: Remove unnecessary nested blocks in seed functions by @cieplypolar in #2086
  • impr: Make clouds use the texture.write() API and move from rgba8unorm to r8unorm since only one channel was used by @reczkok in #2157
  • fix: Disallow missing varyings in shell-less fragment input by @iwoplaza in #2165
  • chore: Make swizzles tiny by @iwoplaza in #2171
  • refactor: Remove unused generateSwizzleFunctions.ts script by @iwoplaza in #2207
  • feat: Rename d.getOffsetInfoAt to d.memoryLayoutOf by @iwoplaza in #2205
  • impr: block scopes in the nameRegistry by @cieplypolar in #2177
  • impr: block externals by @cieplypolar in #2188
  • fix: Alter entry points to support older TypeScript versions, maintain deprecated JSDocs in stabilized ['~unstable'] APIs by @iwoplaza in #2212

📖 Docs / DX

Read more

v0.9.0

22 Dec 20:50

Choose a tag to compare

typegpu 0.9.0, tinyest 0.2.0, tinyest-for-wgsl 0.2.0, @typegpu/* 0.9.0

TypeGPU 0.9.0 brings improvements to compile-time capabilities of JS-shaders, as well as an exciting new integration with Three.js, where any TSL node in a material can be granularly replaced with a TypeGPU function.

🪄 New examples

🚀 Features

📖 Docs / DX

🗿 Bug fixes / Stability

  • fix: Indexing constants with runtime indices should properly adjust by @iwoplaza in #1922
  • fix: Disallow references in arrays by @aleksanderkatan in #1990
  • fix: Fix errors and types around textures by @reczkok in #1950
  • fix: Accessor of static value has unknown type by @lursz in #1964
  • fix: Giving local declarations unique names if they clash with global declarations, and vice-versa + 'strict' the default naming scheme in pipelines by @iwoplaza in #2000
  • chore: Remove 'createDualImpl' by @iwoplaza in #1961
  • test(unplugin-typegpu): Add tests for 'use gpu' marked object method by @cieplypolar in #1894
  • chore: Remove does from entrypoints by @aleksanderkatan in #1997

🧪 Experimental / WIP

Full Changelog: v0.8.2...v0.9.0

v0.8.2

06 Nov 12:50
b754154

Choose a tag to compare

What's Changed

Full Changelog: v0.8.1...v0.8.2

v0.8.1

04 Nov 17:10
4757576

Choose a tag to compare

🗿 Fixes/Stability

📖 Docs/DX

  • fix(docs): Use a more widely supported image source in Jelly Slider number atlas by @reczkok in #1878
  • docs: Soft shadows & bounce lighting in the "Jelly Slider" example by @iwoplaza in #1881

Full Changelog: v0.8.0...v0.8.1

v0.8.0

30 Oct 13:33
5d59c43

Choose a tag to compare

We're excited to release TypeGPU 0.8! Here are the main highlights:

  • console.log on the GPU, a familiar way to debug code execution brought to shaders
  • Simpler and more flexible TypeGPU shader functions (just ‘use gpu’ at the beginning of a function)
  • Overhauled texture APIs (e.g. automatic mip-maps)

You can now install new versions of these packages:

  • typegpu v0.8.0
  • @typegpu/color v0.8.0
  • @typegpu/noise v0.8.0
  • @typegpu/sdf v0.8.0
  • unplugin-typegpu v0.8.0

Migration guide

If you have any uses of the 'kernel'; directive placed at beginning of some functions, you can change it to the 'use gpu'; directive. It functions the same, just with a clearer name.

🚀 Features

🗿 Bug fixes / Stability

📖 Docs/DX

Full Changelog: v0.7.1...v0.8.0