New library for GPU-less 2D display in winit, looking for contributors to add more platforms

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.

Here it is (see the readme for more details): (not on yet since I think that it needs more platforms before it's ready for use)

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 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 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!


@kpreid I saw that you hearted my previous post trying to find a library like this, so you might be interested in either contributing to or using this

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.

FWIW, wgpu integrates with software rasterizers (if supported by the system) and can be selected with RequestAdapterOptions::force_fallback_adapter.

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.)

BTW, if you ever publish to I'll be happy to link to it in the pixels README. You might also want to add your crate to ocboogie/rust-graphics-crates ( (this list isn't too popular going on GitHub stars alone, but they link to the major crates for graphics). And of course,


I added macOS support using Core Graphics. I thank @john01dav for help and merge.

1 Like

I've just published to ( You still want to add it to pixel's readme? I can do a PR if you want me to write the information.

1 Like

If you would prefer to write the info, I'll accept a PR! Otherwise, I'll have to write my own interpretation of your work. :slight_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.