зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1690027. Avoid using texelFetchOffset on macOS. r=mstange
We've run into a number of bugs with integer comparison on macOS Intel. I created a reduced test case of bug 1689510 here: https://github.com/jrmuizel/texel-fetch-offset. It appears that offset parameter to texelFetchOffset can cause subsequent uses of that integer value to get confused and generate bad shader code. There are known issues around texelFetchOffset on Intel mentioned in ANGLE11e43ecee2
and https://github.com/google/angle/commit/0303cf6b95 and in mesa4650aea7a5
My theory is that there's also a workaround in the Intel driver but this work around is somehow broken which causes the incorrect code. Here's the result of compilation in working case: https://gist.github.com/jrmuizel/e6a9b838aba97ec6190c147e0aa3a335 and the broken one: https://gist.github.com/jrmuizel/8b303770b920c44dee9a18586140ab01 The broken one has had the cmp instruction dropped. Differential Revision: https://phabricator.services.mozilla.com/D103691
This commit is contained in:
Родитель
e13215fdec
Коммит
0a6b4af5e8
|
@ -32,7 +32,12 @@
|
|||
#else
|
||||
#define HIGHP_SAMPLER_FLOAT
|
||||
#define HIGHP_FS_ADDRESS
|
||||
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetchOffset(sampler, position, lod, offset)
|
||||
#if defined(PLATFORM_MACOS) && !defined(SWGL)
|
||||
// texelFetchOffset introduces a variety of shader compilation bugs on macOS Intel so avoid it.
|
||||
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetch(sampler, position + offset, lod)
|
||||
#else
|
||||
#define TEXEL_FETCH(sampler, position, lod, offset) texelFetchOffset(sampler, position, lod, offset)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
|
|
@ -193,6 +193,14 @@ pub fn build_shader_prefix_string<F: FnMut(&str)>(
|
|||
};
|
||||
output(kind_string);
|
||||
|
||||
// detect if we're targeting macOS at build time
|
||||
match std::env::var("CARGO_CFG_TARGET_OS") {
|
||||
Ok(os) if os == "macos" => output("#define PLATFORM_MACOS\n"),
|
||||
// if this is not called from build.rs (e.g. the gpu_cache_update shader)
|
||||
// we want to use the runtime value
|
||||
Err(_) if cfg!(target_os = "macos") => output("#define PLATFORM_MACOS\n"),
|
||||
_ => {}
|
||||
}
|
||||
// Define a constant for the vertex texture width.
|
||||
output("#define WR_MAX_VERTEX_TEXTURE_WIDTH ");
|
||||
output(&MAX_VERTEX_TEXTURE_WIDTH_STRING);
|
||||
|
|
Загрузка…
Ссылка в новой задаче