Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Preparation for dispatchWorkgroupsIndirect#31026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Spiri0 wants to merge3 commits intomrdoob:dev
base:dev
Choose a base branch
Loading
fromSpiri0:dispatchWorkgroupsIndirect

Conversation

Spiri0
Copy link
Contributor

Related issue:#30982

This is the preparation fordispatchWorkgroupsIndirect

This allows an indirect buffer to be passed to the compute node, similar to the geometry. This indirect buffer has nothing to do with drawIndirect!
However, it is a very similar functionality to drawIndirect. This indirect buffer can be used to dynamically change the workgroup size with the GPU. This functionality can basically be used with any compute shader independent of drawIndirect.
In itself, the matter is quite simple, because the buffer simply needs to be passed to the passEncoderGPU, like this:

if ( indirect !== null ) {const buffer = this.get( indirect ).buffer;passEncoderGPU.dispatchWorkgroupsIndirect( buffer, 0 );} else {passEncoderGPU.dispatchWorkgroups(dispatchSize.x,dispatchSize.y,dispatchSize.z);}

However, I have not yet found the right place for the intermediate step in the compute routine that would actually retrieve the GPUBuffer withthis.get( indirect )
But that would be all there is to it. Fortunately, this functionality is much less complex, since the most important part is already present with the IndirectStorageBufferAttribute.

Here's a pure webgpu example. You can see the application in the line: 180

https://codepen.io/Spiri0/pen/zxxdgYZ

The triangle is normally RGB colored. The compute shader executed with dispatchWorkgroupsIndirect makes it green

@github-actionsGitHub Actions
Copy link

github-actionsbot commentedApr 29, 2025
edited
Loading

📦 Bundle size

Full ESM build, minified and gzipped.

BeforeAfterDiff
WebGL336.33
78.33
336.33
78.33
+0 B
+0 B
WebGPU547.85
151.9
547.95
151.92
+97 B
+22 B
WebGPU Nodes547.2
151.74
547.3
151.76
+97 B
+21 B

🌳 Bundle size after tree-shaking

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

BeforeAfterDiff
WebGL466.09
112.57
466.09
112.57
+0 B
+0 B
WebGPU623.04
168.7
623.14
168.72
+97 B
+18 B
WebGPU Nodes577.91
158
578.01
158.02
+97 B
+21 B

@Spiri0Spiri0 marked this pull request as draftApril 29, 2025 02:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@Spiri0

[8]ページ先頭

©2009-2025 Movatter.jp