aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-01-04 02:54:16 -0500
committerGitHub <noreply@github.com>2019-01-04 02:54:16 -0500
commitc4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e (patch)
treeb111aaba4a6168c35a71132254d94f5e4f1ab68e /components/script/dom/webglrenderingcontext.rs
parentc6f6fb697d09513a51cdba4077c9ea78dba8afa7 (diff)
parente544462b6c4732987c5c8154d4a4e33539e83d13 (diff)
downloadservo-c4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e.tar.gz
servo-c4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e.zip
Auto merge of #22528 - Manishearth:webxr, r=jdm,MortimerGoro
Preliminary WebXR support This implements just enough WebXR to display to 3DOF devices in immersive mode only. Couple missing things: - [ ] Handling reference spaces (even if just supporting eye-level spaces) - [x] Spec links - [ ] We enter immersive mode when baseLayer is set, but it seems like we're supposed to do this when requestSession is called (https://github.com/immersive-web/webxr/issues/453) - [ ] VR/XR should block less (https://github.com/servo/servo/issues/22505) - [x] More pref-gating - [x] `views` is a method instead of an attribute because we don't support FrozenArray <s>Once I add spec links and pref gating</s> this can be landed as-is for further experimentation. r? @jdm @MortimerGoro <!-- 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/22528) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 726a59db4ad..6175f2ad2b9 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -157,6 +157,7 @@ pub struct WebGLRenderingContext {
current_scissor: Cell<(i32, i32, u32, u32)>,
#[ignore_malloc_size_of = "Because it's small"]
current_clear_color: Cell<(f32, f32, f32, f32)>,
+ size: Cell<Size2D<u32>>,
extension_manager: WebGLExtensions,
capabilities: Capabilities,
default_vao: DomOnceCell<WebGLVertexArrayObjectOES>,
@@ -211,6 +212,9 @@ impl WebGLRenderingContext {
current_program: MutNullableDom::new(None),
current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)),
current_scissor: Cell::new((0, 0, size.width, size.height)),
+ // FIXME(#21718) The backend is allowed to choose a size smaller than
+ // what was requested
+ size: Cell::new(size),
current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0)),
extension_manager: WebGLExtensions::new(webgl_version),
capabilities: Default::default(),
@@ -266,6 +270,9 @@ impl WebGLRenderingContext {
pub fn recreate(&self, size: Size2D<u32>) {
let (sender, receiver) = webgl_channel().unwrap();
self.webgl_sender.send_resize(size, sender).unwrap();
+ // FIXME(#21718) The backend is allowed to choose a size smaller than
+ // what was requested
+ self.size.set(size);
if let Err(msg) = receiver.recv().unwrap() {
error!("Error resizing WebGLContext: {}", msg);
@@ -340,6 +347,10 @@ impl WebGLRenderingContext {
}
}
+ pub fn size(&self) -> Size2D<u32> {
+ self.size.get()
+ }
+
// Helper function for validating framebuffer completeness in
// calls touching the framebuffer. From the GLES 2.0.25 spec,
// page 119: