Skip to content

TSL: Refine pow2/3/4 implementation and remove the polyfill for pow on Windows - #31720

Merged
sunag merged 3 commits into
mrdoob:devfrom
shotamatsuda:fix/tsl-pow
Aug 23, 2025
Merged

sunag merged 3 commits into
mrdoob:devfrom
shotamatsuda:fix/tsl-pow

Conversation

@shotamatsuda

@shotamatsuda shotamatsuda commented Aug 23, 2025 •

Copy link
Copy Markdown
Contributor

Related issue: #31712

Description

This PR changes the implementation of pow2, pow3, and pow4 to be exact powers of 2, 3, and 4 respectively, regardless of the host implementation of pow.

Additionally, it removes the polyfill for pow on Windows, because it is only valid for odd integer exponents, as explained in the aforementioned issue. This does make the behavior of pow with odd integer exponents unstable on Windows, but it is a reasonable behavior and cannot be avoided unless introducing a precise detection of integer exponents in floating-point numbers.

@github-actions

github-actions Bot commented Aug 23, 2025 •

Copy link
Copy Markdown

πŸ“¦ Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.91
79.1
338.91
79.1
+0 B
+0 B
WebGPU 578.73
159.37
577.78
159.15
-942 B
-215 B
WebGPU Nodes 577.34
159.13
576.39
158.91
-942 B
-215 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 470.7
113.91
470.7
113.91
+0 B
+0 B
WebGPU 649.28
175.4
648.33
175.2
-954 B
-204 B
WebGPU Nodes 603.38
164.55
602.42
164.32
-960 B
-225 B

@sunag sunag added this to the r180 milestone Aug 23, 2025
@sunag

sunag commented Aug 23, 2025

Copy link
Copy Markdown
Collaborator

/cc @brunosimon

@sunag
sunag merged commit 36c9890 into mrdoob:dev Aug 23, 2025
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