-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[WebGL] Allow creating a texture from an external web_sys::WebGlFramebuffer
and writing to it
#2609
Conversation
This is the same situation as we have with regular OpenGL, but the PR's solution goes a very different route. Would it be possible to follow the same route for WebXR? |
It's possible, but IMO I think that'd feel a bit hacky. You need to be able to change which framebuffer the surface presents to every frame. I'll experiment with that approach |
Oh, so this would work for the 'ImmersiveVR' mode but not the 'ImmersiveAR' one, where the framebuffer that you're give contains the image from the camera and you draw on top of that without clearing. We'd have to allow alpha blending when presenting to the surface. I think sticking with this PR as-is is the way to go. |
|
Codecov Report
@@ Coverage Diff @@
## master #2609 +/- ##
=======================================
Coverage 64.50% 64.51%
=======================================
Files 86 86
Lines 42710 42729 +19
=======================================
+ Hits 27551 27567 +16
- Misses 15159 15162 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I'm still using this branch and just squashed all the commits together in order to clean things up. It'd be great to get at least some part of this merged soon - even if it's just exposing some of the internals with |
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.
We will really need to think about unifiying the raw interfaces betwen backends. In the mean time, this looks fine.
Checks are failing. |
Should be good to go now after the tests run |
Description
The WebXR DeviceAPI works a little different from HTML canvases as it gives you an opaque
WebGlFramebuffer
that you are intended to bind and write to: https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/framebufferTo be able to do this in wgpu we need to:
wgpu::Texture
from theWebGlFramebuffer
.which is what this PR does.
It currently depends on grovesNL/glow#218 and should not be merged until that is.Now depends on the glow branch that wgpu is using
I've got a demo up at https://expenses.github.io/wgpu-vr/ (if you don't have a VR device then you can use the google cardboard stuff in chrome on android to try it out). Source: https://github.com/expenses/kiss-engine/blob/d877a28c0bf86e3b65fb438446647e2998820be4/ludum-dare/src/main.rsOutdated
Things to check
There are a couple of things in this PR that I'm unsure about.