Bug 1609191 - Revert previous attempt to work around Adreno shader compilation crash. r=nical

On Adreno 505 and 506 devices we encounter frequent crashes when
compiling shaders. We previously attempted to work around this by
ensuring that the source strings were always unique, as we believed it
may be due to buggy caching internally in the driver. This did not
have any effect, however, so this patch reverts the attempted
workaround.

Differential Revision: https://phabricator.services.mozilla.com/D114949
This commit is contained in:
Jamie Nicol 2021-05-12 13:03:51 +00:00
parent 34dc7af64a
commit f1a4194b3f
5 changed files with 1 additions and 98 deletions

1
Cargo.lock generated
View File

@ -5746,7 +5746,6 @@ dependencies = [
"swgl",
"time",
"tracy-rs",
"uuid",
"webrender_api",
"webrender_build",
"wr_malloc_size_of",

76
gfx/wr/Cargo.lock generated
View File

@ -611,17 +611,6 @@ dependencies = [
"byteorder",
]
[[package]]
name = "getrandom"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [
"cfg-if 0.1.10",
"libc",
"wasi",
]
[[package]]
name = "gl_generator"
version = "0.13.1"
@ -1142,12 +1131,6 @@ dependencies = [
"inflate",
]
[[package]]
name = "ppv-lite86"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
[[package]]
name = "proc-macro2"
version = "0.4.30"
@ -1203,29 +1186,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"libc",
"rand_chacha",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
]
[[package]]
name = "rand_core"
version = "0.3.1"
@ -1241,24 +1201,6 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "raw-window-handle"
version = "0.3.3"
@ -1644,15 +1586,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "uuid"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
dependencies = [
"rand 0.7.3",
]
[[package]]
name = "vec_map"
version = "0.8.1"
@ -1682,12 +1615,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wayland-client"
version = "0.21.13"
@ -1776,7 +1703,7 @@ dependencies = [
"objc",
"plane-split",
"png",
"rand 0.4.6",
"rand",
"rayon",
"ron",
"serde",
@ -1785,7 +1712,6 @@ dependencies = [
"swgl",
"time",
"tracy-rs",
"uuid",
"webrender_api",
"webrender_build",
"wr_malloc_size_of",

View File

@ -12,7 +12,6 @@ packages = [
"core-graphics",
"gl_generator",
"gleam",
"rand",
"rand_core",
# https://github.com/trimental/andrew/issues/5
"rusttype",

View File

@ -45,7 +45,6 @@ ron = { optional = true, version = "0.6.2" }
serde = { optional = true, version = "1.0", features = ["serde_derive"] }
smallvec = "1"
time = "0.1"
uuid = { version = "0.8", features = ["v4"] }
api = { version = "0.61.0", path = "../webrender_api", package = "webrender_api" }
webrender_build = { version = "0.0.1", path = "../webrender_build" }
malloc_size_of = { version = "0.0.1", path = "../wr_malloc_size_of", package = "wr_malloc_size_of" }

View File

@ -20,7 +20,6 @@ use std::{
cell::{Cell, RefCell},
cmp,
collections::hash_map::Entry,
fmt::Write,
marker::PhantomData,
mem,
num::NonZeroUsize,
@ -34,7 +33,6 @@ use std::{
thread,
time::Duration,
};
use uuid::Uuid;
use webrender_build::shader::{
ProgramSourceDigest, ShaderKind, ShaderVersion, build_shader_main_string,
build_shader_prefix_string, do_build_shader_string, shader_source_from_file,
@ -1127,10 +1125,6 @@ pub struct Device {
/// are null-terminated, to work around driver bugs.
requires_null_terminated_shader_source: bool,
/// Whether we must ensure the source strings passed to glShaderSource()
/// are unique, to work around driver bugs.
requires_unique_shader_source: bool,
/// Whether we must unbind any texture from GL_TEXTURE_EXTERNAL_OES before
/// binding to GL_TEXTURE_2D, to work around an android emulator bug.
requires_texture_external_unbind: bool,
@ -1626,12 +1620,6 @@ impl Device {
// strings are not null-terminated. See bug 1591945.
let requires_null_terminated_shader_source = is_emulator;
// On Adreno 505 and 506 we encounter crashes during glLinkProgram(), which
// appear to be caused by some driver-internal caching of shader strings.
// We attempt to workaround this by appending unique comments to each source.
// See bug 1609191.
let requires_unique_shader_source = renderer_name == "Adreno (TM) 505" || renderer_name == "Adreno (TM) 506";
// The android emulator gets confused if you don't explicitly unbind any texture
// from GL_TEXTURE_EXTERNAL_OES before binding another to GL_TEXTURE_2D. See bug 1636085.
let requires_texture_external_unbind = is_emulator;
@ -1789,7 +1777,6 @@ impl Device {
extensions,
texture_storage_usage,
requires_null_terminated_shader_source,
requires_unique_shader_source,
requires_texture_external_unbind,
required_pbo_stride,
dump_shader_source,
@ -1935,13 +1922,6 @@ impl Device {
let id = self.gl.create_shader(shader_type);
let mut new_source = Cow::from(source.as_str());
// On some drivers we encounter crashes during glLinkProgram(), which
// appear to be caused by some driver-internal caching of shader strings.
// We attempt to workaround this by appending unique comments to each source.
if self.requires_unique_shader_source {
let uuid = Uuid::new_v4().to_hyphenated();
write!(new_source.to_mut(), "\n//{}\n", uuid).unwrap();
}
// Ensure the source strings we pass to glShaderSource are
// null-terminated on buggy platforms.
if self.requires_null_terminated_shader_source {