зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1632444 - Correctly detect target OS when deciding what shaders to optimize. r=jrmuizel
A previous patch attempted to optimize only GL or GLES shaders, depending on the target platform. However, it was trying to detect the platform by using `cfg!(target_os = {})`, but as this is in a build script that actually detects the host platform instead. This resulted in the wrong version of shaders being optimized, and therefore falling back to unoptimized shaders at runtime. This fix uses `env::var("CARGO_CFG_TARGET_OS")` instead, which works correctly in build scripts. Differential Revision: https://phabricator.services.mozilla.com/D72127
This commit is contained in:
Родитель
b59fd6199b
Коммит
f9253cf629
|
@ -104,10 +104,9 @@ fn write_optimized_shaders(shader_dir: &Path, shader_file: &mut File, out_dir: &
|
||||||
// The full set of optimized shaders can be quite large, so only optimize
|
// The full set of optimized shaders can be quite large, so only optimize
|
||||||
// for the GL version we expect to be used on the target platform. If a different GL
|
// for the GL version we expect to be used on the target platform. If a different GL
|
||||||
// version is used we will simply fall back to the unoptimized shaders.
|
// version is used we will simply fall back to the unoptimized shaders.
|
||||||
let shader_versions = if cfg!(target_os = "android") || cfg!(target_os = "windows") {
|
let shader_versions = match env::var("CARGO_CFG_TARGET_OS").as_ref().map(|s| &**s) {
|
||||||
[ShaderVersion::Gles]
|
Ok("android") | Ok("windows") => [ShaderVersion::Gles],
|
||||||
} else {
|
_ => [ShaderVersion::Gl],
|
||||||
[ShaderVersion::Gl]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut shaders = Vec::default();
|
let mut shaders = Vec::default();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче