-
Notifications
You must be signed in to change notification settings - Fork 20
Fix for allocating textures #160
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
Fix for allocating textures #160
Conversation
Merge with main repo
|
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|. |
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.
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.
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.
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|. |
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.
Same concern as width/height computation as above.
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.
deferring to brandon for this one
| 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. |
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.
This doesn't support different texture sizes for different views. Should it?
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.
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.
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.
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?
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
|
Closes #162 |
|
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. |
|
@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) |
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.
LGTM, thanks! I think if there's any additional concerns that come up they can comfortably be handled in a follow-up PR.
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.