Skip to content

Render assets diagnostics #19311

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Conversation

hukasu
Copy link
Contributor

@hukasu hukasu commented May 20, 2025

Objective

There have been problems with MeshAllocator and MaterialBindGroupAllocator losing track of asset changes, then it would be nice to have an automated way of checking if the number of allocations is growing uncontrollably.

Solution

Create diagnostics that collect measurements of allocations from MeshAllocator and MaterialBindGroupAllocator, and number of render assets present

@hukasu hukasu changed the title Render diagnostics Render assets diagnostics May 20, 2025
@hukasu hukasu force-pushed the render-diagnostics branch 2 times, most recently from e5e53bd to 4da333c Compare May 20, 2025 19:05
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Testing A change that impacts how we test Bevy or how users test their apps A-Diagnostics Logging, crash handling, error reporting and performance analysis X-Uncontroversial This work is generally agreed upon D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 21, 2025
@alice-i-cecile alice-i-cecile requested a review from tychedelia May 21, 2025 15:35
Comment on lines 67 to 68
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"

not needed

Comment on lines 54 to 55
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one existed before this change, are you sure this is no longer needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and what about the ones on weekly.yml? they are just ctrl+c ctrl+v from this one

Comment on lines 60 to 61
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"

same

Copy link
Member

@tychedelia tychedelia left a comment

Choose a reason for hiding this comment

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

Having tests to make sure we don't break things in the future would be nice. I think we should wait for wgpu 25 to see if we can use the noop backend as it's ideal for this kind of thing.

@hukasu
Copy link
Contributor Author

hukasu commented May 24, 2025

François commented about the NOOP backend, so i though it was already available, but it is still not?

@tychedelia
Copy link
Member

François commented about the NOOP backend, so i though it was already available, but it is still not?

Pretty sure it's just in 25, which I'm hoping to land next week. It would be awesome to have a footprint for allocating buffers in non-e2e tests.

@JMS55
Copy link
Contributor

JMS55 commented Jun 27, 2025

Wgpu 25 has landed!

@hukasu hukasu added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Blocked This cannot move forward until something else changes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 27, 2025
@hukasu
Copy link
Contributor Author

hukasu commented Jun 27, 2025

@JMS55

Unable to find a GPU! Make sure you have installed required drivers! For extra information, see: https://github.com/bevyengine/bevy/blob/latest/docs/linux_dependencies.md: NotFound { active_backends: Backends(0x0), requested_backends: Backends(NOOP), supported_backends: Backends(VULKAN | GL), no_fallback_backends: Backends(0x0), no_adapter_backends: Backends(0x0), incompatible_surface_backends: Backends(0x0) }
.set(RenderPlugin {
    render_creation: RenderCreation::Automatic(WgpuSettings {
        backends: Some(Backends::NOOP),
        ..default()
    }),
    ..default()
})

@IceSentry
Copy link
Contributor

I think this PR could be split in 2 parts. One PR to add the diagnostics then one for the tests. The diagnostic one could be merged ASAP. The main reason I suggest this is that adding diagnostics doesn't have to touch any of the CI stuff. So if CI breaks because of this PR we don't have to revert everything and only the part that needs to touch CI.

@hukasu hukasu added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jun 27, 2025
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!

We should definitely keep that kind of metrics in mind in the future and add this for anything that uses memory.

@hukasu
Copy link
Contributor Author

hukasu commented Jul 2, 2025

What broke was the PR for dynamic materials, should i make a solution that already allows the diagnostics of dynamic materials? or just fix for struct-backed materials for now?

@alice-i-cecile
Copy link
Member

should i make a solution that already allows the diagnostics of dynamic materials? or just fix for struct-backed materials for now?

Former please :)

@hukasu hukasu added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 2, 2025
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-Testing A change that impacts how we test Bevy or how users test their apps D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Uncontroversial This work is generally agreed upon
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

6 participants