Skip to content

Batch prepasses that use depth only#22813

Open
tychedelia wants to merge 9 commits intobevyengine:mainfrom
tychedelia:depth-only-prepass
Open

Batch prepasses that use depth only#22813
tychedelia wants to merge 9 commits intobevyengine:mainfrom
tychedelia:depth-only-prepass

Conversation

@tychedelia
Copy link
Member

For prepasses that don't need to access material data or write normals/motion vectors, we can batch them together. To do so, we store a new draw command that binds an empty bind group in place of the material bindings and add None for the material id to the batch set key.

Testing:

cargo run --example many_cubes --release -- --shadows --material-texture-count 10

main:
image

this:
image

@tychedelia tychedelia added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 5, 2026
@tychedelia tychedelia requested a review from pcwalton February 5, 2026 08:21
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering (2026 Proposal) Feb 5, 2026
pub type DrawDepthOnlyPrepass = (
SetItemPipeline,
SetPrepassViewBindGroup<0>,
SetPrepassViewEmptyBindGroup<1>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could have a more generalized SetEmptyBindGroup, render command. I also needed pretty much the same thing recently.

Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

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

LGTM

I started an example run just to be sure it didn't break anything bevyengine/bevy-example-runner#206

Copy link
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

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

Nice work

@tychedelia tychedelia added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 6, 2026
@tychedelia
Copy link
Member Author

The example run looks good so this one should be good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: No status
Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants