#WGPU and webview: buffer ordering

16 messages · Page 1 of 1 (latest)

versed crag
#

Hey there 👋

I'm trying to mix a webview and a wgpu buffer together in the same window.
I've found several Github repository showcasing how to do it, like: https://github.com/clearlysid/tauri-wgpu-cam/blob/main/src-tauri/src/main.rs

The common thing with these examples is that the wgpu frame is under the webview.
How to do it, the other way around: make the wgpu overlay the webview ?

GitHub

stole fabian's work to build on top of. Contribute to clearlysid/tauri-wgpu-cam development by creating an account on GitHub.

hollow grail
#

We just send each frame over a websocket

versed crag
#

Not sure it match my case
I want to do that to allow steam overlay to hook into it.

The main goal is to have a wgpu rending (even transparent) on top of the webview so the steam overlay render in place of it (currently render under the webview)
A canvas would allow to render the content, but I'm not sure that include the steam overlay
Also, I'm not sure that canvas can include transaprent content

#

I will try that anyway, thanks

hollow grail
#

Canvas can be transparent, putImageData expects an RGBA image

versed crag
#

Yeah, it's what I'm reading currently
Let's pretend the rendering part works how I want. What about the interactivity part ?
Canvas will not be aware of buttons clicks on the steam overlay since I'm just sending "a screeshot" of it ?

hollow grail
#

Ah for the steam overlay I'm not sure, seems like they've got their own way of doing things, though i don't think it just being a 'screenshot' should matter since the overlay would otherwise just be drawing to the gpu which also isn't aware of button clicks, they'd be handling that somewhere else

versed crag
hollow grail
#

woooah cool

#

i'd be super curious to see it implemented as frames on a canvas

versed crag
#

I'm struggling to draw frames on the canvas — it's too slow and doesn't support mouse events properly.

I also tried stacking multiple windows on top of each other, but that either doesn't work or requires hacks. The overlay window needs to pass through events unless the Steam overlay is active.

#

Anyone got a better idea or another solution ?

steady cargo
versed crag
#

Do you think it's a viable solution ?

  • stacking two windows on top of each other
  • make the overlay window topmost, transparent, frameless
  • when overlay is present disable passthrough, otherwise enable passthrough
steady cargo
#

ya two windows is defintly the easiest option. though it may be annoying to make sure that its alligned properly. on windows i think you may be able to create a child(window that cant go outside of the parent) window then max size that and allow passthrough