aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webgl_extensions
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-15 16:00:10 -0500
committerGitHub <noreply@github.com>2017-08-15 16:00:10 -0500
commit90f55ea4580e2a15f7d70d0491444f18b972d450 (patch)
treec85f3cb5d55babab03d56dac8b0d10d588b0a0f9 /components/script/dom/webgl_extensions
parent2e60b27a2186a8cba4b952960155dfcf3f47d7db (diff)
parent703962fe61d673536eb982b45795ae13748f0f6a (diff)
downloadservo-90f55ea4580e2a15f7d70d0491444f18b972d450.tar.gz
servo-90f55ea4580e2a15f7d70d0491444f18b972d450.zip
Auto merge of #17891 - MortimerGoro:webgl_move, r=glennw,emilio
Improved WebGL architecture <!-- Please describe your changes on the following line: --> Info about the big picture and the goals of the WebGL refactor in this thread: https://groups.google.com/forum/#!topic/mozilla.dev.servo/0WMGz60kKzQ I tried to reduce this PR as much as possible as requested in the thread. I'll do separate PRs for other features (e.g.: Batch messages or use shared memory to improve frame times) or fixes. Some tips to ease the review process: - Most changes in DOM objects follow the same pattern (remove CanvasMsg wrapper and use the new sender method). - WebGLCommands are the same ones as before (moved from webrender_api). So those lines are already reviewed. - See WebGL traits in [components/canvas_traits/webgl.rs](https://github.com/servo/servo/pull/17891/files#diff-8701045d01505418701d0631d4d45562) - See WebGLThread and WR External Image bridge in [components/canvas/webgl_thread.rs](https://github.com/servo/servo/pull/17891/files#diff-281554879f39a2a041f7a69d442a5d2e) - The implementation submitted in this PR creates a single `WebGLThread` for all ScriptThread/Pipelines. See that in [components/canvas/webgl_mode/inprocess.rs](https://github.com/servo/servo/pull/17891/files#diff-250070c6c5a38c7f9fa0f5b3c101f68b) The conformance tests will help to guarantee that we don't miss anything. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/17891) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webgl_extensions')
-rw-r--r--components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs15
-rw-r--r--components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs2
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs2
3 files changed, 9 insertions, 10 deletions
diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
index 097742f5441..48385a3d50f 100644
--- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
+++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use canvas_traits::CanvasMsg;
+use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use dom::bindings::js::{JS, MutNullableJS, Root};
@@ -15,7 +15,6 @@ use js::jsapi::JSContext;
use js::jsval::{JSVal, NullValue};
use std::iter;
use super::{WebGLExtension, WebGLExtensions};
-use webrender_api::{self, WebGLCommand, WebGLError};
#[dom_struct]
pub struct OESVertexArrayObject {
@@ -48,8 +47,8 @@ impl OESVertexArrayObject {
impl OESVertexArrayObjectMethods for OESVertexArrayObject {
// https://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/
fn CreateVertexArrayOES(&self) -> Option<Root<WebGLVertexArrayObjectOES>> {
- let (sender, receiver) = webrender_api::channel::msg_channel().unwrap();
- self.ctx.send_renderer_message(CanvasMsg::WebGL(WebGLCommand::CreateVertexArray(sender)));
+ let (sender, receiver) = webgl_channel().unwrap();
+ self.ctx.send_command(WebGLCommand::CreateVertexArray(sender));
let result = receiver.recv().unwrap();
result.map(|vao_id| WebGLVertexArrayObjectOES::new(&self.global(), vao_id))
@@ -66,7 +65,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
if let Some(bound_vao) = self.bound_vao.get() {
if bound_vao.id() == vao.id() {
self.bound_vao.set(None);
- self.ctx.send_renderer_message(CanvasMsg::WebGL(WebGLCommand::BindVertexArray(None)));
+ self.ctx.send_command(WebGLCommand::BindVertexArray(None));
}
}
@@ -80,7 +79,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
}
// Delete the vao
- self.ctx.send_renderer_message(CanvasMsg::WebGL(WebGLCommand::DeleteVertexArray(vao.id())));
+ self.ctx.send_command(WebGLCommand::DeleteVertexArray(vao.id()));
vao.set_deleted();
}
}
@@ -114,7 +113,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
return;
}
- self.ctx.send_renderer_message(CanvasMsg::WebGL(WebGLCommand::BindVertexArray(Some(vao.id()))));
+ self.ctx.send_command(WebGLCommand::BindVertexArray(Some(vao.id())));
vao.set_ever_bound();
self.bound_vao.set(Some(&vao));
@@ -124,7 +123,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
let element_array = vao.bound_buffer_element_array();
self.ctx.set_bound_buffer_element_array(element_array.as_ref().map(|buffer| &**buffer));
} else {
- self.ctx.send_renderer_message(CanvasMsg::WebGL(WebGLCommand::BindVertexArray(None)));
+ self.ctx.send_command(WebGLCommand::BindVertexArray(None));
self.bound_vao.set(None);
self.ctx.set_bound_attrib_buffers(iter::empty());
}
diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs
index e44b7c9bc42..2fe109cafa6 100644
--- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs
+++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLVertexArrayId;
use core::cell::Ref;
use core::iter::FromIterator;
use dom::bindings::cell::DOMRefCell;
@@ -15,7 +16,6 @@ use dom::webglobject::WebGLObject;
use dom_struct::dom_struct;
use std::cell::Cell;
use std::collections::HashMap;
-use webrender_api::WebGLVertexArrayId;
#[dom_struct]
pub struct WebGLVertexArrayObjectOES {
diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs
index 28c32dede64..2a780b129ff 100644
--- a/components/script/dom/webgl_extensions/extensions.rs
+++ b/components/script/dom/webgl_extensions/extensions.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use canvas_traits::webgl::WebGLError;
use core::iter::FromIterator;
use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
@@ -19,7 +20,6 @@ use std::cell::Ref;
use std::collections::{HashMap, HashSet};
use super::{ext, WebGLExtension};
use super::wrapper::{WebGLExtensionWrapper, TypedWebGLExtensionWrapper};
-use webrender_api::WebGLError;
// Data types that are implemented for texImage2D and texSubImage2D in WebGLRenderingContext
// but must trigger a InvalidValue error until the related WebGL Extensions are enabled.