Skip to content

fix: Forbid multiple $uses calls#2621

Open
aleksanderkatan wants to merge 28 commits into
mainfrom
fix/forbid-multiple-uses
Open

fix: Forbid multiple $uses calls#2621
aleksanderkatan wants to merge 28 commits into
mainfrom
fix/forbid-multiple-uses

Conversation

@aleksanderkatan

Copy link
Copy Markdown
Contributor

No description provided.

@aleksanderkatan aleksanderkatan changed the base branch from main to chore/dont-name-externals-in-merge June 17, 2026 09:23
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@88d3b2233c4831f91f9ec656932c5e32446d6de6
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@88d3b2233c4831f91f9ec656932c5e32446d6de6
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@88d3b2233c4831f91f9ec656932c5e32446d6de6
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@88d3b2233c4831f91f9ec656932c5e32446d6de6
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@88d3b2233c4831f91f9ec656932c5e32446d6de6

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 297 23 0

import * as ... in PR vs import * as ... in target (did bundle size increase?):

Test tsdown
common_fullScreenTriangle.ts 40.37 kB ($${\color{red}+1.2\%}$$)
STATIC_common.ts 57.29 kB ($${\color{red}+0.9\%}$$)

import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):

Click to reveal the results table (297 entries).
Test tsdown
d_Void.ts 87.36 kB ($${\color{red}+12087.6\%}$$)
d_sampler.ts 87.36 kB ($${\color{red}+11956.6\%}$$)
d_isPtr.ts 87.36 kB ($${\color{red}+11796.0\%}$$)
d_comparisonSampler.ts 87.37 kB ($${\color{red}+11781.8\%}$$)
d_isSizeAttrib.ts 87.37 kB ($${\color{red}+11765.4\%}$$)
d_isWgslArray.ts 87.37 kB ($${\color{red}+11765.3\%}$$)
d_isAlignAttrib.ts 87.37 kB ($${\color{red}+11749.8\%}$$)
d_isWgslStruct.ts 87.37 kB ($${\color{red}+11749.7\%}$$)
d_isAtomic.ts 87.36 kB ($${\color{red}+11749.1\%}$$)
d_isBuiltinAttrib.ts 87.37 kB ($${\color{red}+11718.8\%}$$)
d_isLocationAttrib.ts 87.37 kB ($${\color{red}+11703.3\%}$$)
d_isDecorated.ts 87.37 kB ($${\color{red}+11702.6\%}$$)
d_isInterpolateAttrib.ts 87.38 kB ($${\color{red}+11657.2\%}$$)
d_atomic.ts 87.36 kB ($${\color{red}+11383.8\%}$$)
d_ptrHandle.ts 87.37 kB ($${\color{red}+10412.6\%}$$)
d_ptrUniform.ts 87.37 kB ($${\color{red}+10400.4\%}$$)
d_ptrStorage.ts 87.37 kB ($${\color{red}+10351.3\%}$$)
d_ptrPrivate.ts 87.37 kB ($${\color{red}+10326.9\%}$$)
d_ptrFn.ts 87.36 kB ($${\color{red}+10314.2\%}$$)
d_ptrWorkgroup.ts 87.37 kB ($${\color{red}+10302.9\%}$$)
d_textureExternal.ts 87.37 kB ($${\color{red}+10148.3\%}$$)
d_textureStorage1d.ts 87.37 kB ($${\color{red}+8527.7\%}$$)
d_textureStorage2d.ts 87.37 kB ($${\color{red}+8527.7\%}$$)
d_textureStorage3d.ts 87.37 kB ($${\color{red}+8527.7\%}$$)
d_textureStorage2dArray.ts 87.38 kB ($${\color{red}+8380.9\%}$$)
d_isDisarray.ts 87.37 kB ($${\color{red}+7754.5\%}$$)
d_isUnstruct.ts 87.37 kB ($${\color{red}+7754.5\%}$$)
d_isLooseDecorated.ts 87.37 kB ($${\color{red}+7707.1\%}$$)
d_isLooseData.ts 87.37 kB ($${\color{red}+7443.3\%}$$)
d_isWgslData.ts 87.37 kB ($${\color{red}+6566.4\%}$$)
d_unstruct.ts 87.36 kB ($${\color{red}+5544.2\%}$$)
d_isData.ts 87.36 kB ($${\color{red}+4733.0\%}$$)
d_deepEqual.ts 87.37 kB ($${\color{red}+3884.9\%}$$)
d_struct.ts 87.36 kB ($${\color{red}+2323.7\%}$$)
d_ref.ts 87.36 kB ($${\color{red}+1724.5\%}$$)
std_discard.ts 103.09 kB ($${\color{red}+626.6\%}$$)
std_copy.ts 103.09 kB ($${\color{red}+614.4\%}$$)
std_arrayLength.ts 103.10 kB ($${\color{red}+614.2\%}$$)
std_isBeingTranspiled.ts 103.10 kB ($${\color{red}+612.7\%}$$)
std_getTargetShaderLanguage.ts 103.11 kB ($${\color{red}+609.5\%}$$)
std_extensionEnabled.ts 103.10 kB ($${\color{red}+607.0\%}$$)
std_range.ts 103.09 kB ($${\color{red}+594.2\%}$$)
std_dpdx.ts 103.09 kB ($${\color{red}+585.8\%}$$)
std_fwidthCoarse.ts 103.10 kB ($${\color{red}+585.6\%}$$)
std_dpdxCoarse.ts 103.10 kB ($${\color{red}+585.6\%}$$)
std_dpdyCoarse.ts 103.10 kB ($${\color{red}+585.6\%}$$)
std_fwidthFine.ts 103.10 kB ($${\color{red}+585.6\%}$$)
std_dpdxFine.ts 103.09 kB ($${\color{red}+585.6\%}$$)
std_dpdyFine.ts 103.09 kB ($${\color{red}+585.6\%}$$)
std_fwidth.ts 103.09 kB ($${\color{red}+585.6\%}$$)
std_dpdy.ts 103.09 kB ($${\color{red}+585.6\%}$$)
d_bool.ts 87.36 kB ($${\color{red}+573.3\%}$$)
d_f16.ts 87.36 kB ($${\color{red}+573.3\%}$$)
d_f32.ts 87.36 kB ($${\color{red}+573.3\%}$$)
d_i32.ts 87.36 kB ($${\color{red}+573.3\%}$$)
d_u32.ts 87.36 kB ($${\color{red}+573.3\%}$$)
d_u16.ts 87.36 kB ($${\color{red}+572.1\%}$$)
std_atomicLoad.ts 103.10 kB ($${\color{red}+553.0\%}$$)
std_textureBarrier.ts 103.10 kB ($${\color{red}+552.8\%}$$)
std_atomicStore.ts 103.10 kB ($${\color{red}+552.8\%}$$)
std_workgroupBarrier.ts 103.10 kB ($${\color{red}+552.5\%}$$)
std_storageBarrier.ts 103.10 kB ($${\color{red}+552.5\%}$$)
std_atomicAdd.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicAnd.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicMax.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicMin.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicSub.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicXor.ts 103.09 kB ($${\color{red}+552.5\%}$$)
std_atomicOr.ts 103.09 kB ($${\color{red}+552.5\%}$$)
d_textureDepth2d.ts 87.37 kB ($${\color{red}+551.1\%}$$)
d_textureDepthCube.ts 87.37 kB ($${\color{red}+550.9\%}$$)
d_texture1d.ts 87.37 kB ($${\color{red}+550.6\%}$$)
d_texture2d.ts 87.37 kB ($${\color{red}+550.6\%}$$)
d_texture3d.ts 87.37 kB ($${\color{red}+550.6\%}$$)
d_textureDepth2dArray.ts 87.38 kB ($${\color{red}+550.3\%}$$)
d_textureCube.ts 87.37 kB ($${\color{red}+550.3\%}$$)
d_textureDepthCubeArray.ts 87.38 kB ($${\color{red}+550.1\%}$$)
d_textureDepthMultisampled2d.ts 87.38 kB ($${\color{red}+550.0\%}$$)
d_texture2dArray.ts 87.37 kB ($${\color{red}+549.8\%}$$)
d_textureCubeArray.ts 87.37 kB ($${\color{red}+549.5\%}$$)
d_textureMultisampled2d.ts 87.38 kB ($${\color{red}+549.4\%}$$)
d_disarrayOf.ts 87.37 kB ($${\color{red}+481.7\%}$$)
d_vec2b.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec2f.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec2h.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec2i.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec2u.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec3b.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec3f.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec3h.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec3i.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec3u.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec4b.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec4f.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec4h.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec4i.ts 87.36 kB ($${\color{red}+350.2\%}$$)
d_vec4u.ts 87.36 kB ($${\color{red}+350.2\%}$$)
std_subgroupAdd.ts 103.10 kB ($${\color{red}+329.9\%}$$)
std_subgroupBroadcastFirst.ts 103.11 kB ($${\color{red}+329.8\%}$$)
std_subgroupExclusiveAdd.ts 103.11 kB ($${\color{red}+329.8\%}$$)
std_subgroupExclusiveMul.ts 103.11 kB ($${\color{red}+329.8\%}$$)
std_subgroupInclusiveAdd.ts 103.11 kB ($${\color{red}+329.8\%}$$)
std_subgroupInclusiveMul.ts 103.11 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleDown.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleXor.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupBroadcast.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffleUp.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupShuffle.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupBallot.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupElect.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupAll.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupAnd.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupAny.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupMax.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupMin.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupMul.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupXor.ts 103.10 kB ($${\color{red}+329.8\%}$$)
std_subgroupOr.ts 103.10 kB ($${\color{red}+329.8\%}$$)
d_formatToWGSLType.ts 87.37 kB ($${\color{red}+318.1\%}$$)
d_uint8.ts 87.36 kB ($${\color{red}+318.0\%}$$)
d_unorm10_10_10_2.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_unorm8x4_bgra.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_float16x2.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_float16x4.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_float32x2.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_float32x3.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_float32x4.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_snorm16x2.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_snorm16x4.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_unorm16x2.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_unorm16x4.ts 87.37 kB ($${\color{red}+317.9\%}$$)
d_sint16x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint16x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint32x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint32x3.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint32x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_snorm8x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_snorm8x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint16x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint16x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint32x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint32x3.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint32x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_unorm8x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_unorm8x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_float16.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_float32.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint8x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint8x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_snorm16.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint8x2.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint8x4.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_unorm16.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint16.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint32.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_snorm8.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint16.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_uint32.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_unorm8.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_sint8.ts 87.36 kB ($${\color{red}+317.9\%}$$)
d_packedFormats.ts 87.37 kB ($${\color{red}+317.5\%}$$)
d_isPackedData.ts 87.37 kB ($${\color{red}+316.7\%}$$)
std_textureDimensions.ts 103.10 kB ($${\color{red}+300.6\%}$$)
std_textureGather.ts 103.10 kB ($${\color{red}+300.6\%}$$)
std_textureSampleBaseClampToEdge.ts 103.11 kB ($${\color{red}+300.5\%}$$)
std_textureSampleCompareLevel.ts 103.11 kB ($${\color{red}+300.5\%}$$)
std_textureSampleCompare.ts 103.11 kB ($${\color{red}+300.5\%}$$)
std_textureSampleLevel.ts 103.10 kB ($${\color{red}+300.5\%}$$)
std_textureSampleBias.ts 103.10 kB ($${\color{red}+300.5\%}$$)
std_textureSampleGrad.ts 103.10 kB ($${\color{red}+300.5\%}$$)
std_textureSample.ts 103.10 kB ($${\color{red}+300.5\%}$$)
std_textureStore.ts 103.10 kB ($${\color{red}+300.5\%}$$)
std_textureLoad.ts 103.10 kB ($${\color{red}+300.5\%}$$)
d_alignmentOf.ts 87.37 kB ($${\color{red}+299.8\%}$$)
std_translation4.ts 103.10 kB ($${\color{red}+282.0\%}$$)
std_rotationX4.ts 103.10 kB ($${\color{red}+282.0\%}$$)
std_rotationY4.ts 103.10 kB ($${\color{red}+282.0\%}$$)
std_rotationZ4.ts 103.10 kB ($${\color{red}+282.0\%}$$)
std_identity2.ts 103.09 kB ($${\color{red}+282.0\%}$$)
std_identity3.ts 103.09 kB ($${\color{red}+282.0\%}$$)
std_identity4.ts 103.09 kB ($${\color{red}+282.0\%}$$)
std_scaling4.ts 103.09 kB ($${\color{red}+282.0\%}$$)
d_isBuiltin.ts 87.37 kB ($${\color{red}+255.5\%}$$)
d_sizeOf.ts 87.36 kB ($${\color{red}+254.8\%}$$)
d_isContiguous.ts 87.37 kB ($${\color{red}+254.7\%}$$)
d_getLongestContiguousPrefix.ts 87.38 kB ($${\color{red}+254.6\%}$$)
d_arrayOf.ts 87.36 kB ($${\color{red}+233.8\%}$$)
d_size.ts 87.36 kB ($${\color{red}+232.0\%}$$)
d_align.ts 87.36 kB ($${\color{red}+232.0\%}$$)
d_location.ts 87.36 kB ($${\color{red}+232.0\%}$$)
d_interpolate.ts 87.37 kB ($${\color{red}+232.0\%}$$)
d_invariant.ts 87.37 kB ($${\color{red}+227.4\%}$$)
d_mat4x4f.ts 87.36 kB ($${\color{red}+223.7\%}$$)
d_mat2x2f.ts 87.36 kB ($${\color{red}+223.7\%}$$)
d_mat3x3f.ts 87.36 kB ($${\color{red}+223.7\%}$$)
d_matToArray.ts 87.37 kB ($${\color{red}+222.1\%}$$)
d_builtin.ts 87.36 kB ($${\color{red}+205.1\%}$$)
std_unpack2x16float.ts 103.10 kB ($${\color{red}+186.8\%}$$)
std_unpack4x8unorm.ts 103.10 kB ($${\color{red}+186.8\%}$$)
std_pack2x16float.ts 103.10 kB ($${\color{red}+186.8\%}$$)
std_pack4x8unorm.ts 103.10 kB ($${\color{red}+186.8\%}$$)
std_bitcastU32toF32.ts 103.10 kB ($${\color{red}+133.3\%}$$)
std_bitcastU32toI32.ts 103.10 kB ($${\color{red}+133.3\%}$$)
std_neg.ts 103.09 kB ($${\color{red}+113.2\%}$$)
std_bitShiftRight.ts 103.10 kB ($${\color{red}+113.2\%}$$)
std_bitShiftLeft.ts 103.10 kB ($${\color{red}+113.2\%}$$)
std_add.ts 103.09 kB ($${\color{red}+113.1\%}$$)
std_div.ts 103.09 kB ($${\color{red}+113.1\%}$$)
std_mod.ts 103.09 kB ($${\color{red}+113.1\%}$$)
std_mul.ts 103.09 kB ($${\color{red}+113.1\%}$$)
std_sub.ts 103.09 kB ($${\color{red}+113.1\%}$$)
std_translate4.ts 103.10 kB ($${\color{red}+109.9\%}$$)
std_rotateX4.ts 103.09 kB ($${\color{red}+109.9\%}$$)
std_scale4.ts 103.09 kB ($${\color{red}+109.9\%}$$)
std_rotateY4.ts 103.09 kB ($${\color{red}+109.8\%}$$)
std_rotateZ4.ts 103.09 kB ($${\color{red}+109.8\%}$$)
d_memoryLayoutOf.ts 87.37 kB ($${\color{red}+108.3\%}$$)
std_and.ts 103.09 kB ($${\color{red}+99.3\%}$$)
std_or.ts 103.09 kB ($${\color{red}+99.3\%}$$)
std_select.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_allEq.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_all.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_not.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_eq.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_lt.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_ne.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_isCloseTo.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_any.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_ge.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_gt.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_le.ts 103.09 kB ($${\color{red}+99.2\%}$$)
std_dot4U8Packed.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_length.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_countTrailingZeros.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_distance.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_dot.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_countLeadingZeros.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_firstTrailingBit.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_firstLeadingBit.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_fract.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_frexp.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_modf.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_quantizeToF16.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_mix.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_countOneBits.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_dot4I8Packed.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_determinant.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_extractBits.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_faceForward.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_inverseSqrt.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_reverseBits.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_insertBits.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_smoothstep.ts 103.10 kB ($${\color{red}+56.2\%}$$)
std_normalize.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_transpose.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_saturate.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_degrees.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_radians.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_reflect.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_refract.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_acosh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_asinh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_atan2.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_atanh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_clamp.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_cross.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_floor.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_ldexp.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_round.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_trunc.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_acos.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_asin.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_atan.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_ceil.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_cosh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_exp2.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_log2.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_sign.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_sinh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_sqrt.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_step.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_tanh.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_abs.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_cos.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_exp.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_fma.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_log.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_max.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_min.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_pow.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_sin.ts 103.09 kB ($${\color{red}+56.2\%}$$)
std_tan.ts 103.09 kB ($${\color{red}+56.2\%}$$)
common_fullScreenTriangle.ts 57.14 kB ($${\color{red}+41.5\%}$$)
common_writeSoA.ts 57.13 kB ($${\color{red}+38.7\%}$$)
STATIC_allImports.ts 287.08 kB ($${\color{green}-1.7\%}$$)
STATIC_d.ts 87.36 kB ($${\color{green}-2.6\%}$$)
STATIC_std.ts 103.08 kB ($${\color{green}-2.7\%}$$)

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

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.82, 1.62, 3.58, 5.75, 6.17, 9.75, 18.67, 22.25]
  line [0.85, 1.64, 3.34, 5.46, 6.35, 9.63, 19.95, 24.12]
  line [0.86, 1.78, 3.90, 5.28, 6.41, 10.59, 18.38, 17.99]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.30, 0.49, 0.60, 0.79, 1.02, 1.04, 1.23, 1.37]
  line [0.30, 0.54, 0.67, 0.81, 1.06, 1.12, 1.28, 1.40]
  line [0.29, 0.54, 0.63, 0.78, 1.03, 1.00, 1.28, 1.40]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.77, 2.04, 3.86, 5.68, 10.77, 22.85, 49.76, 97.34]
  line [0.82, 1.86, 4.48, 6.35, 11.18, 23.40, 48.52, 101.37]
  line [0.91, 1.73, 3.37, 5.46, 10.47, 22.82, 46.55, 95.63]
Loading

Base automatically changed from chore/dont-name-externals-in-merge to main June 19, 2026 11:10
@aleksanderkatan aleksanderkatan force-pushed the fix/forbid-multiple-uses branch from 78ed65c to 7c7faad Compare June 19, 2026 12:03
@aleksanderkatan

Copy link
Copy Markdown
Contributor Author

@pullfrog review, be thorough

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — replaces the recursive mergeExternals / array-based deferred externals model with a structured FnExternals type and mergeFunctionExternals, forbidding multiple $uses() calls and detecting name collisions between user-provided externals and arg/return types.

  • Structured FnExternals type — replaces ExternalMap[] with a typed object carrying userProvided, pluginProvided, args, and out slots, making the source of each external explicit.
  • mergeFunctionExternals — replaces the old recursive mergeExternals with a flat merge that picks pluginProvided over userProvided as a base, then layers args/out on top, throwing on unequal key collisions.
  • Forbid multiple $uses()tgpuDeclare.impl, TgpuRawCodeSnippetImpl, and FnCore.setExternals('userProvided', ...) all throw if $uses has already been called.
  • Forbid $uses on plugin-processed functionssetExternals('userProvided', ...) throws if pluginProvided has already been set.
  • Entry function Out/in externals — gated behind typeof implementation === 'string' in fragment/vertex fn, since the fnCore.resolve TGSL path sets out via the AST's second parameter.
  • Tests — removed obsolete multi-$uses / merge mutation tests from function.test.ts; added name-collision detection tests and multiple $uses throws tests in declare.test.ts, rawCodeSnippet.test.ts, and externals.test.ts.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@aleksanderkatan aleksanderkatan marked this pull request as ready for review June 22, 2026 09:25

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed changes — replaces the multi-call $uses pattern with a single-call constraint and categorized externals system, enabling collision detection between user-provided, plugin-provided, args, and return-type externals.

  • Add FnExternals type with categorized slots — separates userProvided, pluginProvided, args, and out into distinct categories in fnCore.ts, replacing the flat array of ExternalMap.
  • Replace mergeExternals with mergeFunctionExternals — merges the four externals categories at resolve time with collision detection for name conflicts with args/return types.
  • Forbid multiple $uses on declare, rawCodeSnippet, and functions — throws a descriptive error directing users to slots or accessors for overriding.
  • Guard setExternals('out', ...) on string implementations — in tgpuFragmentFn and tgpuVertexFn, only sets out externals for string (raw WGSL) implementations since TGSL implementations handle it inside fnCore.resolve().
  • Add collision detection tests — covers Out/in conflicts in raw WGSL entrypoints, argument collisions, return-type collisions, and redundant (same-value) externals.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/core/function/fnCore.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — fixes the asymmetric pluginProvided guard flagged in the prior review so it catches collisions in both directions, and updates the test suite to match.

  • Bidirectional pluginProvided guard — moved the pluginProvided-vs-userProvided collision check out of the key === 'userProvided' block so it fires regardless of which key is being set, preventing silent drops of user-provided externals during $uses → resolve ordering.
  • Test updates — switched addArgTypesToExternals callbacks to the new setExternals-based API; moved the "does not modify original externals" test from a TGSL to a raw-WGSL function (since TGSL now detects plugin metadata); added explicit tests for $uses on a TGSL function with metadata and $uses called twice on a string function.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@cieplypolar cieplypolar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Left some nits.

this.#externalsToApply.push(dependencyMap);
if (this.#externals !== undefined) {
throw new Error(
"Cannot call '$uses' multiple times. If you wish to override dependencies, use slots or accessors instead.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Cannot call '$uses' multiple times. If you wish to override dependencies, use slots or accessors instead.",
"Cannot call '$uses' multiple times.",

I believe you cannot do that when you use tgpu.declare.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You can't call with on a declare, but you can do this:

  it('...', () => {
    const schemaSlot = tgpu.slot();

    const declarePrivateVar = tgpu['~unstable']
      .declare('var<private> myPrivate : slot;')
      .$uses({ slot: schemaSlot });

    const fn = tgpu.fn([])(() => {
      'use gpu';
      declarePrivateVar;
    });

    expect(tgpu.resolve([fn.with(schemaSlot, d.u32)])).toMatchInlineSnapshot(`
      "var<private> myPrivate : u32;

      fn fn_1() {

      }"
    `);
  });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fair

*/
pluginProvided?: ExternalMap;
/**
* Function arguments, for example `{ in: { S: Schema } }` in `tgpu.fn([Schema])('(arg: S) => {}')`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you check if in is present in the externals?

@aleksanderkatan aleksanderkatan Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked, you were right, 'in' appears only in entrypoints, I'll update the docs

Comment thread packages/typegpu/src/core/resolve/externals.ts Outdated
Comment thread packages/typegpu/src/core/resolve/externals.ts Outdated
`);
});

it("allows an 'in' external in TGSL implemented entrypoints", () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure if this tests checks that in is allowed in externals. The plugin will capture EXT: { in: 1}, which by the way is allowed to use in rawWgsl functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, the following passes just fine:

  it('...', () => {
    const Schema = d.struct({ p: d.u32 });
    const myFn = tgpu.fn([], Schema)`() -> S { let a = EXT.S(); }`.$uses({ EXT: { S: 1 } });

    expect(tgpu.resolve([myFn])).toMatchInlineSnapshot(`
      "struct Schema {
        p: u32,
      }

      fn myFn() -> Schema { let a = 1(); }"
    `);
  });

Without assigning the metadata manually, an 'in' external cannot occur in TGSL, so I'll remove this test

aleksanderkatan and others added 4 commits June 24, 2026 15:05
Co-authored-by: Szymon Szulc <103948576+cieplypolar@users.noreply.github.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — minor documentation suggestion inline.

Reviewed changes — addressed the remaining human review feedback since the last Pullfrog review.

  • Updated fnCore.ts JSDoc — expanded the args externals example to cover entrypoint in usage.
  • Formatted externals.ts — applied the suggested optional-chaining style change in addArgTypesToExternals.
  • Adjusted collision tests — removed the TGSL 'in' external test that couldn't occur naturally and added a nested external name-collision test.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using openrouter/moonshotai/kimi-k2.7-code (free via Pullfrog for OSS) | 𝕏

pluginProvided?: ExternalMap;
/**
* Function arguments, for example `{ S: Schema }` in `tgpu.fn([Schema])('(arg: S) => {}')`,
* or { in: { position: 'position' } } in `fragmentFn({ in: { position: d.builtin.position }, out: d.vec4f, })('...')`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ The fragment example doesn't match how args externals are actually populated: entrypoint inputs are handled via entryInput, and a string value here would resolve to a bare identifier. Consider either a non-entrypoint nested-externals example or removing the fragment reference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wdym

          this.setExternals('args', {
            in: Object.fromEntries(
              entryInput.positionalArgs.map((a) => [a.schemaKey, a.schemaKey]),
            ),
          });
image

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