SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
222 stars 18 forks source link

Add bindgroup cache in wgpu #130

Open Uriopass opened 6 months ago

Uriopass commented 6 months ago

avoid recreating them every frame

closes #97

LPGhatguy commented 6 months ago

I've been meaning to test this PR properly since it's more involved than the widgets you've PR'd. I'll let you know as soon as I can and I'll have a good review for you!

Uriopass commented 5 months ago

Updated to main and clear the cache every frame to avoid dealing with invalidation (shouldn't be that hard though). Still huge wins: On my (now quite big) yakui scene with a bunch of text and textures tracy says update_buffers goes from 0.5ms to 0.1ms

Yakui's overhead is still 0.8ms (down from 1.2ms) image

I wonder if the previous frame's paint data could be reused somehow but that's a whole new thing.

There's probably a bit of overhead from tracy/profiling too since every paint call is tracked

Uriopass commented 5 months ago

Also of interest: 95% of the wins come from the default texture and the glyph cache texture bindgroups.

I tried caching just them for a simpler solution (and easier to review). However the glyph cache is handled in yakui-widgets and therefore is not easily accessible from yakui-wgpu.