This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Add debugPrintf-based panic reporting, controlled via spirv_builder::ShaderPanicStrategy.#1080
Merged
eddyb merged 1 commit intoEmbarkStudios:mainfrom Jul 18, 2023
LykenSol:whose-panic-is-it-anyway
Merged
Add debugPrintf-based panic reporting, controlled via spirv_builder::ShaderPanicStrategy.#1080eddyb merged 1 commit intoEmbarkStudios:mainfrom LykenSol:whose-panic-is-it-anyway
debugPrintf-based panic reporting, controlled via spirv_builder::ShaderPanicStrategy.#1080eddyb merged 1 commit intoEmbarkStudios:mainfrom
LykenSol:whose-panic-is-it-anyway
Conversation
repi
approved these changes
Jul 15, 2023
This comment was marked as resolved.
This comment was marked as resolved.
fu5ha
approved these changes
Jul 17, 2023
…r::ShaderPanicStrategy`.
Contributor
Author
|
For anyone seeing this PR later, the output, |
This was referenced Jul 20, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a followup to my earlier PR about panics (and the only thing I want to really get into
0.9):There are better docs on
spirv_builder::ShaderPanicStrategy, but this is the basic usage example:(that is, to enable emitting all the information we can right now -
print_inputswill show values of entry-point inputs, to identify the invocation, whileprint_backtracewill collect the static "inlined call frames" information we track for diagnostics, into the message)And this is what it looks like with an artificially induced panic in

sky-shader(plus some extra functions that just call the next one in the chain, to show off a non-trivial backtrace):If you look at the diff, you may notice most of it is to the inliner: yupp it had more bugs, but not only that, the entire strategy for tracking debuginfo was wrong because it's fundamentally an outside-in inliner, instead of the usual inside-out model (I'm honestly surprised any of the past diagnostics demos worked at all).
The other changes I've made were to the
ashrunner, hopefully they're not too disruptive (cc @DJMcNab).This is how I was testing (after sprinkling
sky-shaderwith extra panics):Haven't been able to break anything with it, so I'm relatively confident the inliner changes aren't semantically meaningful (after all, the whole point is to tweak debuginfo to make it more accurate, not to change anything else).
EDIT: also check out this other PR, which further improved the output and figured out how to use it with
wgpu:--force-spirv-passthruand rely on it fordebugPrintf. #1036