Skip to content

Conversation

@aleksanderkatan
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the prepareDispatch function to return a PreparedDispatch class instance instead of directly returning a dispatch function. The key enhancement is making prepared dispatches "withable" by adding support for binding different bind groups to the same dispatch pipeline.

  • Introduces a new PreparedDispatch class that wraps the dispatch functionality and adds a with() method
  • Updates the return type of prepareDispatch to return PreparedDispatch<TArgs> instead of DispatchForArgs<TArgs>
  • Modifies all existing usage to call .dispatch() on the returned object instead of calling the function directly

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/typegpu/src/prepareDispatch.ts Core implementation adding PreparedDispatch class and with() method
apps/typegpu-docs/src/examples/tests/log-test/index.ts Updates all prepareDispatch calls to use .dispatch()
apps/typegpu-docs/src/examples/tests/dispatch/index.ts Updates calls and adds new test for bind group functionality
apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts Updates variable naming and dispatch call
apps/typegpu-docs/src/content/docs/fundamentals/utils.mdx Updates documentation to reflect new API
packages/typegpu/tests/examples/individual/dispatch.test.ts Updates test expectations for generated WGSL

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Sep 18, 2025

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@bd37fabcfc29ac7bc6e1b57e18795a5bfb8f9767
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@bd37fabcfc29ac7bc6e1b57e18795a5bfb8f9767
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@bd37fabcfc29ac7bc6e1b57e18795a5bfb8f9767

benchmark
view benchmark

commit
view commit

@aleksanderkatan aleksanderkatan marked this pull request as ready for review September 18, 2025 16:04
Copy link
Collaborator

@iwoplaza iwoplaza left a comment

Choose a reason for hiding this comment

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

Looks good! 🫡

@aleksanderkatan aleksanderkatan merged commit d9a4b3f into main Sep 26, 2025
5 checks passed
@aleksanderkatan aleksanderkatan deleted the feat/make-preparedispatch-withable branch October 10, 2025 15:45
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.

feat: Make prepareDispatch return a special object with a .dispatch method, not a function.

3 participants