Skip to content
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

Replace 'list of pending render states' with 'pending render state' #701

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

Manishearth
Copy link
Contributor

fixes #678

cc @ddorwin

r? @toji

index.bs Outdated
@@ -469,23 +469,22 @@ When the <dfn method for="XRSession">updateRenderState(|newState|)</dfn> method
1. If |session|'s [=ended=] value is <code>true</code>, throw an {{InvalidStateError}} and abort these steps.
1. If |newState|'s {{XRRenderStateInit/baseLayer}}'s was created with an {{XRSession}} other than |session|, throw an {{InvalidStateError}} and abort these steps.
1. If |newState|'s {{XRRenderStateInit/inlineVerticalFieldOfView}} is set and |session| is an [=immersive session=], throw an {{InvalidStateError}} and abort these steps.
1. Append |newState| to |session|'s [=list of pending render states=].
1. Set |session|'s [=pending render state=] to |newState|.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work! Calls to updateRenderState() are provided partial state, which is accumulated into the pending state. So, the following:

session.updateRenderState({ depthNear: 1, depthFar: 10 });
session.updateRenderState({ baseLayer: someLayer });
session.updateRenderState({ depthNear: 2 });

Will result in a renderState on the next frame of:

{
  depthNear:2,
  depthFar: 10,
  baseLayer: someLayer
}

In order to accomplish that, only the values that have been explicitly set in the dictionary should be written into the pending state each call. Effectively you'll need to lift the part of the algorithm that says:

If |newState|'s {{XRRenderStateInit/depthFar}} value is set, set |activeState|'s {{XRRenderState/depthFar}} to |newState|'s {{XRRenderStateInit/depthFar}}...

etc. and place it into the updateRenderState() call algorithm instead. Then, during the apply-pending-render-state algorithm the state can simply be copied over wholesale.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch. Hmmm.

@toji
Copy link
Member

toji commented Jun 14, 2019

Perfect! Thank you!

@toji toji merged commit 44327f2 into immersive-web:master Jun 14, 2019
@toji toji added this to the June 2019 milestone Jun 14, 2019
@Manishearth Manishearth deleted the pending-render branch June 14, 2019 21:08
@AdaRoseCannon AdaRoseCannon added the ed:spec Include in newsletter, spec change label Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ed:spec Include in newsletter, spec change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider replacing "list of pending render states" with "pending render state"
3 participants