Add debugPrintf
-based panic reporting, controlled via spirv_builder::ShaderPanicStrategy
.
#1080
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_inputs
will show values of entry-point inputs, to identify the invocation, whileprint_backtrace
will 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
ash
runner, hopefully they're not too disruptive (cc @DJMcNab).This is how I was testing (after sprinkling
sky-shader
with 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-passthru
and rely on it fordebugPrintf
. #1036