diff --git a/Cargo.lock b/Cargo.lock index a8da471a21..5bc657177c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -188,7 +188,7 @@ name = "cgl" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -242,7 +242,7 @@ name = "compositor" version = "0.1.0" dependencies = [ "compositor-windows 0.1.0", - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.61.0", ] @@ -415,7 +415,7 @@ name = "direct-composition" version = "0.1.0" dependencies = [ "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.61.0", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -592,12 +592,30 @@ dependencies = [ "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gleam" -version = "0.6.17" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1753,7 +1771,7 @@ dependencies = [ "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1787,7 +1805,7 @@ dependencies = [ "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.61.0", @@ -1914,7 +1932,7 @@ dependencies = [ "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2059,7 +2077,9 @@ dependencies = [ "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" "checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" "checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" -"checksum gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7f46fd8874e043ffac0d638ed1567a2584f7814f6d72b4db37ab1689004a26c4" +"checksum gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +"checksum gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cae10d7c99d0e77b4766e850a60898a17c1abaf01075531f1066f03dc7dc5fc5" +"checksum gleam 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332d1f4e6c6181ed07178f84a552b2387d43ecf6821a86c22cfb3883ea3fb1b9" "checksum glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb26027a84c3b9e1949ef0df0b6a3db8d0c124243a5c161ea25c7def90cb1474" "checksum glutin_egl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23f48987ab6cb2b61ad903b59e54a2fd0c380a7baff68cffd6826b69a73dd326" "checksum glutin_emscripten_sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "245b3fdb08df6ffed7585365851f8404af9c7e2dd4b59f15262e968b6a95a0c7" diff --git a/direct-composition/Cargo.toml b/direct-composition/Cargo.toml index 86114cb50b..916a22349c 100644 --- a/direct-composition/Cargo.toml +++ b/direct-composition/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [target.'cfg(windows)'.dependencies] euclid = "0.20" -gleam = "0.6.2" +gleam = "0.9.2" mozangle = {version = "0.3.1", features = ["egl"]} webrender = {path = "../webrender"} winapi = {version = "0.3", features = ["winerror", "d3d11", "dcomp"]} diff --git a/example-compositor/compositor/Cargo.toml b/example-compositor/compositor/Cargo.toml index 119865d5b0..31c9763435 100644 --- a/example-compositor/compositor/Cargo.toml +++ b/example-compositor/compositor/Cargo.toml @@ -7,7 +7,7 @@ license = "MPL-2.0" [dependencies] webrender = { path = "../../webrender" } -gleam = "0.6.2" +gleam = "0.9.2" [target.'cfg(windows)'.dependencies] compositor-windows = { path = "../compositor-windows" } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 45b249b389..3052d6b7cf 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -61,7 +61,7 @@ debug = ["webrender/capture", "webrender/debugger", "webrender/profiler"] app_units = "0.7" env_logger = "0.5" euclid = "0.20" -gleam = "0.6.2" +gleam = "0.9.2" glutin = "0.21" rayon = "1" webrender = { path = "../webrender" } diff --git a/servo-tidy.toml b/servo-tidy.toml index dc956db85f..84ec80db86 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -15,6 +15,8 @@ packages = [ "rand_core", "winapi", "yaml-rust", + # old versions of cgl depends on an old version of gleam + "gleam", # These are tracked in bug 1587468, see there for pending work. "proc-macro2", diff --git a/webrender/Cargo.toml b/webrender/Cargo.toml index 995bdcc787..870b241375 100644 --- a/webrender/Cargo.toml +++ b/webrender/Cargo.toml @@ -32,7 +32,7 @@ cfg-if = "0.1.2" cstr = "0.1.2" euclid = { version = "0.20.0", features = ["serde"] } fxhash = "0.2.1" -gleam = "0.6.17" +gleam = "0.9.2" image_loader = { optional = true, version = "0.22", package = "image", default-features = false, features = ["png_codec"] } lazy_static = "1" log = "0.4" diff --git a/webrender/res/cs_border_segment.glsl b/webrender/res/cs_border_segment.glsl index a005418dba..0b833d278a 100644 --- a/webrender/res/cs_border_segment.glsl +++ b/webrender/res/cs_border_segment.glsl @@ -16,7 +16,11 @@ flat varying vec4 vColor11; flat varying vec4 vColorLine; // x = segment, y = styles, z = edge axes, w = clip mode -flat varying ivec4 vConfig; +// Since by default in GLES the vertex shader uses highp +// and the fragment shader uses mediump, we explicitely +// use mediump precision so we align with the default +// mediump precision in the fragment shader. +flat varying mediump ivec4 vConfig; // xy = Local space position of the clip center. // zw = Scale the rect origin by this to get the outer @@ -193,8 +197,8 @@ void main(void) { vConfig = ivec4( segment, - style0 | (style1 << 16), - edge_axis.x | (edge_axis.y << 16), + style0 | (style1 << 8), + edge_axis.x | (edge_axis.y << 8), clip_mode ); vPartialWidths = vec4(aWidths / 3.0, aWidths / 2.0); @@ -345,8 +349,8 @@ void main(void) { vec4 color0, color1; int segment = vConfig.x; - ivec2 style = ivec2(vConfig.y & 0xffff, vConfig.y >> 16); - ivec2 edge_axis = ivec2(vConfig.z & 0xffff, vConfig.z >> 16); + ivec2 style = ivec2(vConfig.y & 0xff, vConfig.y >> 8); + ivec2 edge_axis = ivec2(vConfig.z & 0xff, vConfig.z >> 8); int clip_mode = vConfig.w; float mix_factor = 0.0; diff --git a/webrender/src/device/gl.rs b/webrender/src/device/gl.rs index 327f5f417d..d1881a8a5d 100644 --- a/webrender/src/device/gl.rs +++ b/webrender/src/device/gl.rs @@ -949,6 +949,8 @@ pub struct Capabilities { /// Whether the driver supports uploading to textures from a non-zero /// offset within a PBO. pub supports_nonzero_pbo_offsets: bool, + /// Whether the driver supports specifying the texture usage up front. + pub supports_texture_usage: bool, } #[derive(Clone, Debug)] @@ -1309,6 +1311,8 @@ impl Device { gl.provoking_vertex_angle(gl::FIRST_VERTEX_CONVENTION); } + let supports_texture_usage = supports_extension(&extensions, "GL_ANGLE_texture_usage"); + // Our common-case image data in Firefox is BGRA, so we make an effort // to use BGRA as the internal texture storage format to avoid the need // to swizzle during upload. Currently we only do this on GLES (and thus @@ -1480,6 +1484,7 @@ impl Device { supports_khr_debug, supports_texture_swizzle, supports_nonzero_pbo_offsets, + supports_texture_usage, }, color_formats, @@ -2084,6 +2089,10 @@ impl Device { self.bind_texture(DEFAULT_TEXTURE, &texture, Swizzle::default()); self.set_texture_parameters(texture.target, filter); + if self.capabilities.supports_texture_usage && render_target.is_some() { + self.gl.tex_parameter_i(texture.target, gl::TEXTURE_USAGE_ANGLE, gl::FRAMEBUFFER_ATTACHMENT_ANGLE as gl::GLint); + } + // Allocate storage. let desc = self.gl_describe_format(texture.format); let is_array = match texture.target { diff --git a/wrench/Cargo.toml b/wrench/Cargo.toml index cb4cc9303e..06a5e4ffca 100644 --- a/wrench/Cargo.toml +++ b/wrench/Cargo.toml @@ -12,7 +12,7 @@ bincode = "1.0" byteorder = "1.0" env_logger = { version = "0.5", optional = true } euclid = "0.20" -gleam = "0.6.2" +gleam = "0.9.2" glutin = "0.21" app_units = "0.7" clap = { version = "2", features = ["yaml"] }