Skip to content

Impr: More restrictive bool constructor and unary operator ! - #2739

Open
cieplypolar wants to merge 4 commits into
fix/unify-test-in-ternaryfrom
impr/restrictive-bool-constructor
Open

Impr: More restrictive bool constructor and unary operator !#2739
cieplypolar wants to merge 4 commits into
fix/unify-test-in-ternaryfrom
impr/restrictive-bool-constructor

Conversation

@cieplypolar

Copy link
Copy Markdown
Collaborator

Closes #2701.

@github-actions

github-actions Bot commented Jul 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/eslint-plugin-typegpu@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@3c6fa4c87ac428aea3563937675dce7cc09462e0
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@3c6fa4c87ac428aea3563937675dce7cc09462e0

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jul 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.94, 1.85, 4.04, 6.07, 7.30, 12.12, 23.08, 23.00]
  line [0.94, 1.85, 4.19, 6.24, 7.38, 10.97, 23.04, 24.75]
  line [0.95, 2.03, 4.36, 6.95, 7.57, 11.36, 22.65, 24.39]
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.31, 0.52, 0.65, 0.87, 1.10, 1.15, 1.39, 1.53]
  line [0.32, 0.52, 0.70, 0.84, 1.08, 1.17, 1.42, 1.53]
  line [0.34, 0.55, 0.71, 0.89, 1.14, 1.15, 1.45, 1.61]
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.78, 2.15, 3.46, 6.81, 12.76, 25.75, 53.94, 110.20]
  line [0.82, 2.11, 4.45, 6.92, 13.21, 25.44, 52.69, 108.55]
  line [0.89, 2.05, 4.30, 6.52, 13.12, 26.48, 55.81, 113.74]
Loading

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

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

🟢 Decreased ➖ Unchanged 🔴 Increased (max 5.53%) ❔ Unknown
0 37 285 0

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

Click to reveal the results table (263 entries).
Test tsdown
d_bool.ts 13.93 kB ($${\color{red}+5.5\%}$$)
d_f16.ts 13.93 kB ($${\color{red}+5.5\%}$$)
d_f32.ts 13.93 kB ($${\color{red}+5.5\%}$$)
d_i32.ts 13.93 kB ($${\color{red}+5.5\%}$$)
d_u32.ts 13.93 kB ($${\color{red}+5.5\%}$$)
d_u16.ts 13.96 kB ($${\color{red}+5.5\%}$$)
d_textureDepth2d.ts 14.38 kB ($${\color{red}+5.3\%}$$)
d_textureDepthCube.ts 14.38 kB ($${\color{red}+5.3\%}$$)
d_texture1d.ts 14.39 kB ($${\color{red}+5.3\%}$$)
d_texture2d.ts 14.39 kB ($${\color{red}+5.3\%}$$)
d_texture3d.ts 14.39 kB ($${\color{red}+5.3\%}$$)
d_textureCube.ts 14.39 kB ($${\color{red}+5.3\%}$$)
d_textureDepth2dArray.ts 14.39 kB ($${\color{red}+5.3\%}$$)
d_textureDepthCubeArray.ts 14.40 kB ($${\color{red}+5.3\%}$$)
d_textureDepthMultisampled2d.ts 14.40 kB ($${\color{red}+5.3\%}$$)
d_texture2dArray.ts 14.40 kB ($${\color{red}+5.3\%}$$)
d_textureCubeArray.ts 14.41 kB ($${\color{red}+5.3\%}$$)
d_textureMultisampled2d.ts 14.41 kB ($${\color{red}+5.3\%}$$)
std_discard.ts 15.22 kB ($${\color{red}+5.0\%}$$)
std_isBeingTranspiled.ts 15.31 kB ($${\color{red}+5.0\%}$$)
std_getTargetShaderLanguage.ts 15.38 kB ($${\color{red}+5.0\%}$$)
std_extensionEnabled.ts 15.43 kB ($${\color{red}+5.0\%}$$)
std_copy.ts 15.47 kB ($${\color{red}+4.9\%}$$)
std_arrayLength.ts 15.47 kB ($${\color{red}+4.9\%}$$)
std_range.ts 15.70 kB ($${\color{red}+4.9\%}$$)
d_disarrayOf.ts 15.87 kB ($${\color{red}+4.8\%}$$)
std_dpdx.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_dpdxCoarse.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_dpdxFine.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_dpdy.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_dpdyCoarse.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_dpdyFine.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_fwidth.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_fwidthCoarse.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_fwidthFine.ts 16.19 kB ($${\color{red}+4.7\%}$$)
std_atomicLoad.ts 16.99 kB ($${\color{red}+4.5\%}$$)
std_atomicStore.ts 16.99 kB ($${\color{red}+4.5\%}$$)
std_textureBarrier.ts 16.99 kB ($${\color{red}+4.5\%}$$)
std_atomicAdd.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicAnd.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicMax.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicMin.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicOr.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicSub.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_atomicXor.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_storageBarrier.ts 17.00 kB ($${\color{red}+4.5\%}$$)
std_workgroupBarrier.ts 17.00 kB ($${\color{red}+4.5\%}$$)
d_vec2b.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec2f.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec2h.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec2i.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec2u.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec3b.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec3f.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec3h.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec3i.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec3u.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec4b.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec4f.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec4h.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec4i.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_vec4u.ts 20.36 kB ($${\color{red}+3.7\%}$$)
d_uint8.ts 21.86 kB ($${\color{red}+3.5\%}$$)
d_float16.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float16x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float16x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float32.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float32x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float32x3.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_float32x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint16.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint16x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint16x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint32.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint32x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint32x3.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint32x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint8.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint8x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_sint8x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm16.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm16x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm16x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm8.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm8x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_snorm8x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint16.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint16x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint16x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint32.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint32x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint32x3.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint32x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint8x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_uint8x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm10_10_10_2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm16.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm16x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm16x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm8.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm8x2.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm8x4.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_unorm8x4_bgra.ts 21.87 kB ($${\color{red}+3.5\%}$$)
d_formatToWGSLType.ts 21.86 kB ($${\color{red}+3.5\%}$$)
d_packedFormats.ts 21.88 kB ($${\color{red}+3.4\%}$$)
d_isPackedData.ts 21.93 kB ($${\color{red}+3.4\%}$$)
d_alignmentOf.ts 22.81 kB ($${\color{red}+3.3\%}$$)
std_subgroupAdd.ts 25.31 kB ($${\color{red}+3.0\%}$$)
std_subgroupAll.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupAnd.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupAny.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupBallot.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupBroadcast.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupBroadcastFirst.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupElect.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupExclusiveAdd.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupExclusiveMul.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupInclusiveAdd.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupInclusiveMul.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupMax.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupMin.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupMul.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupOr.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupShuffle.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupShuffleDown.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupShuffleUp.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupShuffleXor.ts 25.32 kB ($${\color{red}+3.0\%}$$)
std_subgroupXor.ts 25.32 kB ($${\color{red}+3.0\%}$$)
d_isBuiltin.ts 25.54 kB ($${\color{red}+2.9\%}$$)
d_sizeOf.ts 25.59 kB ($${\color{red}+2.9\%}$$)
d_isContiguous.ts 25.60 kB ($${\color{red}+2.9\%}$$)
d_getLongestContiguousPrefix.ts 25.61 kB ($${\color{red}+2.9\%}$$)
std_textureDimensions.ts 26.92 kB ($${\color{red}+2.8\%}$$)
std_textureGather.ts 26.92 kB ($${\color{red}+2.8\%}$$)
std_textureLoad.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSample.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleBaseClampToEdge.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleBias.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleCompare.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleCompareLevel.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleGrad.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureSampleLevel.ts 26.93 kB ($${\color{red}+2.8\%}$$)
std_textureStore.ts 26.93 kB ($${\color{red}+2.8\%}$$)
d_arrayOf.ts 27.03 kB ($${\color{red}+2.8\%}$$)
d_size.ts 27.28 kB ($${\color{red}+2.7\%}$$)
d_align.ts 27.28 kB ($${\color{red}+2.7\%}$$)
d_location.ts 27.28 kB ($${\color{red}+2.7\%}$$)
d_interpolate.ts 27.28 kB ($${\color{red}+2.7\%}$$)
d_invariant.ts 27.65 kB ($${\color{red}+2.7\%}$$)
std_identity2.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_identity3.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_identity4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_rotationX4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_rotationY4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_rotationZ4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_scaling4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
d_mat4x4f.ts 27.98 kB ($${\color{red}+2.7\%}$$)
d_mat2x2f.ts 27.98 kB ($${\color{red}+2.7\%}$$)
d_mat3x3f.ts 27.98 kB ($${\color{red}+2.7\%}$$)
std_translation4.ts 27.98 kB ($${\color{red}+2.7\%}$$)
d_matToArray.ts 28.11 kB ($${\color{red}+2.7\%}$$)
d_builtin.ts 29.49 kB ($${\color{red}+2.5\%}$$)
std_pack2x16float.ts 37.03 kB ($${\color{red}+2.0\%}$$)
std_pack4x8unorm.ts 37.03 kB ($${\color{red}+2.0\%}$$)
std_unpack2x16float.ts 37.03 kB ($${\color{red}+2.0\%}$$)
std_unpack4x8unorm.ts 37.03 kB ($${\color{red}+2.0\%}$$)
common_fullScreenTriangle.ts 41.30 kB ($${\color{red}+1.8\%}$$)
common_writeSoA.ts 42.15 kB ($${\color{red}+1.8\%}$$)
d_memoryLayoutOf.ts 42.91 kB ($${\color{red}+1.7\%}$$)
STATIC_common.ts 58.07 kB ($${\color{red}+1.3\%}$$)
std_bitcastF32toU32.ts 47.59 kB ($${\color{red}+1.1\%}$$)
std_bitcastU32toF32.ts 47.59 kB ($${\color{red}+1.1\%}$$)
std_bitcastU32toI32.ts 47.59 kB ($${\color{red}+1.1\%}$$)
std_bitcast.ts 47.60 kB ($${\color{red}+1.1\%}$$)
std_neg.ts 49.40 kB ($${\color{red}+1.1\%}$$)
std_add.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_bitShiftLeft.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_bitShiftRight.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_div.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_mod.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_mul.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_sub.ts 49.41 kB ($${\color{red}+1.1\%}$$)
std_rotateX4.ts 50.24 kB ($${\color{red}+1.1\%}$$)
std_scale4.ts 50.24 kB ($${\color{red}+1.1\%}$$)
std_translate4.ts 50.24 kB ($${\color{red}+1.1\%}$$)
std_rotateY4.ts 50.25 kB ($${\color{red}+1.1\%}$$)
std_rotateZ4.ts 50.25 kB ($${\color{red}+1.1\%}$$)
std_dot.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_length.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_distance.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_dot4U8Packed.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_fract.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_frexp.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_mix.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_modf.ts 67.94 kB ($${\color{red}+0.8\%}$$)
std_abs.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_acos.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_acosh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_asin.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_asinh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_atan.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_atan2.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_atanh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_ceil.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_clamp.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_cos.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_cosh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_countLeadingZeros.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_countOneBits.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_countTrailingZeros.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_cross.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_degrees.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_determinant.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_dot4I8Packed.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_exp.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_exp2.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_extractBits.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_faceForward.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_firstLeadingBit.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_firstTrailingBit.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_floor.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_fma.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_insertBits.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_inverseSqrt.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_ldexp.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_log.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_log2.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_max.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_min.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_normalize.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_pow.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_quantizeToF16.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_radians.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_reflect.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_refract.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_reverseBits.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_round.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_saturate.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_sign.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_sin.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_sinh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_smoothstep.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_sqrt.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_step.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_tan.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_tanh.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_transpose.ts 67.95 kB ($${\color{red}+0.8\%}$$)
std_trunc.ts 67.95 kB ($${\color{red}+0.8\%}$$)
STATIC_d.ts 88.44 kB ($${\color{red}+0.6\%}$$)
std_and.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_or.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_all.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_allEq.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_eq.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_lt.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_ne.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_not.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_select.ts 52.77 kB ($${\color{red}+0.6\%}$$)
std_any.ts 52.78 kB ($${\color{red}+0.6\%}$$)
std_ge.ts 52.78 kB ($${\color{red}+0.6\%}$$)
std_gt.ts 52.78 kB ($${\color{red}+0.6\%}$$)
std_isCloseTo.ts 52.78 kB ($${\color{red}+0.6\%}$$)
std_le.ts 52.78 kB ($${\color{red}+0.6\%}$$)

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

Test tsdown
tgpu_init.ts 260.07 kB ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 259.56 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 165.77 kB ($${\color{green}-38.3\%}$$)
tgpu_resolveWithContext.ts 165.70 kB ($${\color{green}-38.3\%}$$)
tgpu_bindGroupLayout.ts 69.50 kB ($${\color{green}-74.1\%}$$)
tgpu_mutableAccessor.ts 66.51 kB ($${\color{green}-75.2\%}$$)
tgpu_accessor.ts 66.49 kB ($${\color{green}-75.2\%}$$)
tgpu_privateVar.ts 65.84 kB ($${\color{green}-75.5\%}$$)
tgpu_workgroupVar.ts 65.84 kB ($${\color{green}-75.5\%}$$)
tgpu_const.ts 65.08 kB ($${\color{green}-75.8\%}$$)
tgpu_fn.ts 38.87 kB ($${\color{green}-85.5\%}$$)
tgpu_fragmentFn.ts 38.87 kB ($${\color{green}-85.5\%}$$)
tgpu_vertexFn.ts 38.68 kB ($${\color{green}-85.6\%}$$)
tgpu_computeFn.ts 38.39 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexLayout.ts 27.51 kB ($${\color{green}-89.8\%}$$)
tgpu_comptime.ts 15.21 kB ($${\color{green}-94.3\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

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

@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 — Restrict d.bool() to accept only number | boolean, tighten std.not to booleans and boolean vectors, and make the TGSL unary ! operator reject non-boolean runtime operands.

  • Added documentation warning about JS-truthiness undefined behavior in WGSL.
  • Updated the Bool type to disallow undefined constructor arguments at the type level.
  • Added isVecBoolInstance runtime guard for boolean vector instances.
  • Simplified cpuNot and std.not codegen to only handle booleans and boolean vectors.
  • Updated the WGSL generator's unary ! to throw on non-bool runtime operands and point users to std.not for component-wise vector negation.
  • Added comprehensive tests for the new restrictions and removed obsolete numeric/non-primitive test cases.

✅ No new issues found.

All related test suites pass (numeric, std/boolean/not, tgsl/wgslGenerator, tgsl/sideEffects, and the tgsl-parsing-test individual example).

Pullfrog  | Fix it ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@cieplypolar
cieplypolar force-pushed the impr/restrictive-bool-constructor branch from d47ced9 to c289c5f Compare July 28, 2026 10:20

@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 — All four commits are new since the prior review (force-pushed). Tightened d.bool() to accept only number | boolean with finite-math guard, restricted TGSL unary ! to boolean-only runtime operands, and limited std.not to booleans and boolean vectors.

  • Restricted d.bool() — throws on non-number/non-boolean arguments, enforces finite math, and uses intersection type ((v: number | boolean) => boolean) & (() => boolean) to reject undefined at the type level.
  • Restricted unary ! — runtime operands must be bool; boolean vectors get a helpful error pointing to std.not. Comptime-known operands still fold with JS semantics.
  • Restricted std.not — accepts only boolean | v2b | v3b | v4b, throwing SignatureNotSupportedError for anything else. Removed numeric vector conversion path.
  • Added isVecBoolInstance guard in wgslTypes.ts for boolean-vector instance checks.
  • Added docs warning about JS-truthiness undefined behavior in WGSL, with a concrete example of the !!e loop anti-pattern.
  • Updated tests — comprehensive coverage of new restrictions; removed obsolete numeric/non-primitive test cases for ! and std.not.

The cpuNot implementation preserves correct overloads for (value: boolean): boolean and (value: AnyBooleanVecInstance): AnyBooleanVecInstance. The not import in wgslGenerator.ts is used only for the error-message hint and does not introduce circular dependencies. The side-effects test correctly swapped impureInt for impureBool to match the new boolean-only contract. Generated WGSL for std.not(vecB) simplified from !(v) to !v with no precedence change.

✅ No new issues found.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@cieplypolar
cieplypolar force-pushed the impr/restrictive-bool-constructor branch from c289c5f to 3c6fa4c Compare July 28, 2026 12:06
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.

1 participant