-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Renderer from Canvas support #309
Comments
Because That leads me to a follow up question: what are you passing to I guess there is a deeper question regarding how these kinds of cases should be handled. From the perspective of this crate, everything under the graphics umbrella is generic and unknown except for the trait that allows On the other hand, that complexity needs to exist somewhere. So far it has been the responsibility of To that end, maybe it isn't The docs for The disconnect between shadow root and the top-level window is most likely in here. |
@Zageron I'm confident this isn't a I expect it will be the former. But I have no way at the moment to create a repro that concretely shows why this is a problem. |
Hey, thanks for the extensive response. My full understanding: I think the primary "issue" is that Pixels is fully generic, as you stated. WebGPU offers three interfaces: Pixels uses The generalized solution in wgpu: let canvas: web_sys::HtmlCanvasElement = web_sys::window()
.and_then(|win| win.document())
.expect("Cannot get document")
.query_selector(&format!("canvas[data-raw-handle=\"{}\"]", handle.id))
.expect("Cannot query for canvas")
.expect("Canvas is not found")
.dyn_into()
.expect("Failed to downcast to canvas type"); means that it expects My Problem:
The Conundrum:
Solutions:
I will attempt to create an example repository today. |
Yep, that's a requirement from the I think you're missing a third "solution" in your list, and that's allowing
How would an app normally gain access to the This would be an architectural change for |
https://github.com/Zageron/pixels-shadow-dom-example |
We have some additional eyes on this issue now. Discussion has been upstreamed to rust-windowing/raw-window-handle#102. |
Thanks! I've been following all the discussions the past day, awesome development for Bevy if you didn't see it. |
I saw that PR but not the specific comment, thanks. What I noticed about the PR is that it implements practically exactly what I expect We'll see how it goes! |
I hate it, but I figured a shadow dom workaround out. Note: This doesn't work with libraries that use the Shadow DOM out of the box, but I should be able to explode the Shadow DOM for a moment under a loading screen while we construct the surface. |
Is this the same reason why pixels does not work with the latest Tao version ? |
The latest version of |
Problem:
I cannot run pixels in the shadow root.
Current create surface ends up running in to this:
https://github.com/gfx-rs/wgpu/blob/master/wgpu-hal/src/gles/web.rs#L117
Solution:
Offer an interface that allows the use of a canvas instead of requiring a canvas to be found on the window.
https://github.com/parasyte/pixels/blob/main/src/builder.rs#L259
Using either or of these interfaces would be very helpful:
https://github.com/gfx-rs/wgpu/blob/master/wgpu-hal/src/gles/web.rs#L32
https://github.com/gfx-rs/wgpu/blob/master/wgpu-hal/src/gles/web.rs#L53
The text was updated successfully, but these errors were encountered: