Skip to content

Add more GPU tracing spans - #25398

Open
Lampan-git wants to merge 5 commits into
bevyengine:mainfrom
Lampan-git:more_tracing
Open

Add more GPU tracing spans#25398
Lampan-git wants to merge 5 commits into
bevyengine:mainfrom
Lampan-git:more_tracing

Conversation

@Lampan-git

@Lampan-git Lampan-git commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Objective

  • The RenderQueue in my tracy profiles looked a little empty

Solution

  • Add either time_span(like smaa) or pass_span(like main_opaque_pass_3d_node), which I copied to the missing places.
  • Because of point lights having 6 shadow views and spotlight having 1, so to not scale it per light, add the "auxiliary_views"-span before and after looping through all the RootView::Auxiliary, where shared_shadow_pass is "called" with run_schedule.

Testing

  • Ran my game with tracy with this branch
  • Ran the examples fullscreen_material, many_lights, volumetric_fog with tracy

Showcase

volumentric_fog example's new profile:

Click to view showcase image

AI Disclosure

No code was written with AI. I used Claude Opus to find where spans were missing, reviewing and some explaining.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Diagnostics Logging, crash handling, error reporting and performance analysis X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Aug 13, 2026
@JMS55
JMS55 self-requested a review August 13, 2026 21:00
@Lampan-git

Copy link
Copy Markdown
Contributor Author

I want to point out that auxiliary_views hides uniform_allocation, bin_unpacking and early_mesh_preprocessing, but if you zoom in you can see em.

Comment thread crates/bevy_pbr/src/deferred/mod.rs Outdated

@pcwalton pcwalton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works for me as long as things continue to work on WebGL 2/WebGPU. Thank you!

Comment thread crates/bevy_pbr/src/meshlet/material_shade_nodes.rs Outdated
Comment thread crates/bevy_core_pipeline/src/fullscreen_material.rs Outdated
Comment thread crates/bevy_solari/src/pathtracer/node.rs Outdated
@JMS55

JMS55 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Can you explain auxiliary_views more? I don't think I understand.

@Lampan-git

Copy link
Copy Markdown
Contributor Author

Can you explain auxiliary_views more? I don't think I understand.

In camera_driver it loops through all views. Since there are 6 view per point lights and 1 per spotlight for shadows this gets scaled with the amount of lights we have. In camera_driver it first goes through the Auxiliary views and then the Camera views are chained(for Cameras there is the per_view_shadow_pass, which then scales per Camera instead). This loops then runs the corresponding schedule per view. For Auxiliary this includes shared_shadow_pass. So to not create a span per shared_shadow_pass, I then put a time span before the loop, and the end it when reaching the Camera view part of the loop.

@JMS55

JMS55 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Gotcha. I think auxiliary_views might be a bit confusing for users, but I'm willing to merge this as-is. People can always use e.g. nsight for more detailed info - timestamp queries are mainly meant for in-game overlays (I do this in Solari), and for quick eyeballing in Tracy when looking at CPU vs GPU bottlenecks.

@JMS55 JMS55 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 Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

5 participants