Skip to content

Conversation

@RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Dec 14, 2025

Description
Same logic as compileAsync(), compileComputeAsync() Prevent freeze in runtime.

Example usage:

await renderer.init()
await renderer.compileComputeAsync([ clearGridKernel, p2g1Kernel, p2g2Kernel, updateGridKernel, g2pKernel ])
await renderer.compileAsync(scene, camera)
renderer.setAnimationLoop( render );

Before:
Screenshot 2025-12-14 at 20 06 57

After:
Screenshot 2025-12-14 at 20 06 28

Also added a basic onProgress callback for both compile and compileCompute:

image

This contribution is funded by Utsubo && Three.js Blocks

@github-actions
Copy link

github-actions bot commented Dec 14, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.34
84.47
355.34
84.47
+0 B
+0 B
WebGPU 617.86
171.37
619.87
171.83
+2.01 kB
+458 B
WebGPU Nodes 616.46
171.13
618.47
171.58
+2.01 kB
+459 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 487.5
119.33
487.5
119.33
+0 B
+0 B
WebGPU 689.3
187.14
691.31
187.6
+2.01 kB
+454 B
WebGPU Nodes 639.15
174.35
641.16
174.81
+2.01 kB
+453 B

@RenaudRohlinger RenaudRohlinger added this to the r183 milestone Dec 14, 2025
@RenaudRohlinger RenaudRohlinger changed the title WebGPURenderer: Introduce compileCompute() WebGPURenderer: Introduce compileComputeAsync() Dec 15, 2025

function reportProgress() {

if ( onProgress !== null ) onProgress( compilationDone / compilationTotal * 100 );
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this calculation should be done on the user side. Maybe we could use ProgressEvent() to follow the pattern used in Loader?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the PR with the ProgressEvent()pattern!

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