Releases: software-mansion/TypeGPU
v0.11.0
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-typegpuDocumentation: 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.constarray length from value for partiald.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
partialWriteAPI and addpatchAPI that better matches thewritefeatures by @reczkok in #2355 - impr: Short-circuit evaluation for operators
&&and||by @cieplypolar in #2361 - feat: Support for
PrimitiveOffsetInfoin render pipeline draw...Indirect methods by @cieplypolar in #2337 - feat: unary operator
!support andstd.notby @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.constfixed-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
withPerformanceCallbackAPI by @reczkok in #2309 - fix: Use InferGPU in function shell types by @iwoplaza in #2295
Internal DX
- chore: Tweaks for working with worktrees by @iwoplaza in #2271
- ci: Skip treeshaking in fork PRs by @aleksanderkatan in #2289
- chore: Sort treeshake-test results by impact in GitHub comments by @iwoplaza in #2268
- chore: Move individual example tests to
apps/typegpu-docsby @iwoplaza in #2291 - chore: A way to skip checks before publishing, if we know tests already pass by @iwoplaza in #2281
- chore: Skip attest by default by @iwoplaza in #2316
- chore: Benchmark resolution time of procedurally generated functions by @cieplypolar in #2233
- chore: Bump oxlint and oxlint-tsgolint by @aleksanderkatan in #2317
- chore: Transform overloads before test:types by @iwoplaza in #2280
- chore: Migrate to Vitest 4 by @iwoplaza in #2330
- fix: Enable
erasableSyntaxOnlyandverbatimModuleSyntaxTypeScript options by @iwoplaza in #2332 - fix(docs): Bump vite to 8.0.5 to fix minifier issue by @iwoplaza in #2353
- chore: Manual publish workflow by @iwoplaza in #2368
- feat: Resolution time benchmark github action by @cieplypolar in #2239
Docs
- docs: Accessors by @iwoplaza in #2267
- docs: Custom monaco build by @aleksanderkatan in #2297
- fix(docs): Vector slider controls by @aleksanderkatan in #2247
- docs: Cleanup examples by @aleksanderkatan in #2265
- fix(docs): Clear timeout in 3D Fish example by @iwoplaza in #2311
- fix(docs): Make tsover-runtime importable in the translator app by @iwoplaza in #2310
- chore: Update to Astro 6 by @iwoplaza in #2292
- docs: Use Vite v8 for lower memory consumption by @iwoplaza in #2315
- fix(docs): Fix diagnostics on release by @iwoplaza in #2333
- fix(docs): Color picker lagging when switching between Jelly examples by @aleksanderkatan in #2340
- docs: Comprehensive
tgpu.unrolldocs by @cieplypolar in #2334 - docs: Add lose state to suika game and do a small refactor by @reczkok in #2350
- fix(docs): Add missing cool factor and remove explicit experimental tags by @reczkok in #2377
- impr: Improve orbit camera to better behave on mouse scroll-wheel by @mvanhorn in #2304
Experimental
- feat(@typegpu/gl): Type instantiation deferred to shader generator by @iwoplaza in #2278
- feat: Add
@typegpu/sortscaffolding 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
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
- "Suika SDF" game by @reczkok in #2231
🚀 Features
🗿 Bug fixes / Stability
- fix: Allow TgpuGenericFn to be resolved by @iwoplaza in #2245
- fix: Improve typegpu package build output by @iwoplaza in #2249
- fix: Fill missing slots in shellless entry functions by @aleksanderkatan in #2255
- fix: Shellless attribs by @iwoplaza in #2241
- fix: Properly infer layout .$ using InferGPU by @iwoplaza in #2258
- fix: Add missing
textureLoadoverloads and fix wrong types by @reczkok in #2261 - fix: TSNonNullExpression node support by @cieplypolar in #2264
- refactor: Migrate @typegpu/* libs to use tsover by @iwoplaza in #2217
- impr(@typegpu/three): simplified variable name resolution by @cieplypolar in #2213
📖 Docs / DX
- docs: Soft overhaul of the example page look by @reczkok in #2243
- chore: Add .nvmrc to ensure consistency across setups by @iwoplaza in #2224
- chore: Improve linting performance by @iwoplaza in #2220
- dx: Oxlint warns for unused ignores by @aleksanderkatan in #2229
- refactor(docs): Migrate more examples to use tsover by @iwoplaza in #2199
- chore: Migrate to oxfmt by @iwoplaza in #2221
- docs: Remove "experimental" tag from examples that no longer use unstable APIs by @iwoplaza in #2232
- fix:
SuikaSDFassets path by @cieplypolar in #2238 - chore: Suggest workspace TS version when opening the project in VSCode by @iwoplaza in #2242
- docs: Make sidebar and code editor disabled by default by @reczkok in #2240
- chore: Test treeshaking on built output, instead of source code by @iwoplaza in #2248
- chore: Remove deno.json files by @iwoplaza in #2252
- docs: Update @typegpu/three guide banner by @iwoplaza in #2262
New Contributors
Full Changelog: v0.10.0...v0.10.2
v0.10.1
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
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
- "Ripple cube" by @reczkok in #2151
- "Smoky Triangle" by @iwoplaza in #2091
- "Game of Life (REBORN)" by @reczkok in #2100
- "Jump Flood (Voronoi)" by @reczkok in #1952
- "Jump Flood (Distance)"by @reczkok in #1967
🚀 Features
- feat: Overload operators for vectors by @iwoplaza in #2176
- feat: Add
primitive_index,subgroup_idandnum_subgroupsbuiltins by @iwoplaza in #2028 - feat: More autonaming by @aleksanderkatan in #2012
- feat: More capable accessors by @iwoplaza in #2010
- feat: Embed TypeGPU version in globals, detect multiple versions of TypeGPU by @iwoplaza in #1726
- feat: Deprecate .value and .bound by @iwoplaza in #2040
- feat: Stabilize tgpu.comptime by @iwoplaza in #2051
- feat: Ternary operator by @aleksanderkatan in #2069
- feat(@typegpu/noise): Optional seeds by @cieplypolar in #1665
- impr: Expose size on TgpuTextureView by @reczkok in #2056
- feat: Rename
derivedtolazyand stabilize by @iwoplaza in #2083 - feat: Dollarless de-ref by @iwoplaza in #2119
- feat:
root.configureContextby @aleksanderkatan in #2116 - feat: Export the Withable type by @iwoplaza in #2129
- impr: More shellless autonaming by @aleksanderkatan in #2107
- feat: Shell-less entry functions, createComputePipeline, createRenderPipeline by @iwoplaza in #1835
- feat: Handle compatible Math functions in TypeGPU functions by @aleksanderkatan in #2152
- feat:
for ... of ...loop support by @cieplypolar in #1976 - impr: Add
componentCountfield to vector schemas by @reczkok in #2161 - feat: tgpu.fn(callback) for providing slots and accessors by @lursz in #2029
- feat: Add .rgba swizzles to vectors by @iwoplaza in #2166
- feat: Stabilize tgpu.accessor and tgpu.mutableAccessor by @iwoplaza in #2167
- feat: Stabilize pipelines and entry functions by @iwoplaza in #2168
- feat: Defaults for targets in
.createRenderPipelineand.withColorAttachmentsby @iwoplaza in #2196 - feat: Add
Indirectbuffer usage and support.dispatchWorkgroupsIndirectAPI by @reczkok in #2105 - feat: vecBase and matBase by @iwoplaza in #2206
- feat: loop unrolling support by @cieplypolar in #2178
🗿 Bug fixes / Stability
- fix: Collisions with builtins by @aleksanderkatan in #2002
- chore: Remove the deprecated
asUsageapi 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
anyin @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
textureSampleCompareand addtextureSampleCompareLevelby @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 fromrgba8unormtor8unormsince 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.getOffsetInfoAttod.memoryLayoutOfby @iwoplaza in #2205 - impr: block scopes in the
nameRegistryby @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
- fix: The resizable canvas in examples uses a property that does not exist in safari by @reczkok in #2003
- fix: Keyboard popping up in docs on mobile by @aleksanderkatan in #1996
- chore: Measure tree-shakeability in CI by @piaccho in #1775
- docs: Improve tgpu.comptime example by @iwoplaza in #2037
- fix: Jelly Switch onCleanup Fix by @lursz in #2049
- chore: Analyse the typegpu entry points by @aleksanderkatan in #2042
- docs: Simplify the Three.js Attractors example by @iwoplaza in #2039
- docs: Don't use unnecessary comptime in Three.js Attractors example by @iwoplaza in #2053
- docs: Small @typegpu/three tutorial by @iwoplaza in #2050
- fix: Add missing newline in treeshake report by @aleksanderkatan in https://github.com/so...
v0.9.0
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
- "Jelly Switch"
- "Jump Flood - Distance"
- "Jump Flood - Voronoi"
- "Background Segmentation"
- "Clouds"
- "Point Light Shadow"
- "Stencil"
- "Three.js - tsl / compute / attractors / particles"
- "Three.js - compute / cloth"
- "Three.js - compute / geometry"
- "Three.js - compute / particles / snow"
- "Three.js - compute / particles"
- "Three.js - Simple"
🚀 Features
- feat: Add @typegpu/three package and Three.js integration examples by @reczkok, @iwoplaza, @lursz, @aleksanderkatan and @cieplypolar in #1453
- feat: Ref/Value behavior tracking by @iwoplaza in #1755
- feat: Simpler resolve API by @aleksanderkatan in #1897
- feat: Use strict names by default and fallback to item by @aleksanderkatan in #1916
- impr: Namespaces use strict naming scheme by default by @cieplypolar in #1969
- feat: Accept multiple arguments in min and max by @aleksanderkatan in #1924
- feat: tgpu.comptime, tgpu.rawCodeSnippet and
thisallowed in TypeGPU shader functions by @iwoplaza in #1917, #1957 - feat: More autonaming by @aleksanderkatan in #1953
- feat: Add support for setting stencil reference for pipeline and add a simple stencil example by @reczkok in #1979
- feat: Inspect vector type in shader function by @iwoplaza in #1895
📖 Docs / DX
- docs: "Jelly Switch" example by @iwoplaza in #1902, #1907
- docs: Binary image segmentation example by @aleksanderkatan in #1795
- docs: Add point light shadow example by @reczkok in #1937
- docs: Jump flood algorithm example by @reczkok in #1952
- docs: Split the jump flood algorithm example into two and improve the distance painting by @reczkok in #1967
- docs: Clouds example by @lursz in #1655
- docs: Background segmentation by @lursz in #1951
- docs: Updates to docs related to TypeGPU functions by @iwoplaza in #1882
- docs: @typegpu/sdf docs by @aleksanderkatan in #1977
- docs: TypeGPU Academy signup form tweaks by @iwoplaza in #1889
- chore: Jelly-slider wgsl resolution test by @cieplypolar in #1884
- fix(docs): Remove use of deprecated root.flush() API by @iwoplaza in #1896
- fix(docs): Added missing 'Test Resolution' button in disco example by @cieplypolar in #1928
- fix(docs): Phong reflection WGSL resolution test by @cieplypolar in #1929
- build(deps): bump typescript from 5.8.3 to 5.9.3 by @dependabot[bot] in #1860
- fix(docs): Deleted unnecessary braces in disco example by @cieplypolar in #1941
- fix(docs): Jelly switch WGSL resolution test by @cieplypolar in #1934
- fix(docs): Cleanup of Jelly examples by @lursz in #1959
- docs: Optimize 3d slime mold example by @reczkok in #1900
🗿 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
v0.8.1
🗿 Fixes/Stability
- impr: Always flushing by @iwoplaza in #1822
- impr: Error messages for invalid array and
tgpu.constusage by @aleksanderkatan in #1856 - impr: Typed texture views can be passed into .withColorAttachment by @lursz in #1847
- fix: Always resolve with strict types by @iwoplaza in #1880
📖 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
We're excited to release TypeGPU 0.8! Here are the main highlights:
console.logon 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
- feat:
console.logon the GPU by @aleksanderkatan in #1657, #1855, #1708, #1732, #1771 - feat: Automatic constant folding 🪄 by @iwoplaza in #1609
- feat: Shell-less functions by @iwoplaza in #1718, #1754, #1798
- feat: Texture API overhaul by @reczkok in #1652, #1773, #1819
- feat: Add support for ** operator by @aleksanderkatan in #1644
- feat/docs: Allow pipelines to work in no color mode and add a shadow example by @reczkok in #1624
- feat:
root.createGuardedComputePipelineby @aleksanderkatan in #1630, #1838, #1728, #1794, #1828 - feat: Add subgroup std functions, allow for feature based pruning by @reczkok in #986
- feat: Bitcasts by @lursz in #1671
- feat: tgpu.namespace by @iwoplaza in #1692
- feat(@typegpu/noise): Distributions from uniform [0, 1) by @cieplypolar in https://github.com//pull/1605
- feat: Stabilize constants and variables by @aleksanderkatan in #1745
- feat: Add a function to deep-compare schemas by @piaccho in #1724
- feat(unplugin-typegpu): Autoname functions in unplugin by @aleksanderkatan in #1746
- feat: Simplify pipelines
withmethod by @aleksanderkatan in #1767 - feat: Common
fullScreenTrianglevertex function by @iwoplaza in #1831
🗿 Bug fixes / Stability
- feat: GPU recursion error by @cieplypolar in #1585
- fix: More robust definition of snippet types, and resolving numeric literals by @iwoplaza in #1606
- fix: Warn when external was omitted by @aleksanderkatan in #1602
- fix: Warn when external was omitted (postmortem) by @aleksanderkatan in #1613
- fix: Allow for immediately invoked schemas by @iwoplaza in #1586
- fix: Pointers for reference types by @aleksanderkatan in #1591
- fix: Better regex that includes potential query parameters by @reczkok in #1642
- fix: Throw error when accessing matrix elements directly by @aleksanderkatan in #1625
- fix: Wider abstractInt range by @reczkok in #1635
- fix: Export sampler types by @iwoplaza in #1866
- refactor: Common ShaderGenerator interface by @lursz in #1628
- fix: Narrow types in std by @aleksanderkatan in #1683
- fix: Add missing validation types to the public API by @reczkok in #1706
- fix: Change visibility of mutable resources in bindGroupLayout by @cieplypolar in #1669
- fix: Better numeric schema names by @iwoplaza in #1672
- fix: Fix nested compiled writers and enable them for initial data by @reczkok in #1670
- fix: Accessor type inference by @iwoplaza in #1695
- fix: WGSL keywords among identifiers by @aleksanderkatan in #1607
- fix:
dualImplthrows with missingcpuImplby @aleksanderkatan in #1752 - fix: not filtering builtin outputs out of the fragment shader by @lursz in #1779
- fix: Don't track buffers and textures just to dispose of them by @iwoplaza in #1769
- fix: Big int handling by @aleksanderkatan in #1758
📖 Docs/DX
- docs: "Jelly Slider" example by @reczkok in #1791, #1871
- docs: "2d Slime Mold" simulation by @reczkok in #1776
- docs: "3d Slime Mold" simulation by @reczkok in #1774
- docs: "Disco" example by @collectioneur and @lursz in #1656, #1715, #1722, #1765, #1716
- docs: "Liquid Glass" example by @reczkok in #1643
- docs: "Phong reflection mode" example by @aleksanderkatan in #1781
- docs: Rework examples that use video input and publish them again on iOS safari by @reczkok in #1555
- docs: Index buffers by @lursz in #1496
- test: Create tests for code produced by examples by @reczkok in #1631
- docs: Textures and Samplers by @reczkok in #1868
- docs: TypeGPU functions by @iwoplaza in #1793
- docs: Utilize subgroups in MNIST Inference when possible and rewrite in JS by @reczkok in #986
- docs: Lazy load thumbnails to improve load time by @reczkok in #1857
- chore: Single node version in CI by @iwoplaza in #1679
- docs: DEV-only examples (for drafts & tests) by @iwoplaza in #1685
- docs: Using shell-less functions in examples by @iwoplaza in #1719
- docs: Merge increment examples, and simplify by @iwoplaza in #1720
- chore: Simplify tests using inline snapshots by @iwoplaza in #1756
- docs: Fixed buffers by @aleksanderkatan in #1780
- fix(docs): Missing
onCleanup, updategravitytest by @cieplypolar in #1821 - docs: ShaderHunt waiting list sign-up form by @iwoplaza in #1823, #1832
- docs: Using rolldown in translator app by @iwoplaza in #1611
Full Changelog: v0.7.1...v0.8.0
typegpu v0.7.1, @typegpu/color v0.7.0, @typegpu/noise v0.7.0, @typegpu/sdf v0.7.0
- bump: typegpu 0.7.1, @typegpu/color 0.7.0, @typegpu/noise 0.7.0, @typegpu/sdf 0.7.0 by @iwoplaza in #1596
🚀 Features
- feat: Add all numeric and derivative std (some with no cpu implementation) by @reczkok in #1567
- feat: Callable unstructs and disarrays by @aleksanderkatan in #1584
- feat: Array partial schemas by @cieplypolar in #1581
🗿 Fixes / Stability
- fix: More accurate inference for slots & derived by @iwoplaza in #1575
- fix: Coercing externals to proper types by @iwoplaza in #1577
- fix: Resolving in dualImpl by @iwoplaza in #1588
- fix: Unify operand types in arithmetic operators by @reczkok in #1603
📖 Docs / DX
- docs: Better loading state for examples page by @iwoplaza in #1539
- docs: Update Data Schemas page, remove Data Schema Cheatsheet by @aleksanderkatan in #1512
- docs: Vaporrave example by @cieplypolar in #1548
- docs: @typegpu/noise by @iwoplaza in #1391
- docs: Add struct copy example by @aleksanderkatan in #1595
- build(deps): bump lucide-react from 0.525.0 to 0.536.0 by @dependabot[bot] in #1565
Full Changelog: v0.7.0...v0.7.1
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
TgpuQuerySetby @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:
resolveWithContextin 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
wgslGeneratorby @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