Skip to content
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

tracing macros in naga_oil could have finer-grained controls #22

Open
nicopap opened this issue Jul 1, 2023 · 2 comments
Open

tracing macros in naga_oil could have finer-grained controls #22

nicopap opened this issue Jul 1, 2023 · 2 comments

Comments

@nicopap
Copy link

nicopap commented Jul 1, 2023

It's hard to debug bevy's renderer without having recourse to reading the tracing logs. Welp. I previously said it was relevant to bevy, but I don't think so.

Here is my suggestion. I think one of the two should make using logging easier:

  • Split naga in more modules, so that the TRACE macros have different modules, and it is possible to silence specific messages
  • Use DEBUG log level for the "with defs" message.
@robtfm
Copy link
Collaborator

robtfm commented Jul 1, 2023

we can definitely change things to make them more usable. do you mean the "with defs" trace from compose.rs@664 ? i'm a bit surprised that's useful, it was only added to debug issues with ensure_imports not generating the right versions of modules, but the other "with defs" logs are debug already.

personally i use the shader dump from "parsing" message primarily, i find often the only way to see what's gone wrong is to have the full shader at the point the error occurred, but i agree it's very noisy as is. i think maybe it would be best to write out the full shader to the filesystem when an error occurs (and probably only when a "dump_errors" feature flag is set). we could also add some comments with the source file and the effective shader defs inline in that error dump too, then maybe the log messages wouldn't be needed much at all.

@nicopap
Copy link
Author

nicopap commented Jul 1, 2023

Yeah my bad. I was talking about compose.rs@664, but it's not that relevant, I used it to learn which defines are set in a given shader. But bevy_render also dumps the defs with DEBUG bevy_render::render_resource::pipeline_cache: processing shader

Concerning dumping the generated shader. It's probably worthwhile, similar to a compiler asm output. Not only good for debugging broken shaders, but also sussing out performance pitfalls.

In asset-v2 bevy could have a toggle that dumps the generated shaders into a directory.

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

No branches or pull requests

2 participants