Skip to content

Conversation

cmhhelgeson
Copy link
Contributor

Related issue: #31735

Description

Fixes bitcast functionality on WebGPU backend. Bitcast functionality was previously not working since the MathNode could not resolve getNodeType from the type string passed to bitcast.

@cmhhelgeson cmhhelgeson changed the title Cmh/fix bitcast wgsl MathNode - Fix TSL Bitcast on WebGPUBackend Aug 26, 2025
Copy link

github-actions bot commented Aug 26, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.91
79.11
338.91
79.11
+0 B
+0 B
WebGPU 578.39
159.34
578.96
159.5
+570 B
+156 B
WebGPU Nodes 577
159.1
577.57
159.26
+570 B
+158 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 470.78
113.9
470.78
113.9
+0 B
+0 B
WebGPU 648.93
175.37
649.16
175.44
+232 B
+71 B
WebGPU Nodes 603.02
164.5
603.25
164.57
+232 B
+69 B

@mrdoob mrdoob added the TSL Three.js Shading Language label Aug 26, 2025
@sunag sunag added this to the r180 milestone Aug 26, 2025
@sunag sunag changed the title MathNode - Fix TSL Bitcast on WebGPUBackend TSL: Fix bitcast type resolver Aug 26, 2025
@cmhhelgeson
Copy link
Contributor Author

cmhhelgeson commented Aug 26, 2025

Githack below just arbitrarily modifies webgpu_compute_geometry to use bitcasting on instanceIndex, and demonstrates the bitcast working by logging the compute shader that uses it.

https://raw.githack.com/cmhhelgeson/three.js/cmh/fix_bitcast_wgsl_test/examples/webgpu_compute_geometry.html

image

@sunag sunag merged commit b261c86 into mrdoob:dev Aug 27, 2025
9 checks passed
@cmhhelgeson cmhhelgeson deleted the cmh/fix_bitcast_wgsl branch August 27, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TSL Three.js Shading Language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants