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

wgpu-core compile failure with profile-with-tracing profiling feature #1477

Closed
Shfty opened this issue Jun 5, 2021 · 6 comments
Closed

wgpu-core compile failure with profile-with-tracing profiling feature #1477

Shfty opened this issue Jun 5, 2021 · 6 comments
Labels
external: upstream Issues happening in lower level APIs or platforms type: bug Something isn't working

Comments

@Shfty
Copy link

Shfty commented Jun 5, 2021

Description
wgpu-core fails to compile if a downstream crate includes a profiling dependency with the profile-with-tracing feature enabled.

This issue doesn't occur when using the the profile-with-puffin, profile-with-optick, profile-with-superluminal or profile-with-tracy feature flags.

Repro steps

  • Create a new binary crate
  • Add a wgpu-core = "0.8.1" dependency
  • Add a profiling = { version = "1.0.1", features = ["profile-with-tracing"] } dependency
  • cargo build

Adding a tracing = "0.1.26" dependency causes the same outcome, as does using version = "1" for profiling to match its entry in the wgpu-core Cargo.toml.

Expected vs observed behavior
Expected:
wgpu-core compiles successfully, and the profiling macros therein emit tracing spans that can be captured by the calling program.

In this case, my intent is to capture wgpu-core spans as part of the instrumentation data for an async program.
The functions calling wgpu will be instrumented using tracing wrappers, with a view to displaying wgpu-core spans (and wgpu log messages converted into tracing events) as their children inside a debug / profiling UI.

Observed:
Various wgpu-core invocations of profiling macros throw use of undeclared crate or module 'tracing' errors, followed by a further set of expected type parameter 'B', found struct 'profiling::tracing::level_filters::LevelFilter' errors.

Platform
Windows 10 64-bit
stable-x86_64-pc-windows-msvc
rustc 1.52.1
wgpu-core 0.8.1
profiling 1.0.1

@Shfty
Copy link
Author

Shfty commented Jun 5, 2021

As an aside, the Logging section of the crates.io page for wgpu notes that wgpu-core uses tracing for logging. This should be updated to reflect the switch to profiling.

@kvark kvark added help required We need community help to make this happen. type: bug Something isn't working labels Jun 6, 2021
@Uriopass
Copy link
Contributor

Uriopass commented Jun 6, 2021

I think this should be posted to profiling's repo, as IMHO any program using profiling shouldn't fail to compile regardless of the enabled feature.
They should also understand why it happens better, and it would help other users of profiling :).

@Shfty
Copy link
Author

Shfty commented Jun 7, 2021

That's reasonable - I considered it before posting here, but figured it would be better to see if there was any insight to be gained from the downstream crate first.

Their docs seem pretty cut and dry about library use-cases behaving transparently, so I'll write up an issue over there in a bit.

@kvark kvark added external: upstream Issues happening in lower level APIs or platforms and removed help required We need community help to make this happen. labels Jun 8, 2021
@aclysma
Copy link

aclysma commented Jun 9, 2021

profiling 1.0.2 should fix this

@cwfitzgerald
Copy link
Member

That's great to hear, thank you!

@Shfty
Copy link
Author

Shfty commented Jun 10, 2021

Working as expected, thanks!

image

(Disregard any unexpected ordering - that's probably my fault.)

Patryk27 pushed a commit to Patryk27/wgpu that referenced this issue Nov 23, 2022
* Make default a switch case

Previously the default case of a switch statement was encoded as a block
in the statement but the wgsl spec defines it in such a way that the
default case ordering matters.

* [spv-out] Support for the new switch IR

* [dot-out] Use different labels for default cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external: upstream Issues happening in lower level APIs or platforms type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants