aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-05-31 15:03:43 -0400
committerGitHub <noreply@github.com>2018-05-31 15:03:43 -0400
commit022daccbe102aa67c6a4442f8d9cbccc3a7e221b (patch)
tree1b474d73a3c9a76774e4095fe3be8e20dcb208d6 /components/script/dom/webglrenderingcontext.rs
parent35cd2e93c2fff280e4d238dcd8251a2d2971a421 (diff)
parent76c29f8bd007a3b91acce7d26b04dab28fc4e658 (diff)
downloadservo-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 -->
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs31
1 files changed, 30 insertions, 1 deletions
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();