/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use mozangle::shaders::{BuiltInResources, Output, ShaderSpec, ShaderValidator}; use webrender_build::shader::{ShaderFeatureFlags, ShaderVersion, build_shader_strings, get_shader_features};
let resources = BuiltInResources::default(); let vs_validator =
ShaderValidator::new(VERTEX_SHADER, ShaderSpec::Gles3, Output::Essl, &resources).unwrap();
let fs_validator =
ShaderValidator::new(FRAGMENT_SHADER, ShaderSpec::Gles3, Output::Essl, &resources).unwrap();
for (shader, configs) in get_shader_features(ShaderFeatureFlags::GLES) { for config in configs { let features = config.split(",").filter(|f| !f.is_empty()).collect::<Vec<_>>();
fn validate(validator: &ShaderValidator, name: &str, source: String) { // Check for each `switch` to have a `default`, see // https://github.com/servo/webrender/wiki/Driver-issues#lack-of-default-case-in-a-switch
assert_eq!(source.matches("switch").count(), source.matches("default:").count(), "Shader '{}' doesn't have all `switch` covered with `default` cases", name); // Run Angle validator match validator.compile_and_translate(&[&source]) {
Ok(_) => { // Ensure that the shader uses at most 16 varying vectors. This counts the number of // vectors assuming that the driver does not perform additional packing. The spec states // that the driver should pack varyings, however, on some Adreno 3xx devices we have // observed that this is not the case. See bug 1695912. let varying_vectors = validator.get_num_unpacked_varying_vectors(); let max_varying_vectors = 16;
assert!(
varying_vectors <= max_varying_vectors, "Shader {} uses {} varying vectors. Max allowed {}",
name, varying_vectors, max_varying_vectors
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.