Recently, I’ve been playing around with the wpgu crate in rust, I’ve always loved low level rendering and the idea of memory safety from rust while being compiled down into very fast system code with complete control over memory lifetime. Love C#, but leaving everything to the garbage collector is just clearly not using our resources to the max.
Anyways, this project that I setup is just drawing a classic triangle, seems the minimum setup you need is:
winit for windowing
pollster for async to sync quick conversion
wgpu for rasterizing the crispest triangles
Something interesting I came across is the startup time for different back-ends, wgpu allows you to choose default which goes through and does some validation with each one and chooses one, this actually takes around 2-3s in release for me every time you start up the app, which I know is not a lot but kind also… it is just one triangle. I looked into each individual back-end on its own and got the following timings for the different steps of my current pipeline:
GL:
instance: 115.6532ms
surface: 63.1µs
adapter: 225.3µs
device: 70.7764ms
VULKAN:
instance: 1.446542s
surface: 106.5µs
adapter: 22.0682ms
device: 26.9581ms
DX12:
instance: 26.1963ms
surface: 59.8µs
adapter: 935.0428ms
device: 60.9835msGL for the win?!
I will probably be using that as my back-end for initial iterative testing and building because I love a quick and responsive rerun. It’s also a classic to support so not bad to test with.
Then when fancier features are required or we can benchmark multiple triangles, direct x or vulkan can be utilized!
Tune in for the next post.