KEMBAR78
Fix for allocating textures by cabanier · Pull Request #160 · immersive-web/layers · GitHub
Skip to content

Conversation

@cabanier
Copy link
Member

After the latest changes, the spec was incorrect for non-projection layers.
This change breaks projection layers into their own algorithm and introduces a recommended resolution for views.

@cabanier
Copy link
Member Author

Closes #153

<dd> Return |array| and abort these steps.
<dt> Otherwise
<dd> For each |view| in the |session|'s [=list of views=]:
1. Let |width| be the width of |view|'s [=recommended WebGL texture resolution=] multiplied by |scaleFactor|.
Copy link
Member

Choose a reason for hiding this comment

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

Width and height are already computed outside the switch statement above with the same algorithm, so this is redundant. I think the width and height here should be different, though, to account for the fact that we're packing multiple views into a single layer. Given that we probably want to allow for UA/platform choice in how those are packed, though, I'm not sure exactly what this should look like.

Copy link
Member Author

Choose a reason for hiding this comment

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

The width and height can be different if we're allocating a texture per view since we want to allow views with different dimensions.
Maybe I should rename these variables?

<dd> Return |array| and abort these steps.
<dt> Otherwise
<dd> For each |view| in the |session|'s [=list of views=]:
1. Let |width| be the width of |view|'s [=recommended WebGL texture resolution=] multiplied by |scaleFactor|.
Copy link
Member

Choose a reason for hiding this comment

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

Same concern as width/height computation as above.

Copy link
Contributor

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

deferring to brandon for this one

@cabanier cabanier requested a review from toji June 11, 2020 15:23
1. Let |glViewport| be the [=WebGL viewport=] from the [=list of viewports=] associated with |view|.
1. let |texture| be a [=new=] instance of {{WebGLTexture}} in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context|, |init|'s {{XRLayerInit/alpha}} and |glViewport|'s width and height.
1. Append |texture| to |array|.
<dd> Initialize |array| with |numViews| [=new=] instances of {{WebGLTexture}} in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context| and |init|'s {{XRProjectionLayerInit/alpha}}, {{XRLayerInit/viewPixelWidth}} and {{XRLayerInit/viewPixelHeight}} values.

Choose a reason for hiding this comment

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

This doesn't support different texture sizes for different views. Should it?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the algorithm for non-projection layers.
The size for the layer is given during the initialization and is the same for each view.

Choose a reason for hiding this comment

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

Hmm, so for a device with a high-resolution HMD and a low-resolution camera, we're going to use the same texture size for all of them?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@cabanier cabanier requested a review from asajeffrey June 11, 2020 21:55
@cabanier
Copy link
Member Author

Closes #162

@AdaRoseCannon
Copy link
Member

You may be interested, there is a bot command called "/fixes" so you can do "/fixes #162" and it adds a comment in that issue and adds a label that it's about to be fixed by a pending PR.

@cabanier
Copy link
Member Author

@toji @Manishearth this PR is getting a bit big. Can you review/approve it so I can update it for the observer view (if needed)

Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! I think if there's any additional concerns that come up they can comfortably be handled in a follow-up PR.

@cabanier cabanier merged commit 6e49e4c into immersive-web:master Jun 15, 2020
@cabanier cabanier deleted the projectionlayerfixes_take2 branch June 15, 2020 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit scaleFactor Layers on devices with views of different resolutions Projection layer helperInit viewPixelWidth and Height

5 participants