Skip to content

docs: Cleanup examples#2265

Open
aleksanderkatan wants to merge 8 commits intoreleasefrom
docs/cleanup-examples
Open

docs: Cleanup examples#2265
aleksanderkatan wants to merge 8 commits intoreleasefrom
docs/cleanup-examples

Conversation

@aleksanderkatan
Copy link
Contributor

@aleksanderkatan aleksanderkatan commented Mar 6, 2026

Changes:

  • remove struct copying test example,
  • use cancelAnimationFrame instead of disposed,
  • use timestamp instead of time.now(), performance.now()
  • remove all implicit casts,
  • some other cleanup.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

📊 Bundle Size Comparison

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 345 0 0

👀 Notable results

Static test results:

No major changes.

Dynamic test results:

No major changes.

📋 All results

Click to reveal the results table (344 entries).
Test tsdown
dataImportEverything.ts 82.25 kB (➖)
dataImportOneDirect.ts 22.03 kB (➖)
dataImportOneStar.ts 22.03 kB (➖)
functionWithUseGpu.ts 282 B (➖)
functionWithoutUseGpu.ts 24 B (➖)
importEntireLibrary.ts 260.10 kB (➖)
stdImportEverything.ts 96.06 kB (➖)
stdImportOneDirect.ts 44.01 kB (➖)
stdImportOneStar.ts 44.01 kB (➖)
tgpuImportEverything.ts 238.38 kB (➖)
tgpuImportOne.ts 238.39 kB (➖)
MissingBindGroupsError from typegpu.ts 1.29 kB (➖)
MissingLinksError from typegpu.ts 208 B (➖)
MissingSlotValueError from typegpu.ts 153 B (➖)
MissingVertexBuffersError from typegpu.ts 1.29 kB (➖)
NotUniformError from typegpu.ts 1.25 kB (➖)
ResolutionError from typegpu.ts 1.48 kB (➖)
Void from typegpudata.ts 676 B (➖)
abs from typegpustd.ts 61.32 kB (➖)
acos from typegpustd.ts 61.32 kB (➖)
acosh from typegpustd.ts 61.32 kB (➖)
add from typegpustd.ts 44.01 kB (➖)
align from typegpudata.ts 23.70 kB (➖)
alignmentOf from typegpudata.ts 19.26 kB (➖)
allEq from typegpustd.ts 46.54 kB (➖)
all from typegpustd.ts 46.54 kB (➖)
and from typegpustd.ts 46.53 kB (➖)
any from typegpustd.ts 46.54 kB (➖)
arrayLength from typegpustd.ts 12.13 kB (➖)
arrayOf from typegpudata.ts 23.91 kB (➖)
asin from typegpustd.ts 61.32 kB (➖)
asinh from typegpustd.ts 61.32 kB (➖)
atan2 from typegpustd.ts 61.32 kB (➖)
atan from typegpustd.ts 61.32 kB (➖)
atanh from typegpustd.ts 61.32 kB (➖)
atomicAdd from typegpustd.ts 13.51 kB (➖)
atomicAnd from typegpustd.ts 13.51 kB (➖)
atomicLoad from typegpustd.ts 13.50 kB (➖)
atomicMax from typegpustd.ts 13.51 kB (➖)
atomicMin from typegpustd.ts 13.51 kB (➖)
atomicOr from typegpustd.ts 13.51 kB (➖)
atomicStore from typegpustd.ts 13.50 kB (➖)
atomicSub from typegpustd.ts 13.51 kB (➖)
atomicXor from typegpustd.ts 13.51 kB (➖)
atomic from typegpudata.ts 715 B (➖)
bitcastU32toF32 from typegpustd.ts 41.40 kB (➖)
bitcastU32toI32 from typegpustd.ts 41.41 kB (➖)
bool from typegpudata.ts 10.70 kB (➖)
builtin from typegpudata.ts 26.26 kB (➖)
ceil from typegpustd.ts 61.32 kB (➖)
clamp from typegpustd.ts 61.32 kB (➖)
common from typegpu.ts 36.24 kB (➖)
comparisonSampler from typegpudata.ts 695 B (➖)
cos from typegpustd.ts 61.32 kB (➖)
cosh from typegpustd.ts 61.32 kB (➖)
countLeadingZeros from typegpustd.ts 61.32 kB (➖)
countOneBits from typegpustd.ts 61.32 kB (➖)
countTrailingZeros from typegpustd.ts 61.32 kB (➖)
cross from typegpustd.ts 61.32 kB (➖)
d from typegpu.ts 82.23 kB (➖)
deepEqual from typegpudata.ts 2.72 kB (➖)
degrees from typegpustd.ts 61.32 kB (➖)
determinant from typegpustd.ts 61.32 kB (➖)
disarrayOf from typegpudata.ts 12.65 kB (➖)
discard from typegpustd.ts 11.89 kB (➖)
distance from typegpustd.ts 61.32 kB (➖)
div from typegpustd.ts 44.01 kB (➖)
dot4I8Packed from typegpustd.ts 61.32 kB (➖)
dot4U8Packed from typegpustd.ts 61.32 kB (➖)
dot from typegpustd.ts 61.31 kB (➖)
dpdxCoarse from typegpustd.ts 12.75 kB (➖)
dpdxFine from typegpustd.ts 12.75 kB (➖)
dpdx from typegpustd.ts 12.74 kB (➖)
dpdyCoarse from typegpustd.ts 12.75 kB (➖)
dpdyFine from typegpustd.ts 12.75 kB (➖)
dpdy from typegpustd.ts 12.75 kB (➖)
eq from typegpustd.ts 46.54 kB (➖)
exp2 from typegpustd.ts 61.32 kB (➖)
exp from typegpustd.ts 61.32 kB (➖)
extensionEnabled from typegpustd.ts 12.21 kB (➖)
extractBits from typegpustd.ts 61.32 kB (➖)
f16 from typegpudata.ts 10.70 kB (➖)
f32 from typegpudata.ts 10.70 kB (➖)
faceForward from typegpustd.ts 61.32 kB (➖)
firstLeadingBit from typegpustd.ts 61.32 kB (➖)
firstTrailingBit from typegpustd.ts 61.32 kB (➖)
float16 from typegpudata.ts 18.22 kB (➖)
float16x2 from typegpudata.ts 18.22 kB (➖)
float16x4 from typegpudata.ts 18.22 kB (➖)
float32 from typegpudata.ts 18.22 kB (➖)
float32x2 from typegpudata.ts 18.22 kB (➖)
float32x3 from typegpudata.ts 18.22 kB (➖)
float32x4 from typegpudata.ts 18.22 kB (➖)
floor from typegpustd.ts 61.32 kB (➖)
fma from typegpustd.ts 61.32 kB (➖)
formatToWGSLType from typegpudata.ts 18.21 kB (➖)
fract from typegpustd.ts 61.32 kB (➖)
frexp from typegpustd.ts 61.32 kB (➖)
fwidthCoarse from typegpustd.ts 12.75 kB (➖)
fwidthFine from typegpustd.ts 12.75 kB (➖)
fwidth from typegpustd.ts 12.75 kB (➖)
ge from typegpustd.ts 46.54 kB (➖)
getLongestContiguousPrefix from typegpudata.ts 22.05 kB (➖)
gt from typegpustd.ts 46.54 kB (➖)
i32 from typegpudata.ts 10.70 kB (➖)
identity2 from typegpustd.ts 24.64 kB (➖)
identity3 from typegpustd.ts 24.64 kB (➖)
identity4 from typegpustd.ts 24.64 kB (➖)
insertBits from typegpustd.ts 61.32 kB (➖)
interpolate from typegpudata.ts 23.71 kB (➖)
invariant from typegpudata.ts 24.08 kB (➖)
inverseSqrt from typegpustd.ts 61.32 kB (➖)
isAccessor from typegpu.ts 72 B (➖)
isAlignAttrib from typegpudata.ts 697 B (➖)
isAtomic from typegpudata.ts 697 B (➖)
isBufferShorthand from typegpu.ts 1.70 kB (➖)
isBuffer from typegpu.ts 86.33 kB (➖)
isBuiltinAttrib from typegpudata.ts 699 B (➖)
isBuiltin from typegpudata.ts 21.98 kB (➖)
isCloseTo from typegpustd.ts 46.54 kB (➖)
isComparisonSampler from typegpu.ts 57.76 kB (➖)
isContiguous from typegpudata.ts 22.04 kB (➖)
isData from typegpudata.ts 2.33 kB (➖)
isDecorated from typegpudata.ts 700 B (➖)
isDisarray from typegpudata.ts 1.63 kB (➖)
isInterpolateAttrib from typegpudata.ts 703 B (➖)
isLazy from typegpu.ts 68 B (➖)
isLocationAttrib from typegpudata.ts 700 B (➖)
isLooseData from typegpudata.ts 1.68 kB (➖)
isLooseDecorated from typegpudata.ts 1.64 kB (➖)
isMutableAccessor from typegpu.ts 80 B (➖)
isPackedData from typegpudata.ts 18.28 kB (➖)
isPtr from typegpudata.ts 694 B (➖)
isSampler from typegpu.ts 57.75 kB (➖)
isSizeAttrib from typegpudata.ts 696 B (➖)
isSlot from typegpu.ts 68 B (➖)
isTexture from typegpu.ts 57.75 kB (➖)
isTgpuComputeFn from typegpu.ts 76 B (➖)
isTgpuFn from typegpu.ts 707 B (➖)
isTgpuFragmentFn from typegpu.ts 77 B (➖)
isTgpuVertexFn from typegpu.ts 75 B (➖)
isUnstruct from typegpudata.ts 1.63 kB (➖)
isUsableAsRender from typegpu.ts 62 B (➖)
isUsableAsSampled from typegpu.ts 63 B (➖)
isUsableAsStorage from typegpu.ts 63 B (➖)
isUsableAsUniform from typegpu.ts 57.74 kB (➖)
isUsableAsVertex from typegpu.ts 86.32 kB (➖)
isVariable from typegpu.ts 59.54 kB (➖)
isWgslArray from typegpudata.ts 696 B (➖)
isWgslData from typegpudata.ts 1.25 kB (➖)
isWgslStruct from typegpudata.ts 697 B (➖)
ldexp from typegpustd.ts 61.32 kB (➖)
le from typegpustd.ts 46.54 kB (➖)
length from typegpustd.ts 61.31 kB (➖)
location from typegpudata.ts 23.71 kB (➖)
log2 from typegpustd.ts 61.32 kB (➖)
log from typegpustd.ts 61.32 kB (➖)
lt from typegpustd.ts 46.54 kB (➖)
mat2x2f from typegpudata.ts 24.63 kB (➖)
mat3x3f from typegpudata.ts 24.63 kB (➖)
mat4x4f from typegpudata.ts 24.63 kB (➖)
matToArray from typegpudata.ts 24.77 kB (➖)
max from typegpustd.ts 61.32 kB (➖)
memoryLayoutOf from typegpudata.ts 39.24 kB (➖)
min from typegpustd.ts 61.32 kB (➖)
mix from typegpustd.ts 61.32 kB (➖)
mod from typegpustd.ts 44.01 kB (➖)
modf from typegpustd.ts 61.32 kB (➖)
mul from typegpustd.ts 44.01 kB (➖)
ne from typegpustd.ts 46.54 kB (➖)
neg from typegpustd.ts 44.01 kB (➖)
normalize from typegpustd.ts 61.32 kB (➖)
not from typegpustd.ts 46.53 kB (➖)
or from typegpustd.ts 46.53 kB (➖)
pack2x16float from typegpustd.ts 33.24 kB (➖)
pack4x8unorm from typegpustd.ts 33.24 kB (➖)
packedFormats from typegpudata.ts 18.24 kB (➖)
pow from typegpustd.ts 61.32 kB (➖)
ptrFn from typegpudata.ts 801 B (➖)
ptrHandle from typegpudata.ts 793 B (➖)
ptrPrivate from typegpudata.ts 800 B (➖)
ptrStorage from typegpudata.ts 798 B (➖)
ptrUniform from typegpudata.ts 794 B (➖)
ptrWorkgroup from typegpudata.ts 802 B (➖)
quantizeToF16 from typegpustd.ts 61.32 kB (➖)
radians from typegpustd.ts 61.32 kB (➖)
ref from typegpudata.ts 4.10 kB (➖)
reflect from typegpustd.ts 61.32 kB (➖)
refract from typegpustd.ts 61.32 kB (➖)
reverseBits from typegpustd.ts 61.32 kB (➖)
rotateX4 from typegpustd.ts 44.77 kB (➖)
rotateY4 from typegpustd.ts 44.77 kB (➖)
rotateZ4 from typegpustd.ts 44.77 kB (➖)
rotationX4 from typegpustd.ts 24.64 kB (➖)
rotationY4 from typegpustd.ts 24.64 kB (➖)
rotationZ4 from typegpustd.ts 24.64 kB (➖)
round from typegpustd.ts 61.32 kB (➖)
sampler from typegpudata.ts 684 B (➖)
saturate from typegpustd.ts 61.32 kB (➖)
scale4 from typegpustd.ts 44.77 kB (➖)
scaling4 from typegpustd.ts 24.64 kB (➖)
select from typegpustd.ts 46.54 kB (➖)
sign from typegpustd.ts 61.32 kB (➖)
sin from typegpustd.ts 61.32 kB (➖)
sinh from typegpustd.ts 61.32 kB (➖)
sint16 from typegpudata.ts 18.22 kB (➖)
sint16x2 from typegpudata.ts 18.22 kB (➖)
sint16x4 from typegpudata.ts 18.22 kB (➖)
sint32 from typegpudata.ts 18.22 kB (➖)
sint32x2 from typegpudata.ts 18.22 kB (➖)
sint32x3 from typegpudata.ts 18.22 kB (➖)
sint32x4 from typegpudata.ts 18.22 kB (➖)
sint8 from typegpudata.ts 18.22 kB (➖)
sint8x2 from typegpudata.ts 18.22 kB (➖)
sint8x4 from typegpudata.ts 18.22 kB (➖)
sizeOf from typegpudata.ts 22.03 kB (➖)
size from typegpudata.ts 23.70 kB (➖)
smoothstep from typegpustd.ts 61.32 kB (➖)
snorm16 from typegpudata.ts 18.22 kB (➖)
snorm16x2 from typegpudata.ts 18.22 kB (➖)
snorm16x4 from typegpudata.ts 18.22 kB (➖)
snorm8 from typegpudata.ts 18.22 kB (➖)
snorm8x2 from typegpudata.ts 18.22 kB (➖)
snorm8x4 from typegpudata.ts 18.22 kB (➖)
sqrt from typegpustd.ts 61.32 kB (➖)
std from typegpu.ts 96.06 kB (➖)
step from typegpustd.ts 61.32 kB (➖)
storageBarrier from typegpustd.ts 13.51 kB (➖)
struct from typegpudata.ts 3.32 kB (➖)
sub from typegpustd.ts 44.01 kB (➖)
subgroupAdd from typegpustd.ts 21.30 kB (➖)
subgroupAll from typegpustd.ts 21.30 kB (➖)
subgroupAnd from typegpustd.ts 21.30 kB (➖)
subgroupAny from typegpustd.ts 21.30 kB (➖)
subgroupBallot from typegpustd.ts 21.30 kB (➖)
subgroupBroadcastFirst from typegpustd.ts 21.30 kB (➖)
subgroupBroadcast from typegpustd.ts 21.30 kB (➖)
subgroupElect from typegpustd.ts 21.30 kB (➖)
subgroupExclusiveAdd from typegpustd.ts 21.30 kB (➖)
subgroupExclusiveMul from typegpustd.ts 21.30 kB (➖)
subgroupInclusiveAdd from typegpustd.ts 21.30 kB (➖)
subgroupInclusiveMul from typegpustd.ts 21.30 kB (➖)
subgroupMax from typegpustd.ts 21.30 kB (➖)
subgroupMin from typegpustd.ts 21.30 kB (➖)
subgroupMul from typegpustd.ts 21.30 kB (➖)
subgroupOr from typegpustd.ts 21.30 kB (➖)
subgroupShuffleDown from typegpustd.ts 21.30 kB (➖)
subgroupShuffleUp from typegpustd.ts 21.30 kB (➖)
subgroupShuffleXor from typegpustd.ts 21.30 kB (➖)
subgroupShuffle from typegpustd.ts 21.30 kB (➖)
subgroupXor from typegpustd.ts 21.30 kB (➖)
tan from typegpustd.ts 61.32 kB (➖)
tanh from typegpustd.ts 61.32 kB (➖)
texture1d from typegpudata.ts 11.15 kB (➖)
texture2dArray from typegpudata.ts 11.17 kB (➖)
texture2d from typegpudata.ts 11.15 kB (➖)
texture3d from typegpudata.ts 11.15 kB (➖)
textureBarrier from typegpustd.ts 13.50 kB (➖)
textureCubeArray from typegpudata.ts 11.17 kB (➖)
textureCube from typegpudata.ts 11.16 kB (➖)
textureDepth2dArray from typegpudata.ts 11.16 kB (➖)
textureDepth2d from typegpudata.ts 11.14 kB (➖)
textureDepthCubeArray from typegpudata.ts 11.16 kB (➖)
textureDepthCube from typegpudata.ts 11.14 kB (➖)
textureDepthMultisampled2d from typegpudata.ts 11.16 kB (➖)
textureDimensions from typegpustd.ts 22.68 kB (➖)
textureExternal from typegpudata.ts 815 B (➖)
textureGather from typegpustd.ts 22.68 kB (➖)
textureLoad from typegpustd.ts 22.69 kB (➖)
textureMultisampled2d from typegpudata.ts 11.17 kB (➖)
textureSampleBaseClampToEdge from typegpustd.ts 22.69 kB (➖)
textureSampleBias from typegpustd.ts 22.69 kB (➖)
textureSampleCompareLevel from typegpustd.ts 22.69 kB (➖)
textureSampleCompare from typegpustd.ts 22.69 kB (➖)
textureSampleLevel from typegpustd.ts 22.69 kB (➖)
textureSample from typegpustd.ts 22.69 kB (➖)
textureStorage1d from typegpudata.ts 979 B (➖)
textureStorage2dArray from typegpudata.ts 997 B (➖)
textureStorage2d from typegpudata.ts 979 B (➖)
textureStorage3d from typegpudata.ts 979 B (➖)
textureStore from typegpustd.ts 22.69 kB (➖)
tgpu.accessor from typegpu.ts 59.50 kB (➖)
tgpu.bindGroupLayout from typegpu.ts 66.64 kB (➖)
tgpu.comptime from typegpu.ts 11.99 kB (➖)
tgpu.computeFn from typegpu.ts 33.01 kB (➖)
tgpu.const from typegpu.ts 58.61 kB (➖)
tgpu.fn from typegpu.ts 33.66 kB (➖)
tgpu.fragmentFn from typegpu.ts 33.17 kB (➖)
tgpu.initFromDevice from typegpu.ts 229.67 kB (➖)
tgpu.init from typegpu.ts 230.18 kB (➖)
tgpu.lazy from typegpu.ts 1.16 kB (➖)
tgpu.mutableAccessor from typegpu.ts 59.51 kB (➖)
tgpu.privateVar from typegpu.ts 59.54 kB (➖)
tgpu.resolveWithContext from typegpu.ts 172.59 kB (➖)
tgpu.resolve from typegpu.ts 172.65 kB (➖)
tgpu.slot from typegpu.ts 1.59 kB (➖)
tgpu.unroll from typegpu.ts 2.53 kB (➖)
tgpu.vertexFn from typegpu.ts 33.14 kB (➖)
tgpu.vertexLayout from typegpu.ts 24.04 kB (➖)
tgpu.workgroupVar from typegpu.ts 59.54 kB (➖)
tgpu from typegpu.ts 238.39 kB (➖)
translate4 from typegpustd.ts 44.77 kB (➖)
translation4 from typegpustd.ts 24.64 kB (➖)
transpose from typegpustd.ts 61.32 kB (➖)
trunc from typegpustd.ts 61.32 kB (➖)
u16 from typegpudata.ts 10.72 kB (➖)
u32 from typegpudata.ts 10.70 kB (➖)
uint16 from typegpudata.ts 18.22 kB (➖)
uint16x2 from typegpudata.ts 18.22 kB (➖)
uint16x4 from typegpudata.ts 18.22 kB (➖)
uint32 from typegpudata.ts 18.22 kB (➖)
uint32x2 from typegpudata.ts 18.22 kB (➖)
uint32x3 from typegpudata.ts 18.22 kB (➖)
uint32x4 from typegpudata.ts 18.22 kB (➖)
uint8 from typegpudata.ts 18.21 kB (➖)
uint8x2 from typegpudata.ts 18.22 kB (➖)
uint8x4 from typegpudata.ts 18.22 kB (➖)
unorm10 10 10 2 from typegpudata.ts 18.22 kB (➖)
unorm16 from typegpudata.ts 18.22 kB (➖)
unorm16x2 from typegpudata.ts 18.22 kB (➖)
unorm16x4 from typegpudata.ts 18.22 kB (➖)
unorm8 from typegpudata.ts 18.22 kB (➖)
unorm8x2 from typegpudata.ts 18.22 kB (➖)
unorm8x4 bgra from typegpudata.ts 18.22 kB (➖)
unorm8x4 from typegpudata.ts 18.22 kB (➖)
unpack2x16float from typegpustd.ts 33.24 kB (➖)
unpack4x8unorm from typegpustd.ts 33.24 kB (➖)
unstruct from typegpudata.ts 1.59 kB (➖)
vec2b from typegpudata.ts 16.73 kB (➖)
vec2f from typegpudata.ts 16.73 kB (➖)
vec2h from typegpudata.ts 16.73 kB (➖)
vec2i from typegpudata.ts 16.73 kB (➖)
vec2u from typegpudata.ts 16.73 kB (➖)
vec3b from typegpudata.ts 16.73 kB (➖)
vec3f from typegpudata.ts 16.73 kB (➖)
vec3h from typegpudata.ts 16.73 kB (➖)
vec3i from typegpudata.ts 16.73 kB (➖)
vec3u from typegpudata.ts 16.73 kB (➖)
vec4b from typegpudata.ts 16.73 kB (➖)
vec4f from typegpudata.ts 16.73 kB (➖)
vec4h from typegpudata.ts 16.73 kB (➖)
vec4i from typegpudata.ts 16.73 kB (➖)
vec4u from typegpudata.ts 16.73 kB (➖)
workgroupBarrier from typegpustd.ts 13.51 kB (➖)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@729eb82dedc3c9e994f6822639cc90d1dcc0c64b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@729eb82dedc3c9e994f6822639cc90d1dcc0c64b
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@729eb82dedc3c9e994f6822639cc90d1dcc0c64b

benchmark
view benchmark

commit
view commit

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up multiple TypeGPU docs examples by standardizing animation timing (RAF timestamp), improving cleanup (canceling RAF), removing an obsolete “copy-error” example + test, and tightening GPU-side typing to avoid implicit casts.

Changes:

  • Removed the copy-error docs example and its corresponding test.
  • Refactored many examples to use RAF timestamp/lastTime for delta-time calculations and to cancel scheduled frames on cleanup.
  • Adjusted various shader/example code paths to remove implicit casts (e.g., explicit d.f32(...), stricter comparisons).

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/typegpu/tests/examples/individual/copy-error.test.ts Removes the “copy error” example test from the package test suite.
apps/typegpu-docs/src/examples/tests/copy-error/meta.json Removes docs metadata for the deleted “copy-error” example.
apps/typegpu-docs/src/examples/tests/copy-error/index.ts Removes the deleted “copy-error” example implementation.
apps/typegpu-docs/src/examples/tests/copy-error/index.html Removes the deleted “copy-error” example page content.
apps/typegpu-docs/src/examples/threejs/compute-cloth/verlet.ts Makes isFixed check explicit (isFixed === 1) to avoid truthy casting.
apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts Switches first-frame timing to lastTime: number | null and uses RAF timestamp for dt.
apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts Uses RAF timestamp parameter instead of calling performance.now() inside the loop.
apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts Tracks RAF id and cancels it during cleanup.
apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts Uses nullable lastTime and RAF timestamp to compute dt safely.
apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts Replaces “disposed flag” loop with RAF id cancellation; uses RAF timestamp in tick.
apps/typegpu-docs/src/examples/simulation/confetti/index.ts Replaces “disposed flag” loop with RAF id cancellation and RAF timestamp dt.
apps/typegpu-docs/src/examples/simulation/boids/index.ts Replaces “disposed flag” loop with RAF id cancellation.
apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts Removes implicit casts by making blur offset multiplication explicitly f32.
apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts Replaces “disposed flag” loop with RAF id cancellation and simplifies frame scheduling.
apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts Tightens GPU numeric types and adds RAF id tracking for cleanup.
apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts Removes implicit casts by making shader constants explicitly f32.
apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts Removes implicit casts by making shader constants explicitly f32.
apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts Changes uniform initialization/write flow and refactors resize logic into a shared updater.
apps/typegpu-docs/src/examples/rendering/disco/index.ts Switches to RAF timestamp-based time uniform and adds RAF cancellation on cleanup.
apps/typegpu-docs/src/examples/rendering/clouds/index.ts Switches to RAF timestamp-based time uniform and keeps RAF cancellation on cleanup.
apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts Replaces “disposed flag” loop with RAF id cancellation and RAF timestamp dt.
apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts Replaces “disposed flag” loop with RAF id cancellation (but leaves a timeout path).
apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts Replaces “disposed flag” loop with RAF id cancellation.
Comments suppressed due to low confidence (1)

apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts:84

  • The setTimeout callback in enqueuePresetChanges() no longer checks whether the example has been cleaned up. If onCleanup() runs before the 300ms timeout fires, this callback can still write to GPU buffers / touch DOM after root.destroy(), causing errors. Store the timeout id and clearTimeout() in onCleanup(), or reintroduce a disposed/aborted guard in the callback.
  fishBehaviorBuffer.write(presets.init);

  setTimeout(() => {
    fishBehaviorBuffer.write(presets.default);
    spinnerBackground.style.display = 'none';
    speedMultiplier = 1;
  }, 300);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Aleksander Katan added 2 commits March 6, 2026 15:16
@aleksanderkatan aleksanderkatan marked this pull request as ready for review March 6, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants