#Deno WGPU context access in embedded rust runtime

51 messages · Page 1 of 1 (latest)

wanton torrent
#

Looking to bind the WGPU context to a windowing library like winit . I've seen modules that implement similar solutions using FFI but my architecture spec requires rust to orchestrate the application lifecycle. Would appreciate any advice to point me in the right direction. Anyone have experience working with embedded deno in a similar fashion?

regal loom
#

just to get a clearer idea: you are trying to make a windowing system, right (ie electron, but with webgpu)? or is this something else?

regal loom
#

this is currently not possible

#

its something thats being investigated as there is interest from me and someone else on the team for a windowing solution (as per #dev-desktop)

wanton torrent
#

Ah, that's understandable. I've been following the topic on windowing in deno. Is there a specific hurdle I should be aware of that's making the windowing solution non-trivial?
My plan B is to create extension ops bindings to expose rust open gl rendering functionality as a global api that conforms to the WebGL spec.

Anything worth considering before I get ahead of myself?

regal loom
#

the main hurdle is that deno_runtime cannot be extended, which is fairly crucial, and is something that has been worked on for quite a while and unsure how long thats going to take until thats possible.

#

regarind your plan B. that could work, though you'd still encounter the deno_runtime problem (except if you use deno_core, but thats kinda... eh)

wanton torrent
regal loom
#

deno_core means that it wouldnt have any of the other APIs, and would have to pull in all other exts to give an experience similar to CLI (but not all APIs are available as exts, some APIs are only available in deno_runtime)

wanton torrent
#

ah, that's something I should look into. With that said, my end goal is to implement react-three-fibre and Three.JS rendering for windowed applications. Hopefully that minimises dependency budget from the deno std lib.

regal loom
#

oh interesting, never heard of react-three-fibre. there actually is a planned project by someone in the community to do use webgpu (with obviously some higher-level abstraction) via jsx

novel vine
#

@forest edge has some really good deno webgl implementation stuff

wanton torrent
# regal loom oh interesting, never heard of `react-three-fibre`. there actually is a planned ...

react-three-fibre is the basis of amazing modules by the PMNDRS team (developers of zustand, jotai, react-spring) that extend Three.js with crazy functionality and a DSL that makes graphics rendering feel natural composable. Highly recommend taking a look at their work.

It's what https://spline.design/ uses. But their desktop app is built with electron and 'someone needs to make them feel bad that'

Create web-based 3D browser experiences

wanton torrent
novel vine
#

it's a pain to write

regal loom
#

and using webgl in the emerging age of webgpu sounds painful

novel vine
#

yeah it is

#

but writing bindings is more painful

novel vine
#

in pure js that readers in the terminal

#

I'm going insane I need sleep

wanton torrent
# regal loom and using webgl in the emerging age of webgpu sounds painful

The advantage of using react-three-fibre and only patching the react reconciliation root means components written to render on the desktop can be used for react-native and the web by default.

With the state of webgpu support across browsers, I wouldn't see myself taking advantage of webgpu for the foreseeable future.

It's definitely going to hurt... a lot but if the crab gods are on my side - I think it would be a worthwhile step towards making graphics rendering on the desktop more approachable for frontend developers

regal loom
#

With the state of webgpu support across browsers, I wouldn't see myself taking advantage of webgpu for the foreseeable future.
I agree, which i find quite sad

wanton torrent
#

I don't know though, if you'd advise against the binding approach I can table the idea until deno_runtime is more open

regal loom
#

i think its a more "you do you" scenario; the main downside with deno_core is that you have to implement the fs APIs yourself, which is something that i'd say is quite important when doing graphic rendering, as you often want to use some sort of texture

wanton torrent
wanton torrent
regal loom
#

well, if we are lucky, extending deno_runtime should be possible in the coming days/weeks

novel vine
#

remember when wgsl completely changed its syntax a few times

regal loom
#

what do you mean?

novel vine
#

like wgsl tends to change its syntax alot

#

importing shaders in deno would be cool for debugging

regal loom
#

How is that related to extending deno_runtime?

wanton torrent
remote minnow
novel vine
#

what did you mean

novel vine
wanton torrent
icy stag
#

Feel free to ask me any question, the only issues I had with Astrodon is that there are a few features from Deno that are implemented in the CLI so embedding deno_runtime will not give you the entire power, some of them can be reimplemented but it's still not the same thing

novel vine
icy stag
novel vine
#

well that's true

forest edge
#

so you want to do windowing via deno’s webgpu?

#

is the goal to embed deno?