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

Improve logging around surface creation #6511

Merged
merged 4 commits into from
Dec 8, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Nov 10, 2024

Connections

Description

  • demoted a few info messages to debug
  • request_adapter is more talkative about its decisions in debug log messages now
  • add a doc line to RequestAdapterOptions::compatible_surface, this duplicates what we already write on wgpu's request adapter, but better to request this weirdness where it's needed!

Testing
ran hello_triangle and looked at things

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@Wumpf Wumpf requested a review from a team as a code owner November 10, 2024 09:36
Copy link
Contributor

@nical nical left a comment

Choose a reason for hiding this comment

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

Looks good to me but I remember @jimblandy mentioning a while back that having some of the adapter related logging in firefox (which filters out anything below info and it's tricky to change because reasons) was important.

@teoxoy
Copy link
Member

teoxoy commented Nov 12, 2024

We should probably use the api_log! macro.

@Wumpf
Copy link
Member Author

Wumpf commented Nov 12, 2024

to be clear, I'd really prefer having those logs in debug :) (telling users to run a program with RUST_LOG=debug is a common thing I do when encountering issues rendering issues)
so api_log would mean I don't have them on trace unless I enable the feature which pushes it to info

@teoxoy
Copy link
Member

teoxoy commented Nov 18, 2024

I see but we still need a way for these to show up at the info level or else they won't show up at all in Firefox.

@jimblandy

This comment was marked as resolved.

@jimblandy
Copy link
Member

I've had the situation explained to me a bit more now 😅

At Mozilla, we're definitely going to want to understand how adapters got chosen or ignored, when something isn't working as expected. However, Firefox builds remove all logging below info severity; you can't set RUST_LOG to enable it. The key function of wgpu's custom logging macros, for us, is that, when the _log_info features are enabled, they implicitly promote severity to info, so that it's still available in Firefox.

So we would want the adapter creation logging, and we'd want it done in some way or another that allows us to retain it in Firefox.

Beyond that, I don't think we have strong opinions about what the logging should be.

@Wumpf
Copy link
Member Author

Wumpf commented Nov 20, 2024

Yeah, I also definitely want to have these things in the log, which is why I added more in this PR .. just.. I want them on debug 😄
I have the exact same problem of trying to understand how adapter selection went on user's machine, but for me this is something I let users opt into to get more information out ("thank you for your report, can you please give me the lot output when running RUST_LOG=debug" sort of thing)
Semantically, the information logged here is debug information (imho) - it is information that is generally useful for debugging and it is not as verbose as a full trace. I find it a bit insane to remove all log below INFO and then expect anything for debug logging to be present, but I do have a lot of (unironic) sympathy for big software being hard to be sane like ever.

Anyways, that puts us into an uncomfortable spot though - using api_log puts the information into trace, which is too low to capture it for me (rather than too high where it is right now). Also, it is not quite correct semantically either as the feature is defined as:

## Log all API entry points at info instead of trace level.
api_log_info = []

So what we could do is to stretch the meaning a bit:

## Log all API entry points at info instead of trace level.
## Also, promotes certain debug log calls to info.
api_log_info = []

and then go with that meaning for the calls I demoted here. That way we can have the cake and eat it too without further over-engineering this. Thoughts?

@Wumpf Wumpf self-assigned this Dec 4, 2024
@Wumpf Wumpf self-assigned this Dec 4, 2024
@Wumpf
Copy link
Member Author

Wumpf commented Dec 7, 2024

the methods that were demoted on wgpu-core are now no longer demoted to debug iff api_log is enabled.
The demoted Vulkan ones are still demoted to debug as the feature isn't available there, but I figure they weren't as contentious to begin with

@Wumpf Wumpf assigned nical and unassigned Wumpf Dec 7, 2024
@Wumpf Wumpf requested a review from nical December 7, 2024 22:03
@Wumpf Wumpf merged commit ed694ed into gfx-rs:trunk Dec 8, 2024
27 checks passed
@Wumpf Wumpf deleted the improve-surface-log-messages branch December 8, 2024 13:44
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

Successfully merging this pull request may close these issues.

4 participants