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

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

Merged
merged 2 commits into from
Jul 21, 2023

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 force-pushed the even-more-panic branch from 3eb38a3 to 1de52f2 Compare July 21, 2023 16:59
@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 fu5ha, repi and VZout 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 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.

2 participants