Update XRWebGLLayer to match specification.

This commit is contained in:
Josh Matthews 2020-07-17 14:13:09 -04:00
parent 9daadd03cc
commit c34e587140
59 changed files with 37 additions and 309 deletions

View file

@ -22,12 +22,8 @@ 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;
@ -35,7 +31,6 @@ interface XRWebGLLayer {
// // Methods
XRViewport? getViewport(XRView view);
// void requestViewportScaling(double viewportScaleFactor);
// // Static Methods
// static double getNativeFramebufferScaleFactor(XRSession session);

View file

@ -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;
@ -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()

View file

@ -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)
@ -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) => {
@ -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))
@ -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>> {

View file

@ -187,6 +187,8 @@ skip: true
skip: false
[webxr]
skip: false
[dom-overlay]
skip: true
[WebIDL]
skip: false
[webmessaging]

View file

@ -1,4 +0,0 @@
[xrDevice_requestSession_immersive-ar.https.html]
[Tests requestSession accepts immersive-ar mode]
expected: FAIL

View file

@ -2,6 +2,3 @@
[Tests environmentBlendMode for an AR device]
expected: FAIL
[Tests environmentBlendMode for a VR device]
expected: FAIL

View file

@ -1,4 +1,5 @@
[ar_dom_overlay.https.html]
expected: ERROR
[Ensures DOM Overlay element selection works]
expected: FAIL

View file

@ -1,4 +0,0 @@
[events_input_source_recreation.https.html]
[Input sources are re-created when handedness or target ray mode changes]
expected: FAIL

View file

@ -1,4 +0,0 @@
[events_session_select.https.html]
[XRInputSources primary input presses properly fires off the right events]
expected: FAIL

View file

@ -1,4 +0,0 @@
[events_session_select_subframe.https.html]
[Ensures that an XRInputSources primary input being pressed and released in the space of a single frame properly fires off the right events]
expected: FAIL

View file

@ -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

View file

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

View file

@ -1,4 +0,0 @@
[getInputPose_handedness.https.html]
[XRInputSources properly communicate their handedness]
expected: FAIL

View file

@ -1,4 +0,0 @@
[getInputPose_pointer.https.html]
[XRInputSources with a target ray mode of 'tracked-pointer' properly communicate their poses]
expected: FAIL

View file

@ -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

View file

@ -1,10 +0,0 @@
[ar_hittest_subscription_states_regular.https.html]
[Hit test subscription succeeds if the feature was requested]
expected: FAIL
[Hit test subscription fails if the feature was not requested]
expected: FAIL
[Hit test subscription fails if the feature was requested but the session already ended]
expected: FAIL

View file

@ -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

View file

@ -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

View file

@ -1,4 +0,0 @@
[navigator_xr_sameObject.https.html]
[Navigator.xr meets [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[render_state_vertical_fov_immersive.https.html]
[inlineVerticalFieldOfView is set appropriately on immersively sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[render_state_vertical_fov_inline.https.html]
[inlineVerticalFieldOfView is set appropriately on inline sessions]
expected: FAIL

View file

@ -1,4 +1,5 @@
[xrBoundedReferenceSpace_updates.https.html]
expected: TIMEOUT
['XRBoundedReferenceSpace updates properly when the changes are applied]
expected: FAIL

View file

@ -1,4 +1,5 @@
[xrDevice_disconnect_ends.https.html]
expected: TIMEOUT
[Immersive session ends when device is disconnected]
expected: FAIL
expected: TIMEOUT

View file

@ -1,10 +0,0 @@
[xrDevice_requestSession_immersive.https.html]
[Tests requestSession ignores unknown optionalFeatures]
expected: FAIL
[Tests requestSession accepts XRSessionInit dictionary]
expected: FAIL
[Tests requestSession resolves when supported]
expected: FAIL

View file

@ -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

View file

@ -1,7 +0,0 @@
[xrFrame_getPose.https.html]
[XRFrame.getPose works for immersive sessions]
expected: FAIL
[XRFrame.getPose works for non-immersive sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrFrame_getViewerPose_getPose.https.html]
[XRFrame getViewerPose(refSpace) matches getPose(viewer, refSpace).]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrFrame_lifetime.https.html]
[XRFrame methods throw exceptions outside of the requestAnimationFrame callback for non-immersive sessions]
expected: FAIL
[XRFrame methods throw exceptions outside of the requestAnimationFrame callback for immersive sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrFrame_session_sameObject.https.html]
[XRFrame.session meets [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrInputSource_add_remove.https.html]
[XRInputSources can be properly added and removed from the session]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrInputSource_profiles.https.html]
[WebXR InputSource's profiles list can be set]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrInputSource_sameObject.https.html]
[XRInputSource attributes meet [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrPose_transform_sameObject.https.html]
[XRPose.transform meets [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrReferenceSpace_originOffset.https.html]
[Updating XRReferenceSpace origin offset updates view and input matrices.]
expected: FAIL

View file

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

View file

@ -1,4 +0,0 @@
[xrReferenceSpace_originOffset_viewer.https.html]
[Creating XRReferenceSpace origin offset off of `viewer` space works.]
expected: FAIL

View file

@ -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

View file

@ -1,4 +0,0 @@
[xrRigidTransform_constructor.https.html]
[XRRigidTransform constructor works]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrRigidTransform_inverse.https.html]
[XRRigidTransform inverse works]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrRigidTransform_sameObject.https.html]
[XRRigidTransform position and orientation meet [SameObject\] requirements]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_cancelAnimationFrame.https.html]
[XRSession requestAnimationFrame callbacks can be unregistered with cancelAnimationFrame for non-immersive sessions]
expected: FAIL
[XRSession requestAnimationFrame callbacks can be unregistered with cancelAnimationFrame for immersive sessions]
expected: FAIL

View file

@ -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

View file

@ -1,7 +0,0 @@
[xrSession_end.https.html]
[end event fires when non-immersive session ends]
expected: FAIL
[end event fires when immersive session ends]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_requestAnimationFrame_callback_calls.https.html]
[XRSession requestAnimationFrame calls the provided callback a non-immersive session]
expected: FAIL
[XRSession requestAnimationFrame calls the provided callback for an immersive session]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrSession_requestAnimationFrame_data_valid.https.html]
[RequestAnimationFrame resolves with good data]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_requestAnimationFrame_getViewerPose.https.html]
[XRFrame getViewerPose updates on the next frame for non-immersive sessions]
expected: FAIL
[XRFrame getViewerPose updates on the next frame for immersive sessions]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_requestAnimationFrame_timestamp.https.html]
[XRFrame getViewerPose updates on the next frame for immersive]
expected: FAIL
[XRFrame getViewerPose updates on the next frame for non-immersive]
expected: FAIL

View file

@ -1,37 +0,0 @@
[xrSession_requestReferenceSpace_features.https.html]
[Non-immersive session rejects unbounded space even when requested]
expected: FAIL
[Immersive session supports local space by default]
expected: FAIL
[Non-immersive session supports local-floor space when required]
expected: FAIL
[Immersive session rejects local-floor space if not requested]
expected: FAIL
[Immersive session supports local-floor space when required]
expected: FAIL
[Non-immersive session rejects bounded-floor space even when requested]
expected: FAIL
[Non-immersive session supports local space when optional]
expected: FAIL
[Immersive session supports local-floor space when optional]
expected: FAIL
[Non-immersive session supports local space when required]
expected: FAIL
[Non-immersive session supports viewer space by default]
expected: FAIL
[Non-immersive session rejects local space if not requested]
expected: FAIL
[Immersive session supports viewer space by default]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrSession_sameObject.https.html]
[XRSession attributes meet [SameObject\] requirement]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrSession_viewer_referenceSpace.https.html]
[Identity reference space provides correct poses for immersive sessions]
expected: FAIL
[Identity reference space provides correct poses for inline sessions]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrView_eyes.https.html]
[XRView.eye is correct for non-immersive sessions]
expected: FAIL
[XRView.eye is correct for immersive sessions]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrView_match.https.html]
[XRFrame contains the expected views]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrView_sameObject.https.html]
[XRView attributes meet [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrViewerPose_views_sameObject.https.html]
[XRViewerPose.views meets [SameObject\] requirement]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrViewport_valid.https.html]
[XRViewport attributes are valid]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrWebGLLayer_framebuffer_draw.https.html]
[Ensure a WebGL layer's framebuffer can only be drawn to inside a XR frame]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrWebGLLayer_framebuffer_sameObject.https.html]
[XRWebGLLayer.framebuffer meets [SameObject\] requirement]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrWebGLLayer_opaque_framebuffer.https.html]
[Ensure that the framebuffer given by the WebGL layer is opaque for immersive]
expected: FAIL
[Ensure that the framebuffer given by the WebGL layer is opaque for non-immersive]
expected: FAIL

View file

@ -1,7 +0,0 @@
[xrWebGLLayer_viewports.https.html]
[XRWebGLLayer reports a valid viewports for inline sessions]
expected: FAIL
[XRWebGLLayer reports a valid viewports for immersive sessions]
expected: FAIL