Skip to content

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

Merged
toji merged 2 commits into
immersive-web:masterfrom
Manishearth:pending-render
Jun 14, 2019
Merged

Replace 'list of pending render states' with 'pending render state'#701
toji merged 2 commits into
immersive-web:masterfrom
Manishearth:pending-render

Conversation

@Manishearth

Copy link
Copy Markdown
Contributor

fixes #678

cc @ddorwin

r? @toji

Comment thread index.bs Outdated
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
Copy Markdown
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
Copy Markdown
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

toji commented Jun 14, 2019

Copy link
Copy Markdown
Member

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