Skip to content
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

Make use of depth extension in openxr backend #92

Open
jdm opened this issue Nov 15, 2019 · 13 comments
Open

Make use of depth extension in openxr backend #92

jdm opened this issue Nov 15, 2019 · 13 comments
Labels

Comments

@jdm
Copy link
Member

jdm commented Nov 15, 2019

Right now we only pass gl::COLOR_BUFFER as the mask argument for blit_framebuffer to copy the texture data from the webgl texture to the d3d texture. Would including gl::DEPTH_BUFFER as well enable better image stability?

@Manishearth
Copy link
Member

Potentially, if we enable the depth extension.

@jdm
Copy link
Member Author

jdm commented Dec 9, 2019

@paulrouget Could you try building https://github.com/jdm/servo/tree/depthkhr and see if there's an noticeable improvement with respect to image stability or jitteriness on any of the more complex demos? This is my attempt to implement https://github.com/microsoft/OpenXR-SDK-VisualStudio/#submit-depth-buffer-for-projection-layers, and it's made of the changes to https://github.com/jdm/webxr/tree/depthkhr and https://github.com/servo/openxrs/tree/depthkhr.

@paulrouget

This comment has been minimized.

@paulrouget

This comment has been minimized.

@paulrouget
Copy link
Contributor

I can't really see any difference. Do you have a demo in mind that has some significant jittering?

By image stability, you are talking about the issue with the content lagging a bit behind?

@jdm
Copy link
Member Author

jdm commented Dec 10, 2019

@paulrouget Oops, I forgot to enable the appropriate extension. See if there's any difference if you add khr_composition_layer_depth: true to this code.

@jdm
Copy link
Member Author

jdm commented Dec 10, 2019

Ok, with the extension enabled the emulator is no longer drawing the background of the babylon colour picker demo in immersive mode. I wonder if some of the depth/z values at jdm@61096f7#diff-f3cfd7c22eb8b9fb4aeefdabdb68f7e4R621-R625 is causing it to be ignored?

@jdm
Copy link
Member Author

jdm commented Dec 10, 2019

We're going to need to do something a bit different here. We will need to:

  • obtain the depth attachment from the webgl framebuffer
  • create a separate d3d texture with an appropriate depth format
  • blit the depth buffer between them
  • attach the d3d texture to the composition project layer chain

@paulrouget
Copy link
Contributor

paulrouget commented Dec 11, 2019

For the background issue, be aware that that new version of the color picker demo uses AR mode now.

@paulrouget
Copy link
Contributor

See if there's any difference if you add khr_composition_layer_depth: true

It's a lot more choppy. And it feels like there's tearing (top part moving ahead of the bottom part).

@jdm jdm changed the title blit_framebuffer for openxr backend does not blit the depth buffer Make use of depth extension in openxr backend Apr 30, 2020
@jdm
Copy link
Member Author

jdm commented Apr 30, 2020

#92 (comment) seems like it was made more challenging by the changes to wrap the openxr swapchain in the EGL surface. There is a separate depth swapchain created in the sample code.

@jdm
Copy link
Member Author

jdm commented Apr 30, 2020

So eglCreatePbufferFromClientBuffer does allocate a depth buffer if requested, so the challenge is extracting that data and getting it into the d3d swapchain. Some potential options include:

@jdm
Copy link
Member Author

jdm commented Apr 30, 2020

It would be nice if this copying could occur as part of the render_animation_frame method in the openxr backend, but because of the limitation that the EGL surface wrapping the d3d texture (and therefore its associated depth buffer) is only usable from the webgl thread it requires some more hacks instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants