-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add pipeline statistics #9135
Add pipeline statistics #9135
Conversation
… primitives count) per each render pass
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Can you say more about this? It sounds like we should block on fixing that before merging this PR to avoid unexpected problems, but I'm not fully sure I understand. |
…lable. Also, `StatisticsRecorder` is now created once and reused every frame.
I have addressed that. Now when timestamp queries are unsupported, no GPU timing will be recorded. Same for pipeline queries. CPU timings are always recorded though, since they don't require any features. Also, I have written the docs. I have the following question: should I keep the
I would say it's simpler to leave render statistics as a resource, and a future PR could address copying those into diagnostics and/or providing a GUI overlay, like in #8067. |
I've gated all recording functionality behind Additionally, now I reuse buffers instead of creating them every frame. There are 2 query sets, and 2 buffers (one for resolving the query set, and the other for cpu-readback) per frame-in-flight (of which there are 3, apparently). This makes performance of statistics recording basically negligible (given there are only a couple render passes). I ran |
Now supports arbitrarily nested time spans and supports multithreading.
I think so: it's valuable for discovery, and to ensure that other diagnostics can be built based on the public API. |
Btw I'm unfortunately busy with IRL stuff, sorry for the delay on reviewing this. I still want to get this in as soon as I can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have time to do a super thorough review, but on first glance this looks very good to me. Will let rendering-SME's review this in detail. Super excited to have this, and start hooking it up to the other rendering features!
The other thing I'd like to see is tracy integration: https://docs.rs/tracy-client/latest/tracy_client/struct.GpuContext.html
EDIT: We talked about this earlier, I forgot. Can be a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid: I'm happy to merge this now and enhance this in future work.
@LeshaInc if you can get CI passing I'll merge this in for you :) I think you may need to adjust some imports. |
Head branch was pushed to by a user without write access
Objective
It's useful to have access to render pipeline statistics, since they provide more information than FPS alone. For example, the number of drawn triangles can be used to debug culling and LODs. The number of fragment shader invocations can provide a more stable alternative metric than GPU elapsed time.
See also: Render node GPU timing overlay #8067, which doesn't provide pipeline statistics, but adds a nice overlay.
Solution
Add
RenderDiagnosticsPlugin
, which enables collecting pipeline statistics and CPU & GPU timings.Changelog
RenderDiagnosticsPlugin
RenderContext::diagnostic_recorder
method