From 3f958f618bf2a5f474a180ee64b32124f6d475e6 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 15 Apr 2021 11:53:41 -0700 Subject: [PATCH] [glsl-out] Let snapshot tests request a specific GLSL desktop version. Add a Option to the snapshot `Params` to let snapshots request specific Desktop GLSL versions. The default is GLSL ES 3.10. It would be more general to let the params select any GLSL version, but that would entail making glsl::Version implement Deserialize and all that, which seems like overkill. --- tests/snapshots.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/snapshots.rs b/tests/snapshots.rs index 1a24b9151d..587bef4398 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -33,6 +33,9 @@ struct Parameters { msl: naga::back::msl::Options, #[cfg(all(not(feature = "deserialize"), feature = "msl-out"))] msl_custom: bool, + #[cfg_attr(not(feature = "glsl-out"), allow(dead_code))] + #[serde(default)] + glsl_desktop_version: Option } #[allow(dead_code, unused_variables)] @@ -78,7 +81,7 @@ fn check_targets(module: &naga::Module, name: &str, targets: Targets) { { if targets.contains(Targets::GLSL) { for ep in module.entry_points.iter() { - check_output_glsl(module, &info, &dest, ep.stage, &ep.name); + check_output_glsl(module, &info, &dest, ep.stage, &ep.name, ¶ms); } } } @@ -166,11 +169,15 @@ fn check_output_glsl( destination: &PathBuf, stage: naga::ShaderStage, ep_name: &str, + params: &Parameters, ) { use naga::back::glsl; let options = glsl::Options { - version: glsl::Version::Embedded(310), + version: match params.glsl_desktop_version { + Some(v) => glsl::Version::Desktop(v), + None => glsl::Version::Embedded(310), + }, shader_stage: stage, entry_point: ep_name.to_string(), };