diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-05-31 15:03:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 15:03:43 -0400 |
commit | 022daccbe102aa67c6a4442f8d9cbccc3a7e221b (patch) | |
tree | 1b474d73a3c9a76774e4095fe3be8e20dcb208d6 | |
parent | 35cd2e93c2fff280e4d238dcd8251a2d2971a421 (diff) | |
parent | 76c29f8bd007a3b91acce7d26b04dab28fc4e658 (diff) | |
download | servo-022daccbe102aa67c6a4442f8d9cbccc3a7e221b.tar.gz servo-022daccbe102aa67c6a4442f8d9cbccc3a7e221b.zip |
Auto merge of #20884 - jdm:more-limits, r=avadacatavra
Don't forward GL parameter gets for constant limits.
This avoids IPC traffic for unchanging constants that are determined when the GL context is created. These changes require https://github.com/emilio/rust-offscreen-rendering-context/pull/123.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #20876.
- [x] There are tests for these changes
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20884)
<!-- Reviewable:end -->
-rw-r--r-- | Cargo.lock | 10 | ||||
-rw-r--r-- | components/canvas/Cargo.toml | 2 | ||||
-rw-r--r-- | components/canvas_traits/Cargo.toml | 2 | ||||
-rw-r--r-- | components/canvas_traits/webgl.rs | 10 | ||||
-rw-r--r-- | components/script/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 31 |
6 files changed, 38 insertions, 19 deletions
diff --git a/Cargo.lock b/Cargo.lock index b86211f1816..16feb52cb6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -278,7 +278,7 @@ dependencies = [ "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", "webrender 0.57.2 (git+https://github.com/servo/webrender)", @@ -297,7 +297,7 @@ dependencies = [ "malloc_size_of 0.0.1", "malloc_size_of_derive 0.0.1", "nonzero 0.0.1", - "offscreen_gl_context 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", @@ -2036,7 +2036,7 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2513,7 +2513,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3921,7 +3921,7 @@ dependencies = [ "checksum objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "877f30f37acef6749b1841cceab289707f211aecfc756553cd63976190e6cc2e" "checksum objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" "checksum objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" -"checksum offscreen_gl_context 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84e4be9374dd9e7caf6771b68b5e9e9a458c34ea2677b57993edada51abb0544" +"checksum offscreen_gl_context 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4e6b463435d693894425acb2d41a28b06b418b54d57f3dabbd2c3ccbf1b5cf53" "checksum ogg 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7137bf02687385302f4c0aecd77cfce052b69f5b4ee937be778e125c62f67e30" "checksum ogg_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fc665717454399cba557c55ad226148996e9266ee291f8a37a98bb2cded0a490" "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index ffb319f6bb0..2c2a928e233 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -20,7 +20,7 @@ gleam = "0.5" ipc-channel = "0.10" log = "0.4" num-traits = "0.1.32" -offscreen_gl_context = {version = "0.16", features = ["serde", "osmesa"]} +offscreen_gl_context = {version = "0.17", features = ["serde", "osmesa"]} serde_bytes = "0.10" servo_config = {path = "../config"} webrender = {git = "https://github.com/servo/webrender"} diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index ffe498484c2..310c9e4eec7 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -18,7 +18,7 @@ lazy_static = "1" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = { path = "../malloc_size_of_derive" } nonzero = {path = "../nonzero"} -offscreen_gl_context = {version = "0.16", features = ["serde"]} +offscreen_gl_context = {version = "0.17", features = ["serde"]} serde = "1.0" serde_bytes = "0.10" servo_config = {path = "../config"} diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index 227f3197d5f..826a1c9b851 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -480,16 +480,6 @@ parameters! { FrontFace = gl::FRONT_FACE, GenerateMipmapHint = gl::GENERATE_MIPMAP_HINT, GreenBits = gl::GREEN_BITS, - MaxCombinedTextureImageUnits = gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS, - MaxCubeMapTextureSize = gl::MAX_CUBE_MAP_TEXTURE_SIZE, - MaxFragmentUniformVectors = gl::MAX_FRAGMENT_UNIFORM_VECTORS, - MaxRenderbufferSize = gl::MAX_RENDERBUFFER_SIZE, - MaxTextureImageUnits = gl::MAX_TEXTURE_IMAGE_UNITS, - MaxTextureSize = gl::MAX_TEXTURE_SIZE, - MaxVaryingVectors = gl::MAX_VARYING_VECTORS, - MaxVertexAttribs = gl::MAX_VERTEX_ATTRIBS, - MaxVertexTextureImageUnits = gl::MAX_VERTEX_TEXTURE_IMAGE_UNITS, - MaxVertexUniformVectors = gl::MAX_VERTEX_UNIFORM_VECTORS, PackAlignment = gl::PACK_ALIGNMENT, RedBits = gl::RED_BITS, SampleBuffers = gl::SAMPLE_BUFFERS, diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index f9a4aadf6d9..e80aac49c0a 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -68,7 +68,7 @@ mozjs = { version = "0.7.1", features = ["promises"]} msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" -offscreen_gl_context = {version = "0.16", features = ["serde"]} +offscreen_gl_context = {version = "0.17", features = ["serde"]} parking_lot = "0.5" phf = "0.7.18" profile_traits = {path = "../profile_traits"} diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 85c6c981b1a..37638e36ee4 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -51,7 +51,7 @@ use euclid::Size2D; use fnv::FnvHashMap; use half::f16; use js::jsapi::{JSContext, JSObject, Type}; -use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue}; +use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value, JSVal, NullValue, UndefinedValue}; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBufferView; use net_traits::image::base::PixelFormat; @@ -1337,6 +1337,35 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { _ => {} } + // Handle any MAX_ parameters by retrieving the limits that were stored + // when this context was created. + let limit = match parameter { + constants::MAX_VERTEX_ATTRIBS => + Some(self.limits.max_vertex_attribs), + constants::MAX_TEXTURE_SIZE => + Some(self.limits.max_tex_size), + constants::MAX_CUBE_MAP_TEXTURE_SIZE => + Some(self.limits.max_cube_map_tex_size), + constants::MAX_COMBINED_TEXTURE_IMAGE_UNITS => + Some(self.limits.max_combined_texture_image_units), + constants::MAX_FRAGMENT_UNIFORM_VECTORS => + Some(self.limits.max_fragment_uniform_vectors), + constants::MAX_RENDERBUFFER_SIZE => + Some(self.limits.max_renderbuffer_size), + constants::MAX_TEXTURE_IMAGE_UNITS => + Some(self.limits.max_texture_image_units), + constants::MAX_VARYING_VECTORS => + Some(self.limits.max_varying_vectors), + constants::MAX_VERTEX_TEXTURE_IMAGE_UNITS => + Some(self.limits.max_vertex_texture_image_units), + constants::MAX_VERTEX_UNIFORM_VECTORS => + Some(self.limits.max_vertex_uniform_vectors), + _ => None, + }; + if let Some(limit) = limit { + return UInt32Value(limit); + } + if !self.extension_manager.is_get_parameter_name_enabled(parameter) { self.webgl_error(WebGLError::InvalidEnum); return NullValue(); |