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.17
84.44
355.17
84.44
+0 B
+0 B
WebGPU 618.17
171.68
620.04
172.12
+1.87 kB
+443 B
WebGPU Nodes 616.78
171.43
618.64
171.88
+1.87 kB
+444 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 487.34
119.31
487.34
119.31
+0 B
+0 B
WebGPU 688.81
187.1
690.67
187.52
+1.87 kB
+417 B
WebGPU Nodes 638.65
174.3
640.52
174.73
+1.87 kB
+425 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?

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