As the popularity of the library minifb shows, it is useful to put a 2D buffer/image on a window in a platform-independent way. Minifb's approach to doing window management itself, however, is problematic code duplication. We already have very high quality libraries for this in the Rust ecosystem (such as winit), and minifb's implementation of window management is not ideal. For example, it occasionally segfaults on some platforms and is missing key features such as the ability to set a window icon. While it would be possible to add these features to minifb, it makes more sense to instead use the standard window handling systems.
As such, A little bit ago I asked about a way to use standard window-handling facilities in Rust to write to a window without relying on the hardware-acceleration stack. Since then, I've come to the conclusion that no such library exists so I decided to create one.
I have it working with Xlib and win32 now, the systems used under X11/Linux and on Windows respectively, but I'd like some help getting more platforms added. Specifically, I'm looking for anyone who wants to contribute an implementation for Mac OS as I do not (yet) have access to a Mac OS computer to test on. Other platforms are welcome in PRs, however. If you know the native APIs of your platform reasonably well, I expect that doing so will take an hour or two. If you do not know them well, it might take more like 4-8 hours, judging by how long it took me to make the win32 and Xlib implementations. Here is the win32 implementation, to give an idea of what is involved. To add a new platform, one must simply implement a trait and then add it to the match statement in lib.rs. If you find that you need to chagne the public API or this internal trait to do your platform correctly, then please feel free to do so as this isn't on crates.io yet.
Feel free to let me know if there's some way that I can make these contributions easier or if I can help somehow!
There was a previous initiative under the rust-windowing banner to this end, winit-blit, but that only ever got a Windows backend. I've been intending to work on this for quite some time, but I never really got much further than getting an X11 backend tentatively working in my own copy of the library. swsurface also exists, but it's unmaintained and depends directly on an older version of winit. swsurface does, however, have support for Wayland, X11, Windows, (maybe) iOS, and macOS, so it could be interesting to fork it or use it as a reference.
PS: I would not have seen this if you didn't post it to Reddit. I'm not really active on this site.
On Windows, DirectX gives you a CPU-based adapter that can be used. On Linux, Mesa will offer multiple CPU-based adapters, at least one for Vulkan and one for OpenGL. macOS and web do not offer CPU-based adapters, and I don't know about other platforms supported by winit.
(Yes, this still relies on a GPU stack, but using real GPU hardware is unnecessary.)