Bug 1612941 - make WR report shader name and features in output for interop with SWGL. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D65595

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Lee Salzman 2020-03-11 11:24:53 +00:00
Родитель 40944f2575
Коммит 9b5568ef68
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -270,8 +270,21 @@ fn build_shader_prefix_string<F: FnMut(&str)>(
// GLSL requires that the version number comes first.
output(gl_version_string);
let mut features_key = String::new();
for feat in features.lines() {
const PREFIX: &'static str = "#define WR_FEATURE_";
if let Some(i) = feat.find(PREFIX) {
if i + PREFIX.len() < feat.len() {
if !features_key.is_empty() {
features_key.push_str("_");
}
features_key.push_str(&feat[i + PREFIX.len() ..]);
}
}
}
// Insert the shader name to make debugging easier.
let name_string = format!("// {}\n", base_filename);
let name_string = format!("// shader: {} {}\n", base_filename, features_key);
output(&name_string);
// Define a constant depending on whether we are compiling VS or FS.