Replace 'list of pending render states' with 'pending render state'#701
Conversation
| 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|. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Oh, good catch. Hmmm.
|
Perfect! Thank you! |
fixes #678
cc @ddorwin
r? @toji