/* 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/. */
/// Computes available shaders and their features for the given feature flags. pubfn get_shader_features(flags: ShaderFeatureFlags) -> ShaderFeatures { letmut shaders = ShaderFeatures::new();
// Image brush shaders letmut texture_types = vec!["TEXTURE_2D"]; if flags.contains(ShaderFeatureFlags::GL) {
texture_types.push("TEXTURE_RECT");
} if flags.contains(ShaderFeatureFlags::TEXTURE_EXTERNAL) {
texture_types.push("TEXTURE_EXTERNAL");
} if flags.contains(ShaderFeatureFlags::TEXTURE_EXTERNAL_BT709) {
texture_types.push("TEXTURE_EXTERNAL_BT709");
} letmut image_features: Vec<String> = Vec::new(); for texture_type in &texture_types { letmut fast = FeatureList::new(); if !texture_type.is_empty() {
fast.add(texture_type);
}
image_features.push(fast.concat(&base_prim_features).finish());
image_features.push(fast.concat(&brush_alpha_features).finish());
image_features.push(fast.with("DEBUG_OVERDRAW").finish()); letmut slow = fast.clone();
slow.add("REPETITION");
slow.add("ANTIALIASING");
image_features.push(slow.concat(&base_prim_features).finish());
image_features.push(slow.concat(&brush_alpha_features).finish());
image_features.push(slow.with("DEBUG_OVERDRAW").finish()); if flags.contains(ShaderFeatureFlags::ADVANCED_BLEND_EQUATION) { let advanced_blend_features = brush_alpha_features.with("ADVANCED_BLEND");
image_features.push(fast.concat(&advanced_blend_features).finish());
image_features.push(slow.concat(&advanced_blend_features).finish());
} if flags.contains(ShaderFeatureFlags::DUAL_SOURCE_BLENDING) { let dual_source_features = brush_alpha_features.with("DUAL_SOURCE_BLENDING");
image_features.push(fast.concat(&dual_source_features).finish());
image_features.push(slow.concat(&dual_source_features).finish());
}
}
shaders.insert("brush_image", image_features);
letmut composite_texture_types = texture_types.clone(); if flags.contains(ShaderFeatureFlags::TEXTURE_EXTERNAL_ESSL1) {
composite_texture_types.push("TEXTURE_EXTERNAL_ESSL1");
} letmut composite_features: Vec<String> = Vec::new(); for texture_type in &composite_texture_types { let base = texture_type.to_string();
composite_features.push(base);
}
shaders.insert("cs_scale", composite_features.clone());
// YUV image brush and composite shaders letmut yuv_features: Vec<String> = Vec::new(); for texture_type in &texture_types { letmut list = FeatureList::new(); if !texture_type.is_empty() {
list.add(texture_type);
}
list.add("YUV");
composite_features.push(list.finish());
yuv_features.push(list.concat(&base_prim_features).finish());
yuv_features.push(list.concat(&brush_alpha_features).finish());
yuv_features.push(list.with("DEBUG_OVERDRAW").finish());
}
shaders.insert("brush_yuv_image", yuv_features);
// Fast path composite shaders for texture_type in &composite_texture_types { letmut list = FeatureList::new(); if !texture_type.is_empty() {
list.add(texture_type);
}
list.add("FAST_PATH");
composite_features.push(list.finish());
// YUV shaders are not compatible with ESSL1 if *texture_type == "TEXTURE_EXTERNAL_ESSL1" { continue;
}
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.