mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
[glsl-out] Let snapshot tests request a specific GLSL desktop version.
Add a Option<u16> 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.
This commit is contained in:
1 parent
576723960e
commit
3f958f618b
1 file changed
+9
-2
+9
-2
@@ -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<u16>
|
||||
}
|
||||
|
||||
#[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(),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user