Skip to content

Conversation

@eddyb
Copy link
Contributor

@eddyb eddyb commented Apr 17, 2023

Not sure yet if this is the way to do it, but I used this for testing the mouse shader (before #1018).


EDIT: turns out that this is the main requirement for using debugPrintf from wgpu!

Quick demo panic:

--- a/examples/shaders/sky-shader/src/lib.rs
+++ b/examples/shaders/sky-shader/src/lib.rs
@@ -65,2 +65,3 @@ fn sun_intensity(zenith_angle_cos: f32) -> f32 {
     let cutoff_angle = PI / 1.95; // Earth shadow hack
+    assert!(zenith_angle_cos > 0.07479);
     SUN_INTENSITY_FACTOR

Enabling debugPrintf output without code changes (nor debug mode):

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

(also check out the updated DebugPrintfThenExit docs!)

@eddyb eddyb marked this pull request as ready for review July 20, 2023 07:17
@eddyb eddyb requested review from VZout and fu5ha as code owners July 20, 2023 07:17
@eddyb eddyb requested review from VZout, fu5ha and repi and removed request for VZout and fu5ha July 20, 2023 07:17
@eddyb eddyb changed the title example-runner-wgpu: add --force-spirv-passthru for testing. example-runner-wgpu: add --force-spirv-passthru and rely on it for debugPrintf. Jul 20, 2023
@eddyb eddyb enabled auto-merge (rebase) July 20, 2023 17:20
@eddyb eddyb merged commit 55edc4e into EmbarkStudios:main Jul 20, 2023
@eddyb eddyb deleted the passthru branch July 20, 2023 17:49
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