slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
15.88k stars 518 forks source link

[Feature Request] Being able to add slint into a custom wgpu renderer like egui #4499

Open ValorZard opened 4 months ago

ValorZard commented 4 months ago

For other rust UI llibraries like egui and iced, they have great integration with wgpu, making so that its relatively easy to integrate it with other projects that use wgpu like the Bevy Game Engine. (See bevy_egui and bevy_iced ) It would be neat if Sllint could do the same thing!

Inspired by this reddit comment: https://www.reddit.com/r/rust/comments/1afhcvz/slint_v140_declarative_gui_for_rust/koap3lv/

tronical commented 4 months ago

Fully agreed. This would be a nice demo. In theory it's already possible, if selecting the gles wgpu backend and combining with the femtovg renderer.

Mid term it would be nice to decouple them, render with slint into a backend specific texture, convert to an OS specific buffer handle (dmabuf, iosurface, ...) and then import into wgpu. Comes at the expense of additional passes but if the UI doesn't change too much it might be just fine.

Having API in slint to grab the output for a renderer into OS specific buffer would be great to have.

AdrianEddy commented 4 months ago

+1. Having eg. vello as a renderer would be amazing, it's getting close to a first release and I wonder how would the performance compare to current renderers. Also for me personally it's important for the UI to run on each platform's native backend, so if Slint would run on DirectX, Metal, OpenGL and Vulkan, instead of just OpenGL, that would be great (I know skia can run on DirectX and Metal, but wgpu would be better suited for my use case and it adds Vulkan)

tronical commented 4 months ago

I agree, vello would be great. I hope they will make a release to crates.io.

WilstonOreo commented 3 months ago

@tronical @AdrianEddy https://github.com/linebender/vello has released a 0.1.0 two days ago