BillyDM / egui-baseview

A baseview backend for the egui Rust GUI library
MIT License
22 stars 17 forks source link

Add wgpu support #18

Closed murl-digital closed 2 months ago

murl-digital commented 3 months ago

I got bored and decided to spend a few hours chucking in wgpu support for anyone who wants to use it.

Some things to note:

murl-digital commented 3 months ago

i'll quickly sum up the conversation that happened in the discord here:

it does in fact work now, but on certain windows laptops it doesn't work due a bug in wgpu that was fixed upstream. i'm considering having a graceful fallback to glow if that happens, and there seems to still be some weird behaviors on someone's pc that i haven't been able to replicate

murl-digital commented 3 months ago

since this uses the git version of egui for wgpu 0.20 support, i'm going to mark this as a draft until this makes it into a proper release

murl-digital commented 2 months ago

alright, egui 0.28 is out which means this is actually mergeable now

BillyDM commented 2 months ago
  • I'm using 4x MSAA because it's what webGPU guarantees. Maybe this should be selected more intelligently?

Yeah, ideally we should intelligently fallback to the highest supported sample count, but we can do that in a future PR.

Here's how I implemented this in my RootVG crate for reference https://github.com/MeadowlarkDAW/rootvg/blob/main/src/surface.rs#L192 https://github.com/MeadowlarkDAW/rootvg/blob/main/src/surface.rs#L251

BillyDM commented 2 months ago

Awesome, thanks for your work!

If you haven't already, I would make an issue in egui to make WgpuConfiguration Send + Sync, then we can get rid of our ugly wrapper code.