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 <[email protected]>
Claude-Session: https://claude.ai/code/session_014nuVUg57HqXLARdhymFiTc
This commit is contained in:
fjamespriceandClaude Opus 5.5 committed 2026-11-01 03:38:48 -05:00
1 parent 965258820c
commit 320ddcffb4
1 file changed
+9 -8
+9 -8
View File
@@ -56,16 +56,17 @@ fn gpu() -> Option<Gpu> {
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)]