Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Show panic! messages via debugPrintf, even including some runtime arguments ({u,i,f}32 as {} or {:?}).#1082

Merged
eddyb merged 2 commits intoEmbarkStudios:mainfrom
LykenSol:even-more-panic
Jul 21, 2023
Merged

Show panic! messages via debugPrintf, even including some runtime arguments ({u,i,f}32 as {} or {:?}).#1082
eddyb merged 2 commits intoEmbarkStudios:mainfrom
LykenSol:even-more-panic

Conversation

@eddyb
Copy link
Contributor

@eddyb eddyb commented Jul 20, 2023

Also, this PR moves us in the direction of "preferring fewer optimizations" (we now force -Zinline-mir=off),
as that makes it easier to e.g. reliably pattern-match on the generated SPIR-V.


By adding some out of bounds indexing to the sky-shader, and running:
VK_LOADER_LAYERS_ENABLE=VK_LAYER_KHRONOS_validation VK_LAYER_ENABLES=VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT DEBUG_PRINTF_TO_ STDOUT=1 cargo run -p example-runner-wgpu --release -- --force-spirv-passthru, we get:

image


Note that bounds-checking panics come from a core function which happens to do:

panic!("index out of bounds: the len is {len} but the index is {index}")

(that is, we don't special-case bounds-checking panics, and simple Display/Debug formatting of 32-bit integers/floats, including usize/isize, should work, and we can do a lot more in the future)

TODO: changelog.

@eddyb eddyb marked this pull request as ready for review July 21, 2023 16:59
@eddyb eddyb enabled auto-merge (rebase) July 21, 2023 16:59
@eddyb eddyb requested review from VZout, fu5ha and repi July 21, 2023 17:02
@eddyb eddyb merged commit 1abd1cf into EmbarkStudios:main Jul 21, 2023
@eddyb eddyb deleted the even-more-panic branch July 21, 2023 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants