Skip to content

feat: Render bundle, .with(pass) and .with(encoder) support#2200

Merged
iwoplaza merged 22 commits intosoftware-mansion:mainfrom
jerzakm:render-bundle
Feb 26, 2026
Merged

feat: Render bundle, .with(pass) and .with(encoder) support#2200
iwoplaza merged 22 commits intosoftware-mansion:mainfrom
jerzakm:render-bundle

Conversation

@jerzakm
Copy link
Copy Markdown
Contributor

@jerzakm jerzakm commented Feb 20, 2026

As a follow up to issue #2194 I started tinkering with render bundles in typeGPU. Code is probably mostly a throwaway - or maybe this or s imilar API could be a wrapper on lower level changes @iwoplaza outlined in #1826 .

Genuinely ignore the implementation code for now, but one thing I'd like feedback on is the example. I struggled to come up with a good one that wil DEFINITELY show off render bundle impact. I made a classic perlin noise terrain made out of cubes.
The terrain is always same size, just amount of cubes can be increased (density of cubes).

At some point, unless you are on a powerful machine the FPS will drop from 60 or whatever and that's when you can first see render bundle impact. For me, perf droped at 262k cubes:

image

Then I enable render bundles and get a few frames:
image

This is not a realistic scenario cause normally you'd just instance these but I wanted to show off draw call impact and perf gain.

@iwoplaza
Copy link
Copy Markdown
Collaborator

Thanks for this! I think the example is fitting. Instancing would be a more fitting solution to the problem as you outlined, but it would be hard to make the objects more varied without making the example overly complex. The WebGPU samples went with a very similar example premise: https://webgpu.github.io/webgpu-samples/?q=bund&sample=renderBundles

@jerzakm
Copy link
Copy Markdown
Contributor Author

jerzakm commented Feb 23, 2026

I'm working through #1826 but I noticed there's quite a lot of active development on the core right now. Should I keep going with this or wait? @iwoplaza
I'm not sure if I should rebase now or just finish the feature and solve conflicts later.

@iwoplaza
Copy link
Copy Markdown
Collaborator

@jerzakm There are no more planned changes for that part of the codebase for the time being. We were stabilizing and adding better defaults, hence the changes, but .with(pass) and .with(encoder) are directly next on the cutting block of functionality for pipelines. I think you can rebase now and expect it to not change much during the lifetime of this PR

@iwoplaza
Copy link
Copy Markdown
Collaborator

Sorry, I lied, I thought we already merged Indirect support 🙇‍♂️

@jerzakm
Copy link
Copy Markdown
Contributor Author

jerzakm commented Feb 24, 2026

renderPipeline has quite a lot of duplication, should there maybe be something similar to _executeComputePass from compute pipeline here?

@jerzakm jerzakm marked this pull request as ready for review February 24, 2026 16:30
@jerzakm
Copy link
Copy Markdown
Contributor Author

jerzakm commented Feb 24, 2026

I think this is kinda ready now for an initial review pass. Let me know if this is roughly correct and I'll work on some tests.

There are two examples right now, one with my initial API and the other one that follows what you outline in that issue. That was mostly for testing, regardless of whether we're going to keep only one or both of these ways, only one example should remain.

Copy link
Copy Markdown
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.

The implementation looks really solid! I submitted a few suggestions based on recent updates in our APIs and capabilities.

As for the two APIs (.with(encoder) and .beginRenderBundleEncoder), I think we could keep them both for now and see which one feels more natural in the end.

Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/index.ts Outdated
Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts Outdated
Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts Outdated
Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts Outdated
Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts Outdated
Comment thread apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts Outdated
Comment thread packages/typegpu/src/core/pipeline/computePipeline.ts
Comment thread packages/typegpu/src/core/pipeline/renderPipeline.ts
@iwoplaza
Copy link
Copy Markdown
Collaborator

Thanks for addressing my comments! I guess the only thing left are tests, and we can merge. Thanks again for taking the time to work on this.

@jerzakm
Copy link
Copy Markdown
Contributor Author

jerzakm commented Feb 26, 2026

Thanks for addressing my comments! I guess the only thing left are tests, and we can merge. Thanks again for taking the time to work on this.

Should I remove one of the examples? Are we going to merge this first and then do docs in another PR or something?
I'm a little short on time for the next few days so it'd be nice to get this in and then do docs or whatever in another PR.

@iwoplaza
Copy link
Copy Markdown
Collaborator

Should I remove one of the examples? Are we going to merge this first and then do docs in another PR or something?
I'm a little short on time for the next few days so it'd be nice to get this in and then do docs or whatever in another PR.

Let's leave both examples in here. I think we can safely do docs in another PR, don't worry about it

Copy link
Copy Markdown
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.

Awesome! Thanks again for working on this. Just ensure the tests pass and let's merge it.

Comment thread packages/typegpu/tests/utils/extendedIt.ts Outdated
@jerzakm jerzakm requested a review from iwoplaza February 26, 2026 18:56
@iwoplaza iwoplaza changed the title feat: render bundle proof of concept feat: Render bundle, .with(pass) and .with(encoder) support Feb 26, 2026
Copy link
Copy Markdown
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.

Yeeeeshhh 👏

@iwoplaza iwoplaza merged commit 0dcbff9 into software-mansion:main Feb 26, 2026
2 of 3 checks passed
@jerzakm jerzakm mentioned this pull request Mar 4, 2026
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