Releases: software-mansion/TypeGPU
typegpu v0.7.0, unplugin-typegpu v0.2.2
TypeGPU 0.7.0 is full of quality-of-life features that we're excited for you to try out!
Default constructors for schemas
Ever had to construct an initial (zero'ed out) value that matches your custom schema? It's just become extremely simple! You can now call any schema, and in return, you'll receive a zero-initialized value.
const Boid = d.struct({
pos: d.vec3f,
vel: d.vec3f,
});
const BoidArray = d.arrayOf(Boid, 4);
const boids = BoidArray(); // ✨
console.log(boids.length); // prints 4
console.log(boids[0].pos.x); // prints 0
🧪 Fluent interface (or infix operators*)
Up until 0.7, adding two vectors together in TGSL was only possible with the std.add
function, but now, vectors and matrices have operator methods on them! This way, you can chain operations in a way that's more readable.
// before 0.7.0
std.add(std.mul(v1, 2), v2);
// 0.7.0
v1.mul(2).add(v2);
🧪 Simulating GPU behavior
An experimental API for simulating GPU-behavior on the CPU has been introduced, called "tgpu.simulate". It's useful for unit-testing your shaders, precomputing parts of your pipeline, etc.
import { perlin2d } from '@typegpu/noise';
const { result } = tgpu.simulate(() => {
// Executed on the CPU, behaves like it's on the GPU
return perlin2d.sample(d.vec2f(1.1, 2.2));
});
New Online Tool: "Shader Translator"
Curious what optimizations are performed on your shader code before it gets executed? How does TGSL look like when compiled into WGSL? @reczkok has been hard at work on a new tool just for that! Check it out here: https://typegpu.com/translator

Changelog
🚀 Features
- feat: Struct default constructor by @aleksanderkatan in #1480
- feat: Make array schemas callable by @aleksanderkatan in #1499
- feat: Vector and matrix infix operators by @aleksanderkatan in #1486
- feat: invariant attribute by @iwoplaza in #1478
- feat: std.mod by @lursz in #1513
- feat: std.smoothstep by @lursz in #1450
- feat: tgpu.resolve supports config by @lursz in #1536
- feat: Bun plugin by @iwoplaza in #1561
🗿 Bug fixes / Stability
- fix: Proper type for .value and .$ in TypeGPU variables by @iwoplaza in #1482
- fix: Export
TgpuQuerySet
by @reczkok in #1552 - fix: Add support for packed vertex formats in compiled writer and improve the writer selection logic by @reczkok in #1560
- fix: Rework how schemas propagate usage validity by @iwoplaza in #1547
- fix(unplugin-typegpu): Create proper AST for TypeGPU metadata by @reczkok in #1498
- fix(unplugin-typegpu): TypeGPU functions using TGSL dependencies declaration order by @aleksanderkatan in #1522
- fix(unplugin-typegpu): Plugin should parse files with TS syntax support by @iwoplaza in #1516
- chore: Clarifying purpose of execution modes by @iwoplaza in #1468
📖 Docs / DX
- docs: Create a shader compilation tool by @reczkok in #1466
- docs: Refactor the translator and add TGSL mode by @reczkok in #1529
- docs: Stable tgpu.fn guide by @iwoplaza in #1409
- docs: Explain slots by @iwoplaza in #1451
- docs:
resolveWithContext
in resolve docs by @aleksanderkatan in #1477 - docs: Add new dependency catalogs to pnpmWorkspaceYaml schema by @reczkok in #1473
- docs: Add @typegpu/sdf package to StackBlitz dependencies by @reczkok in #1475
- docs: Fix function visualizer resize by @aleksanderkatan in #1487
- docs: Pipelines guide by @mhawryluk in #1405
- docs: Publishing API Reference in their current state by @iwoplaza in #1515
- docs: Complete "Functions" in roadmap by @iwoplaza in #1537
- fix(docs): Use the same base URL when importing from esm.sh by @iwoplaza in #1507
- fix(docs): TypeScript support for Babel.transform() in translateTGSL() by @GCyganek in #1553
- build(deps): bump astro from 5.9.3 to 5.11.1 by @dependabot[bot] in #1488
- build(deps): bump glob from 11.0.2 to 11.0.3 by @dependabot[bot] in #1492
- chore(docs): Update dependencies by @iwoplaza in #1533
🧪 Experimental APIs
- feat: API for simulating variable and buffer access on the CPU by @iwoplaza in #1511
- fix: Struct clone constructors on WGSL side by @aleksanderkatan in #1470
- feat: Expected type stack in WgslGenerator by @aleksanderkatan in #1532
- fix: division operator resolution by @lursz in #1446
- fix: Simplify division logic in
wgslGenerator
by @reczkok in #1530 - fix: Fix pointer value assignment type conversion by @reczkok in #1526
- fix: div operator by @lursz in #1520
- impr: Improve whitespace in code generation when resolving by @reczkok in #1538
- feat: Add second argument to vertex/fragment shader signatures by @reczkok in #1549
- fix: concretize abstract types when performing division by @cieplypolar in #1557
New Contributors
- @GCyganek made their first contribution in #1553
- @cieplypolar made their first contribution in #1557
Full Changelog: v0.6.0...v0.7.0
v0.6.0
🚀 Features
- feat: Stabilize tgpu.fn & remove deprecated .does API by @iwoplaza in #1411
- feat: Stabilize slots by @iwoplaza in #1424
- feat: First-class buffer shorthands by @iwoplaza in #1404
- feat: Better TgpuFn type (0.6.0) by @iwoplaza in #1386
- feat: Introduce Index buffers and improve buffer UX by @reczkok in #1340
- feat:
tgpu.resolveWithContext
by @mhawryluk in #1410 - feat: Automatically assign names to resources in Unplugin by @aleksanderkatan in #1344
- feat: @typegpu/sdf package by @iwoplaza in #1428
- feat: Perlin Noise derivatives by @iwoplaza in #1457
- feat: Cast elements to correct type when creating vectors by @aleksanderkatan in #1311
- feat: Autoname unstruct definitions by @iwoplaza in #1413
- feat: Autoname assignment expressions and properties by @aleksanderkatan in #1415
🗿 Bug fixes / Stability
- fix: "Experimantal" typo by @iwoplaza in #1381
- feat: Hide more internal functionality under symbols by @iwoplaza in #1387
- fix: createBindGroup with wide layout type should accept wide resource types by @iwoplaza in #1427
- fix: Use bool for builtin.frontFacing by @deluksic in #1456
- fix: Perf measure nits by @iwoplaza in #1454
📖 Docs / DX
- docs: Add ASCII (not really) camera filter example by @reczkok in #1376
- docs: Port of XorDev's "Centrifuge 2" example by @iwoplaza in #1388
- docs: Experimental examples "on" by default by @iwoplaza in #1422
- chore: Simplify tsconfig.json by @iwoplaza in #1385
- refactor: Remove name method calls from examples and tests by @aleksanderkatan in #1407
- fix: Add "experimental" tag to ASCII filter example by @reczkok in #1420
- style: Ignore .svg files during formatting checks by @aleksanderkatan in #1443
- docs: Table of content emoji by @aleksanderkatan in #1449
- docs: Fix license link by @aleksanderkatan in #1448
- build(deps): bump @radix-ui/react-slider from 1.3.2 to 1.3.5 by @dependabot in #1397
- build(deps-dev): bump yaml from 2.7.0 to 2.8.0 by @dependabot in #1432
- build(deps): bump @astrojs/sitemap from 3.4.0 to 3.4.1 by @dependabot in #1433
- build(deps): bump @astrojs/react from 4.2.7 to 4.3.0 by @dependabot in #1398
- build(deps): bump motion from 12.9.2 to 12.20.1 by @dependabot in #1431
- build(deps): bump @webgpu/types from 0.1.54 to 0.1.63 by @dependabot in #1435
🧪 Unstable features
- feat: Measure performance of resolution and shader compilation by @iwoplaza in #1441
- feat: Apply copy semantics to function calls in JS by @aleksanderkatan in #1421
- feat: Match up vertex and fragment locations in render pipeline by @mhawryluk in #1377
- feat: Update "kernel" and "kernel & js" directives by @aleksanderkatan in #1442
- fix: Add explicit type annotation to constant declarations by @reczkok in #1382
- fix: Prevent autocasting lhs of assignment expressions by @reczkok in #1461
- feat: Pipelines
.pipe
by @mhawryluk in #1414 - chore: Remove JIT transpiler by @iwoplaza in #1419
Full Changelog: v0.5.9...v0.6.0
v0.5.9
🚀 Features
- feat: Added std.identity4 & std.translate4 by @lursz, @aleksanderkatan in #1285
- feat: Add matrix rotate and scale by @aleksanderkatan in #1319
- feat: std.tanh by @reczkok in #1314
- feat: implement std.cosh, std.acosh, std.exp2 by @lursz in #1317
- feat: std.log and std.log2 by @lursz in #1359
- feat: Add support for timestamp queries in pipelines and introduce TgpuQuerySet by @reczkok in #1352
🗿 Fixes/Stability improvements
- fix: Allow for memory identity in bind group layouts by @reczkok in #1329
- fix: Remove redundant InferReturn by @iwoplaza in #1338
- fix: Replace unplugin hoisting error with a warning by @mhawryluk in #1366
📖 Docs/DX
- docs: Focus example search input on cmd/ctrl + k by @mhawryluk in #1364
- docs: Image Tuning Example by @bielok in #1316
- docs: Create WGSL resolution example by @mhawryluk in #1330
- docs: A port of XorDev's "Runner" to TypeGPU by @iwoplaza in #1365
- docs: "Caustics" example by @iwoplaza in #1373
- docs: Rework example selection UI and add searching utilities. by @reczkok in #1230
- impr: Better dev scripts by @aleksanderkatan in #1315
- docs: Fix control panel height on mobile by @mhawryluk in #1327
- impr: Add a way to select sharpening function in perlin noise example by @reczkok in #1314
- docs: Add mobile controls to function visualiser and 3d fish by @aleksanderkatan in #1332
- docs: Improve Edit on Stackblitz button styling by @mhawryluk in #1308
- fix(docs): Attempt to fix perlin noise example on mobile by @reczkok in #1331
- fix(docs): Page scroll on touch events in examples by @mhawryluk in #1339
- docs: Improve "Example not found" UI by @mhawryluk in #1342
- fix(docs): Small thumbnails not appearing by @aleksanderkatan in #1335
- fix(docs): 3D Fish and Gravity improper rendering by @aleksanderkatan in #1343
- docs: Make function visualizer canvas fit to container by @aleksanderkatan in #1361
- fix(docs): Perlin noise dynamic cache on Safari by @mhawryluk in #1362
- chore: Script for detecting changes by @iwoplaza in #1379
- build(deps): bump tsup from 8.4.0 to 8.5.0 by @dependabot in #1320
- build(deps): bump @radix-ui/react-select from 2.1.6 to 2.2.5 by @dependabot in #1323
- build(deps): bump execa from 9.5.2 to 9.6.0 by @dependabot in #1321
- build(deps): bump astro from 5.7.12 to 5.9.3 by @dependabot in #1367
- build(deps-dev): bump autoprefixer from 10.4.20 to 10.4.21 by @dependabot in #1346
- build(deps): bump arktype from 2.1.19 to 2.1.20 by @dependabot in #1348
🧪 Experimental APIs
- feat: Migrate unplugin from using
tgpu.__assignAst
toglobalThis
by @aleksanderkatan in #1258 - feat: Allow omitting types in wgsl header by @aleksanderkatan in #1306
- feat: Explicit name for dualImpl by @lursz in #1334
- chore: Investigate casts in
createVertexFn
andcreateComputeFn
by @aleksanderkatan in #1374
New Contributors
Full Changelog: v0.5.8...v0.5.9
v0.5.8
🚀 Features
- feat: Better add, sub, mul, div interface by @aleksanderkatan in #1283
- feat: improved std.arrayLength by @lursz in #1261
- feat: More strict matrix interface by @aleksanderkatan in #1289
- feat(typegpu/noise): 2D/3D Perlin Noise by @iwoplaza in #1292
🗿 Stability/Fixes
- fix: Remove experimental object args API from tgpu-gen by @aleksanderkatan in #1256
📖 Docs/DX
- docs: Better initial configuration of 3D Fish by @lursz in #1279
- docs: TGSL guide by @mhawryluk in #1231
- docs: Update tgpu.fn API by @iwoplaza in #1247
- fix(docs): Use a more compatible texture format for stable-fluids example and add touch controls by @reczkok in #1251
- docs: Make Camera Thresholding example more responsive by @mhawryluk in #1232
- docs: bump to Tailwind 4 by @lursz in #1239
- docs: Small cleanup to "Fluid double buffering" by @iwoplaza in #1275
- docs: Add link to documentation from blog site by @mhawryluk in #1295
- docs: Add spinner to the Camera Thresholding example by @mhawryluk in #1309
- fix(docs): Starlight theme overrides by @mhawryluk in #1260
- fix: Flakey biome lints in CI by @iwoplaza in #1244
- build(deps): bump glob from 11.0.1 to 11.0.2 by @dependabot in #1265
- fix: Race condition in CI by @iwoplaza in #1268
- fix: Remove Git LFS by @iwoplaza in #1272
- fix(benchmarks): "Cannot determine size" error in Benchmarks by @aleksanderkatan in #1281
- chore: Biome useSortedClasses for consistency and better compression by @deluksic in #1287
- fix(typegpu-docs): Make sliders controllable with touch in Examples by @deluksic in #1286
- build(deps-dev): bump @babel/template from 7.26.9 to 7.27.2 by @dependabot in #1300
- build(deps): bump sharp from 0.32.6 to 0.34.2 by @dependabot in #1299
- build(deps-dev): bump wesl from 0.6.0-rc4 to 0.6.7 by @dependabot in #1297
- build(deps-dev): bump tailwindcss from 4.1.6 to 4.1.7 by @dependabot in #1298
- bump: typegpu v0.5.8 (and pretty much everything else) by @iwoplaza in #1310
🧪 Experimental APIs
- feat: Add
ExtractTypeLabel
type by @aleksanderkatan in #1253 - feat: Function to extract argument information from a wgsl function code string by @aleksanderkatan in #1233
- impr:
extractArgs
changes by @aleksanderkatan in #1277
fix: Remove experimental object args API by @iwoplaza in #1246 - feat: Export tinyest format version by @iwoplaza in #1280
- impr: Add proper restrictions for Vertex stage builtins by @mhawryluk in #1259
- feat: Allow destructuring arguments in TGSL function implementations by @mhawryluk in #1257
- feat: Branded snippets by @iwoplaza in #1294
Full Changelog: v0.5.7...v0.5.8
v0.5.7
What's Changed
🚀 Features
- feat(typegpu): std.sign by @iwoplaza in #1205
- feat(typegpu): std.textureLoad, std.textureStore, std.textureDimensions, std.textureSampleLevel by @reczkok in #1181
- feat(typegpu): std.sqrt, std.div by @reczkok in #1189
- feat: Allow for...of statement to work with vectors and matrices by @mhawryluk in #1226
- feat(typegpu/color): Add Oklab color space by @deluksic in #1194
- feat(typegpu/color): Use accessor for OKLab alpha by @iwoplaza in #1228
- feat: More partial InferPartial, publicize InferGPU & InferPartial by @iwoplaza in #1215
🗿 Stability/Internals
- refactor: Using $internal symbol for storing internals in plain sight by @iwoplaza in #1182
- fix: std.select type signature should accept scalar values by @iwoplaza in #1203
- refactor: Reuse sign and sqrt in
@typegpu/noise
by @deluksic in #1212 - feat: Store labels of objects on
globalThis
by @aleksanderkatan in #1221
📖 Docs/DX
- docs: React Native setup guide by @mhawryluk in #1185
- docs: unplugin-typegpu guide by @mhawryluk in #1191
- docs: Update repo structure in README by @iwoplaza in #1195
- docs: ColorPicker example controls by @mhawryluk in #1214
- docs: Persist ControlPanel toggles state in local storage by @mhawryluk in #1222
- docs: Add Gravity example & ops: Use git lfs for large files by @aleksanderkatan in #1149
- docs: Add fluid simulation based image distortion example by @reczkok in #1181
- refactor: Use Deno for formatting by @iwoplaza in #1213
- test: Replace all occurrences of
toEqual
withtoStrictEqual
by @aleksanderkatan in #1211 - test: Testing vectors for structural differences by @iwoplaza in #1208
- build(deps): bump astro from 5.6.1 to 5.7.4 by @dependabot in #1174
- build(deps-dev): bump @babel/parser from 7.26.10 to 7.27.0 by @dependabot in #1155
- build(deps): bump @astrojs/react from 4.2.3 to 4.2.4 by @dependabot in #1172
- build(deps): bump @radix-ui/react-slider from 1.2.3 to 1.3.2 by @dependabot in #1175
- build(deps-dev): bump @ark/attest from 0.45.10 to 0.46.0 by @dependabot in #1173
- build(deps): bump vitest from 3.1.1 to 3.1.2 by @dependabot in #1196
- build(deps): bump typescript from 5.8.2 to 5.8.3 by @dependabot in #1197
- build(deps): bump motion from 12.6.3 to 12.9.2 by @dependabot in #1200
🧪 Unstable APIs
- feat: Texture std expansion and generator adjustments by @reczkok in #1189
- fix: Handle single-line statements in TGSL if/for/while by @mhawryluk in #1224
- impr: Throw error when trying to define tgpu.derived during resolution by @mhawryluk in #1223
- impr: Add automatic type conversions when possible by @reczkok in #1136
- fix: Revert object args fn API in examples (+cleanup), fix boolean literals assigned to variable declarations in TGSL by @iwoplaza in #1229
- feat(unplugin-typegpu): Support TS
as
andsatisfies
in TGSL by @mhawryluk in #1240
Full Changelog: v0.5.6...v0.5.7
v0.5.6
What's Changed
- build(deps): bump vitest from 3.0.9 to 3.1.1 by @dependabot in #1157
- build(deps-dev): bump wesl from 0.6.0-rc1 to 0.6.0-rc4 by @dependabot in #1156
- feat: A more extensible & efficient "tinyest" format by @iwoplaza in #1170
- refactor: Use internal symbol to identify TypeGPU-originating values by @iwoplaza in #1171
- bump: typegpu 0.5.6, others non-alpha by @mhawryluk in #1183
- refactor: Replace remaining references of the name "smol" by @mhawryluk in #1168
📖 Docs/DX
- fix(docs): Cubemap Reflection example assets by @iwoplaza in #1164
- docs: Ecosystem scaffold by @iwoplaza in #1150
- impr: Add touch events support for camera orbit control in cubemap reflection example by @reczkok in #1166
- docs: Use-cases of TypeGPU in README by @iwoplaza in #1144
Full Changelog: v0.5.5...v0.5.6
v0.5.5
BREAKING - remove .populate
method
🗿 Stability/fixes
- fix: Change interpolate signature to allow for decorated types by @aleksanderkatan in #1113
📖 Docs/DX
- feat: Add cubemap reflection example, remove
.populate
method by @reczkok in #1017 - build(deps): bump astro from 5.3.1 to 5.6.1 by @dependabot in #1122
- build(deps): bump @astrojs/react from 4.2.0 to 4.2.3 by @dependabot in #1118
- build(deps-dev): bump @types/babel__traverse from 7.20.6 to 7.20.7 by @dependabot in #1120
- build(deps): bump motion from 12.4.5 to 12.6.3 by @dependabot in #1119
- chore: Add
typegpu
as peer dependency ofunplugin-typegpu
by @mhawryluk in #1117 - bump: @typegpu/color v0.0.1 by @mhawryluk in #1132
- fix: Add typegpu/color dependency to stackblitz integration, update 3d fish example by @mhawryluk in #1133
- bump: tgpu-gen v.0.1.1 by @mhawryluk in #1134
- refactor: Explicit import extensions by @iwoplaza in #1135
- fix: Example max height with code editor shown by @mhawryluk in #1141
- docs: Better meta title by @iwoplaza in #1145
- fix(typegpu-docs): Cross file import types by @iwoplaza in #1142
🧪 Unstable APIs
- fix: Function call member access type inference by @reczkok in #1062
- feat: Update
tgpu-gen
to generate the latest function API, skip non-entry by @mhawryluk in #1116 - fix: Entry functions arg type externals replacement with string wgsl implementation by @iwoplaza & @mhawryluk in #1111
- feat: Allow passing raw wgsl implementation to shell à la template literal by @aleksanderkatan in #1128
- fix: Function resolve bug fixes by @mhawryluk in #1131
- fix(tinyest-for-wgsl): Extracting destructured args with babel parser by @mhawryluk in #1143
- bump: tinyest-for-wgsl & unplugin-typegpu v0.1.0-alpha.9 by @mhawryluk in #1152
- fix(unplugin-typegpu): source-map misalignment when removing directives (&
@ark/attest
) by @iwoplaza in #1151 - bump: typegpu v0.5.5 by @mhawryluk in #1153
Full Changelog: v0.5.4...v0.5.5
v0.5.4
🚀 Features
- feat: Implement
vecN<bool>
and std boolean functions by @aleksanderkatan in #1019
🗿 Stability/internals
- chore: Detect structs based on symbol tag & migrate every schema to use
$repr
instead of~repr
by @iwoplaza in #1091 - fix: Apply missing Prettify calls by @reczkok in #1105
📖 Docs/DX
- build(deps): bump acorn from 8.14.0 to 8.14.1 by @dependabot in #1069
- fix: Add await to dynamic import in StackBlitz example by @reczkok in #1103
- chore: Verify that the tag used for publishing matches the version number by @iwoplaza in #1067
- bump: typegpu v0.5.4, unplugin-typegpu v0.1.0-alpha.8, tinyest, tinyest-for-wgsl by @mhawryluk in #1109
🧪 Unstable APIs
This release introduces a breaking change for the unstable computeFn
, vertexFn
and fragmentFn
APIs. Please refer to the "Functions" guide 🙌
- fix: Ensure non-entrypoint functions include return type in callStack by @reczkok in #1065
- feat: array.length in TGSL by @iwoplaza in #1097
- feat: Replace
does
method with shell invocation by @mhawryluk in #1045 - feat: layout.value by @iwoplaza in #1098
- feat: "kernel & js" directive by @mhawryluk in #1102
Full Changelog: v0.5.3...v0.5.4
v0.5.3
🗿 Fixes/Stability
- impr: Switch to 'es2024' target, 7x speed gain for vector creation by @reczkok in #1063
- fix: Taking into account decorated non-primitives in compiled IO by @iwoplaza in #1095
- bump: typegpu v0.5.3, @typegpu/noise v0.0.4 by @iwoplaza in #1086
📖 Docs/DX
- build(deps): bump wgpu-matrix from 3.3.0 to 3.4.0 by @dependabot in #1035
- build(deps): bump remeda from 2.20.2 to 2.21.2 by @dependabot in #1034
- build(deps-dev): bump pkg-pr-new from 0.0.39 to 0.0.41 by @dependabot in #1033
- feat: Add a benchmark suite for vector creation by @reczkok in #1063
- build(deps-dev): bump rollup from 4.34.8 to 4.37.0 in /packages/unplugin-typegpu by @dependabot in #1075
- build(deps-dev): bump @types/node from 22.13.4 to 22.13.13 by @dependabot in #1070
- chore: Infra benchmarks boilerplate by @iwoplaza in #1088
- chore: Discriminated union benchmark by @iwoplaza in #1090
🧪 Experimental features
- fix: randSeed functions in typegpu/noise by @mhawryluk in #1061
Full Changelog: v0.5.2...v0.5.3
v0.5.2
🗿 Bug fixes / Stability
🧪 Unstable features
- feat: Handle
ArrayExpression
in TGSL and switch to WESL parser by @reczkok in #1032 - 🥗: Utility modules starter by @iwoplaza in #807
📖 Docs / DX
- fix: Stackblitz canvas resize observers by @mhawryluk in #1044
- docs: WESL Interoperability guide by @iwoplaza in #1046
Full Changelog: v0.5.1...v0.5.2