You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Communicate projection layer texture size outside the frame loop #224
Most layer types accept a user-specified texture size, but projection layers only accept a scalar and the final size is determined by the UA/hardware. Currently this size is only reported in the XRSubImage, which can only be accessed inside the frame loop.
The problem is that currently if the application wants to manage their own depth buffer (which will be necessary for WebGL 1 apps that aren't using the WEBGL_depth_texture extension or that don't want their depth buffer to be used by the compositor), or any other supplemental buffers, it would have to wait until the first frame after layer creation to determine the required dimensions for those buffers. Ideally that allocation could happen outside of the frame loop, probably immediately after the layer creation.
I can think of one of two ways to approach this:
We report the texture dimensions on the XRProjectionLayer directly. (This would likely be ONLY for the projection layer, since other layer types may be used with things like XRMediaBinding and the sizes would be moot.) In order for applications to allocate a matching buffer we'd want to report both the size and layer count for array textures.
If we want this to work a bit more generally and sidestep complications with XRMediaBinding we could also make it a query on XRWebGLBinding, similar to getSubImage() but without the frame requirements:
partial interfaceXRWebGLBinding {
XRImageDimensions getImageDimensions(XRCompositionLayer layer);
};
interfaceXRImageDimensions {
readonly attribute unsignedlong textureWidth;
readonly attribute unsignedlong textureHeight;
readonly attribute unsignedlong textureLayers;
};
// Probably want to use that in XRWebGLSubImage too?
The textureLayers name makes it sound like an array of XRLayers to me.
Good point. @toji , was this attribute meant to indicate the number of textures in the texture array, or the number of textures in the internal array or both?
textureArrayLayers would probably match the WebGL 2 verbiage best, but in order to avoid the namespace conflict with XRLayer I think textureArrayLength is fine.
Activity
cabanier commentedon Oct 29, 2020
I prefer option 1. Projection layers will always have an pixel size so there's no need to have a helper method.
nkronlage commentedon Jan 15, 2021
The
textureLayersname makes it sound like an array of XRLayers to me.How about calling it
textureLayerLengthortextureLayerSize?cabanier commentedon Jan 15, 2021
Good point. @toji , was this attribute meant to indicate the number of textures in the texture array, or the number of textures in the internal array or both?
toji commentedon Jan 16, 2021
My intent was to indicate the number of textures in the texture array. (The texture "depth")
cabanier commentedon Jan 16, 2021
Would a better name be
textureArrayLength?toji commentedon Jan 17, 2021
textureArrayLayerswould probably match the WebGL 2 verbiage best, but in order to avoid the namespace conflict withXRLayerI thinktextureArrayLengthis fine.