The case of Rust's graphics API

I have been using glium in a small Rusty project for quite a while. Nowadays glium seems somewhat dead (I actually would love to contribute some changes to the API, but doing that alone just feels wrong). There are several routes I consider, but can't quite decide what is best

  • Help develop glium/improve it on a fork, since OpenGL is still an interesting API
  • Use raw OpenGL. (Might be a bad choice, considering how many OpenGL impls glium supports. Plus raw OpenGL is, welll, unsafe)
  • Move to some kind of Vulkan wrapper. (Although from what I see all the wrappers are quite young and buggy. Also a lot of development time will be wasted on porting/learning Vulkan)
  • Use raw Vulkan (This one will definitely bring in lots of unreliable code. And requires a lot of research too)

So, I would love to know! Is it worth trying to bring glium back to life? Is it worth trying to control an even more low-level api despite the fact I really don't need such high level of control?

wgpu could be a good option. wgpu is a rust implementation of the WebGPU api that can target Vulkan, DirectX, Metal and OpenGL. (I am not sure about the state of the OpenGL support.)

2 Likes

Hm.. It seems very different from OpenGL... And it looks very young... Is it reliable enough so I won't have to deal with implementation errors?

wgpu is meant to be used by browsers as WebGPU implementation to be exported to arbitrary sites. This puts a high bar on the reliability requirement for security reasons. I haven't ever used it, so I don't know if it is reliable enough from a first hand perspective. I do know that Bevy uses it and Veloren will switch to it soon (Switch from deprecated gfx to wgpu (#298) · Issues · Veloren / veloren · GitLab) though.

Hmmm... I have two more questions then which appeared after I checked their repository

  1. Since their OpenGL support is still under construction what windowing API is it better to migrate to? (Because glutin doesn't seem like an option anymore)
  2. There are some alarming bugs in mentioned in their repo (there's at least one heap corruption bug and a segfaulting bug). Is that something I should worry about?

Winit is the de-facto standard for windinging right AFAICT.

Oh, okay. It won't be much of problem at least with the windowing, since glutin is built on top of winit...

I second checking out wgpu, it's been a fairly positive experience so far. The Learn Wgpu site has been very helpful.