-
Notifications
You must be signed in to change notification settings - Fork 401
Update XRRenderStateInit with layers sequence #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update XRRenderStateInit with layers sequence #999
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also null out layers when baseLayer is set, below
index.bs
Outdated
@@ -642,6 +642,7 @@ When this method is invoked, the user agent MUST run the following steps: | |||
|
|||
1. Let |session| be the target {{XRSession}}. | |||
1. If |session|'s [=ended=] value is <code>true</code>, throw an {{InvalidStateError}} and abort these steps. | |||
1. If |newState|'s {{XRRenderStateInit/layers}}'s value is not <code>null</code>, throw an {{InvalidStateError}} and abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting that you have something like
1. If |newState|'s {{XRRenderStateInit/layers}}'s value is not <code>null</code>If |newState|'s {{XRRenderStateInit/layers}}'s value is not <code>null</code>, run [=update layer state=] with [=pending render state=]
and put it right before the depthNear
line
and in the definition for that algorithm, just throw an InvalidStateError with a note that the layers spec will introduce new semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. take a look and let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to operate on the init state, it can get the pending state off the session
@Manishearth If you think this is good to merge, can you do the PR? |
What PR? This is the PR? :) But I want to wait for Brandon. |
Sorry, I mistyped :-)
ok. @toji , let me know what you think. My layers PR is gated on this landing first. |
/agenda to confirm with the WG that this is the pattern we want (need?) To be honest I'm not thrilled with this pattern. I'm concerned that this type of pattern means that our modules can't stay very modular, and that the core WebXR spec will over time become a pile of unimplemented stubs and empty interfaces. It'll also make it more difficult for UAs to implement the core spec over time because they have to add stubs for a lot of modules they may not intend to support in order to be compliant, and it removes some options for feature detection (if the presence of the interface was going to be the primary indicator, which it's not in this case.) But... at the same time I don't know if there's a lot that WebIDL let's us do about it, and that's more of a issue on their side than ours. If this is the only way we can structure the WebIDL so that the various UAs can consume it cleanly then so be it. I'm sympathetic to Rik wanting to land this ASAP, but I'd feel better if we talked about it with the wider working group first. |
I agree it's weird to have to update the main spec. Hopefully we can discuss it in tomorrow's call. |
I think we still have a benefit to maintaining this separation, as long as we only need a couple hooks we still can stay pretty modular. I think the benefits of maintaining stuff separate have been pretty clear for me so far, I would never have been able to keep up if layers were a part of the same spec (and if it were it would likely be more tightly hooked in) |
If you were replying to me, that's not what I meant. That way we won't have to make any changes or add hooks to the WebXR spec. FWIW it's really unfortunate that we don't have a way to extend a dictionary in WebIDL... |
Oh, no, I was replying to Brandon, and I k kw he isn't quite making that point either, he's just suggesting we discuss it in a call, which I wholeheartedly agree with! I understand what you were suggesting. I would prefer to avoid that API if possible since you still have to patch algorithms to make it work. But yeah it's an option if we can't do this. Partial dictionaries still don't fix the issue of needing to patch algorithms at certain steps (instead of replacing hooks, which is very straightforward and less fragile) |
I have pinged some DOM folks at Mozilla that may be opinionated on the pattern here. |
One alternate idea... Would it make sense to have a separate function for adding/changing the layers sequence, and provide a separate state dictionary for each layer type? The method for updating the state of a layer could be added to the interface of the layer object itself. This would allow feature detection by checking for the presence of the |
So add a function (eq We would still have to define that you can't set a |
Could we specify that any If the This would allow both the feature detection, while not changing any existing behavior. |
@kearwood we could do this, the interaction with baseLayer gets weird, and ideally we'd have an API where these things stay on renderState. But yes, this is an option available to us. |
Without changing the algorithms in the Core spec, it would also effectively limit
|
From an implementor's standpoint, that would be harder to implement and I suspect it's also more confusing to users. |
I'm less opinionated about such a solution vs the proposal in the current PR. I'm hoping to get feedback soon from out colleagues more familiar with the current state of WebIDL design patterns. |
I have had the opportunity to review this with peers at Mozilla. It seems that there are no concerns about the feature detection with this schema, nor problems with having differing algorithms within We would like to avoid adding the I would like to propose landing this PR with two small changes:
|
That's great news!
|
@Manishearth how can we get the change proposed by @kearwood in? |
Note that this change to the core spec doesn't affect feature detection since it only affects a dict, and also there is no change of functionality since the (Just wanted to make sure this was clear)
We can instead have Alternatively we can make everything inherit from an empty |
OK. I will make that change. This will have some testable side effects but it's extremely unlikely it will break sites. |
@Manishearth let me know if this looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't XRWebGLLayer need to inherit from XRLayer here?
Which of the two options from my comment are you moving forward with?
(also I only want to merge once @toji has also rubber stamped)
Yes. I will fix
The former. |
I think it shouldn't be called XRGenericLayer in the layers spec, but that's fine, we can figure out a better name there. Also the name will never be used by client code so shrug |
@Manishearth immersive-web/layers#88 has the changes to the layers spec |
index.bs
Outdated
@@ -646,6 +655,7 @@ When this method is invoked, the user agent MUST run the following steps: | |||
1. If |newState|'s {{XRRenderStateInit/inlineVerticalFieldOfView}} is set and |session| is an [=immersive session=], throw an {{InvalidStateError}} and abort these steps. | |||
1. Let |activeState| be |session|'s [=active render state=]. | |||
1. If |session|'s [=pending render state=] is <code>null</code>, set it to a copy of |activeState|. | |||
1. If |newState|'s {{XRRenderStateInit/layers}}'s value is not <code>null</code>, run [=update the pending layers state=] with |session| and |newState|. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized: we want the patch to be able to null out layers
when baseLayer
is set, right? in that case this step should be unconditional, and the update the pending layers state
patch in the layers spec should handle "layers set" and "layers not set" differently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should always call that function so when we patch it in the layers spec, we can do the conditional checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Manishearth I just updated the patch.
Hard to keep my head around a patch of a patch of a patch :-)
@@ -634,6 +634,15 @@ Each {{XRSession}} has a <dfn>minimum inline field of view</dfn> and a <dfn>maxi | |||
|
|||
Each {{XRSession}} has a <dfn>minimum near clip plane</dfn> and a <dfn>maximum far clip plane</dfn>, defined in meters. The values MUST be determined by the user agent and MUST be non-negative. The [=minimum near clip plane=] SHOULD be less than <code>0.1</code>. The [=maximum far clip plane=] SHOULD be greater than <code>1000.0</code> (and MAY be infinite). | |||
|
|||
<div class="algorithm" data-algorithm="update-layers-state"> | |||
|
|||
When the user agent will <dfn>update the pending layers state</dfn> with {{XRSession}} <var ignore>session</var> and {{XRRenderStateInit}} |newState|, it must run the following steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL <var ignore>
. Nifty!
(still waiting on Brandon to merge, but LGTM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed review. I definitely feel much more comfortable with this pattern vs. what we had previously. Thanks all for contributing to a more elegant solution!
Thanks! If you or @Manishearth could merge it, I can make sure that all the dfn linking from the Layers spec work. |
* Update XRRenderStateInit with layers sequence * removed index.html * refactored the layers algorithm * updated algorithm per Manish's suggestions * updated algorithm per Manish's suggestions * changed layers inheritance following feedback from Kip * removed bogus file * Made XRWebGLLayer inherit from XRLayer * switch type of exception * fix typo * removed check from updateRenderState * fix bikeshed warning + moved to an earlier step * removed bogus file Co-authored-by: Henricus Cabanier <cabanier@fb.com>
No description provided.