Skip to content

Commit

Permalink
Update XRWebGLLayer to match specification.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jul 20, 2020
1 parent 9daadd0 commit f425e75
Show file tree
Hide file tree
Showing 59 changed files with 36 additions and 308 deletions.
7 changes: 1 addition & 6 deletions components/script/dom/webidls/XRWebGLLayer.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@ interface XRWebGLLayer {
XRWebGLRenderingContext context,
optional XRWebGLLayerInit layerInit = {});
// // Attributes
readonly attribute XRWebGLRenderingContext context;

readonly attribute boolean antialias;
readonly attribute boolean depth;
readonly attribute boolean stencil;
readonly attribute boolean alpha;
readonly attribute boolean ignoreDepthValues;

readonly attribute WebGLFramebuffer? framebuffer;
readonly attribute unsigned long framebufferWidth;
readonly attribute unsigned long framebufferHeight;

// // Methods
XRViewport? getViewport(XRView view);
// void requestViewportScaling(double viewportScaleFactor);

// // Static Methods
// static double getNativeFramebufferScaleFactor(XRSession session);
Expand Down
6 changes: 2 additions & 4 deletions components/script/dom/xrsession.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCal
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionMode;
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
XRWebGLLayerMethods, XRWebGLRenderingContext,
};
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLRenderingContext;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
Expand Down Expand Up @@ -497,7 +495,7 @@ impl XRSession {

pub fn dirty_layers(&self) {
if let Some(layer) = self.RenderState().GetBaseLayer() {
match layer.Context() {
match layer.context() {
XRWebGLRenderingContext::WebGLRenderingContext(c) => c.mark_as_dirty(),
XRWebGLRenderingContext::WebGL2RenderingContext(c) => {
c.base_context().mark_as_dirty()
Expand Down
39 changes: 15 additions & 24 deletions components/script/dom/xrwebgllayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct XRWebGLLayer {
depth: bool,
stencil: bool,
alpha: bool,
ignore_depth_values: bool,
context: RenderingContext,
session: Dom<XRSession>,
/// If none, this is an inline session (the composition disabled flag is true)
Expand All @@ -94,6 +95,7 @@ impl XRWebGLLayer {
depth: init.depth,
stencil: init.stencil,
alpha: init.alpha,
ignore_depth_values: init.ignoreDepthValues,
layer_id,
context: match context {
XRWebGLRenderingContext::WebGLRenderingContext(ctx) => {
Expand Down Expand Up @@ -276,31 +278,8 @@ impl XRWebGLLayer {
framebuffer.upcast::<WebGLObject>().context().Flush();
Some(())
}
}

impl XRWebGLLayerMethods for XRWebGLLayer {
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-depth
fn Depth(&self) -> bool {
self.depth
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-stencil
fn Stencil(&self) -> bool {
self.stencil
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-antialias
fn Antialias(&self) -> bool {
self.antialias
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-alpha
fn Alpha(&self) -> bool {
self.alpha
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-context
fn Context(&self) -> XRWebGLRenderingContext {
pub(crate) fn context(&self) -> XRWebGLRenderingContext {
match self.context {
RenderingContext::WebGL1(ref ctx) => {
XRWebGLRenderingContext::WebGLRenderingContext(DomRoot::from_ref(&**ctx))
Expand All @@ -310,6 +289,18 @@ impl XRWebGLLayerMethods for XRWebGLLayer {
},
}
}
}

impl XRWebGLLayerMethods for XRWebGLLayer {
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-antialias
fn Antialias(&self) -> bool {
self.antialias
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-ignoredepthvalues
fn IgnoreDepthValues(&self) -> bool {
self.ignore_depth_values
}

/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-framebuffer
fn GetFramebuffer(&self) -> Option<DomRoot<WebGLFramebuffer>> {
Expand Down
2 changes: 2 additions & 0 deletions tests/wpt/include.ini
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ skip: true
skip: false
[webxr]
skip: false
[dom-overlay]
skip: true
[WebIDL]
skip: false
[webmessaging]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
[Tests environmentBlendMode for an AR device]
expected: FAIL

[Tests environmentBlendMode for a VR device]
expected: FAIL

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[ar_dom_overlay.https.html]
expected: ERROR
[Ensures DOM Overlay element selection works]
expected: FAIL

Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions tests/wpt/metadata/webxr/events_session_select.https.html.ini

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[events_session_squeeze.https.html]
expected: ERROR
[XRInputSources primary input presses properly fires off the right events]
expected: FAIL
expected: TIMEOUT

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[xrInputSource_gamepad_input_registered.https.html]
expected: ERROR
[WebXR InputSource's gamepad properly registers input]
expected: FAIL

This file was deleted.

4 changes: 0 additions & 4 deletions tests/wpt/metadata/webxr/getInputPose_pointer.https.html.ini

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@
[Ensures subscription to hit test works with local-floor space]
expected: FAIL

[Ensures subscription to hit test works with viewer space - straight up - no results]
expected: FAIL

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[ar_hittest_subscription_transientInputSources.https.html]
expected: ERROR
[Ensures subscription to transient hit test works with an XRSpace from input source - after move - 1 result]
expected: FAIL
expected: NOTRUN

[Ensures subscription to transient hit test works with an XRSpace from input source - after move - no results]
expected: FAIL
expected: NOTRUN

[Ensures subscription to transient hit test works with an XRSpace from input source - no move]
expected: FAIL
expected: TIMEOUT

3 changes: 0 additions & 3 deletions tests/wpt/metadata/webxr/idlharness.https.window.js.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@
[XRBoundedReferenceSpace interface object name]
expected: FAIL

[XRWebGLLayer interface: attribute ignoreDepthValues]
expected: FAIL

[XRBoundedReferenceSpace interface: existence and properties of interface prototype object]
expected: FAIL

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[xrBoundedReferenceSpace_updates.https.html]
expected: TIMEOUT
['XRBoundedReferenceSpace updates properly when the changes are applied]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[xrDevice_disconnect_ends.https.html]
expected: TIMEOUT
[Immersive session ends when device is disconnected]
expected: FAIL

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,3 @@
[Tests requestSession ignores unknown optionalFeatures]
expected: FAIL

[Tests requestSession ignores unknown objects in optionalFeatures]
expected: FAIL

[Tests requestSession ignores unknown strings in optionalFeatures]
expected: FAIL

[Tests requestSession accepts XRSessionInit dictionary]
expected: FAIL

[Tests requestSession accepts XRSessionInit dictionary with empty feature lists]
expected: FAIL

7 changes: 0 additions & 7 deletions tests/wpt/metadata/webxr/xrFrame_getPose.https.html.ini

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions tests/wpt/metadata/webxr/xrFrame_lifetime.https.html.ini

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[xrReferenceSpace_originOffsetBounded.https.html]
expected: TIMEOUT
[Updating XRBoundedReferenceSpace origin offset updates view, input matrices, and bounds geometry.]
expected: FAIL

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[xrReferenceSpace_relationships.https.html]
expected: ERROR
[Bounded space, viewer space, local and local-floor space have correct poses w.r.t. each other]
expected: FAIL
expected: TIMEOUT

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[xrSession_cancelAnimationFrame_invalidhandle.https.html]
expected: TIMEOUT
[XRSession cancelAnimationFrame does not have unexpected behavior when given invalid handles on immersive testSession]
expected: FAIL
expected: TIMEOUT

[XRSession cancelAnimationFrame does not have unexpected behavior when given invalid handles on non-immersive testSession]
expected: FAIL
expected: NOTRUN

7 changes: 0 additions & 7 deletions tests/wpt/metadata/webxr/xrSession_end.https.html.ini

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f425e75

Please sign in to comment.