From 320ddcffb4c9e5ca094ecc78a6927d78820ddf68 Mon Sep 17 00:00:00 2001 From: fjamesprice Date: Sun, 1 Nov 2026 03:38:48 -0500 Subject: [PATCH] test(camera-raw): validate the Shadows and Highlights shader without a GPU The Camera Raw GPU tests skip on runners with no adapter, and the one test that runs there validated only the per-pixel shader. It now parses and validates camera_raw_tone.wgsl with naga too, so a runner without a GPU still catches a shader that wouldn't compile. Appending an undefined identifier to camera_raw_tone.wgsl fails it. Part of #6916. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014nuVUg57HqXLARdhymFiTc --- crates/gpu/tests/it/camera_raw.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/gpu/tests/it/camera_raw.rs b/crates/gpu/tests/it/camera_raw.rs index 7a6ebb736d..d7ba00d1a4 100644 --- a/crates/gpu/tests/it/camera_raw.rs +++ b/crates/gpu/tests/it/camera_raw.rs @@ -56,16 +56,17 @@ fn gpu() -> Option { Some(Gpu { device, queue, dev, _lock: lock }) } -/// The Camera Raw shader parses and validates (naga, as wgpu does before any driver sees it), +/// The Camera Raw shaders parse and validate (naga, as wgpu does before any driver sees them), /// with no adapter: the GPU tests below skip on runners without one. #[test] -fn the_shader_validates_without_a_gpu() { - let src = photocraft_gpu::CAMERA_RAW_SHADER; - let module = wgpu::naga::front::wgsl::parse_str(src).unwrap_or_else(|e| panic!("{}", e.emit_to_string(src))); - wgpu::naga::valid::Validator::new(wgpu::naga::valid::ValidationFlags::all(), wgpu::naga::valid::Capabilities::empty()) - .validate(&module) - .unwrap_or_else(|e| panic!("{}", e.emit_to_string(src))); - assert!(!module.entry_points.is_empty()); +fn the_shaders_validate_without_a_gpu() { + for src in [photocraft_gpu::CAMERA_RAW_SHADER, photocraft_gpu::CAMERA_RAW_TONE_SHADER] { + let module = wgpu::naga::front::wgsl::parse_str(src).unwrap_or_else(|e| panic!("{}", e.emit_to_string(src))); + wgpu::naga::valid::Validator::new(wgpu::naga::valid::ValidationFlags::all(), wgpu::naga::valid::Capabilities::empty()) + .validate(&module) + .unwrap_or_else(|e| panic!("{}", e.emit_to_string(src))); + assert!(!module.entry_points.is_empty()); + } } #[derive(Clone, Copy, Debug)]