pixels is a Rust library for a GPU-backed 2D pixel buffer with fixed resolution, aimed at simple games, emulators, and software renderers. You supply windowing and input; it handles scaling and optional shaders via wgpu.
Overview
pixels exposes a Pixels type that holds an explicit-width, height pixel buffer rendered on the GPU through wgpu, which the crate re-exports. It fits rapid prototyping of 2D games, pixel animations, emulators, and software renderers where you already manage a window, event loop, and input through frameworks such as winit.
Hardware-accelerated scaling can snap to perfect pixel boundaries, and you can attach custom GPU shaders for effects such as CRT simulation. A default ScalingRenderer scales the framebuffer to the window. Environment variables documented alongside wgpu examples let you pick graphics backend, adapter name, or low versus high power GPU preference.
The library sits between a minimal framebuffer crate and a full game engine: it does not own GUI or input, but adds GPU presentation and shader hooks compared with software-only buffers. Examples in the project cover minimal winit integration, Dear ImGui, egui, WebGL2, and software raster bridges such as tiny-skia or raqote.
Compared with minifb, pixels keeps your choice of windowing and uses GPU acceleration broadly rather than software rasterization alone. DirectX 11, WebGL2, and WebGPU paths are noted as evolving in project documentation.
Key features
- GPU-backed pixel buffer
- wgpu graphics pipeline
- Custom shader effects
- Perfect-pixel scaling mode
- ScalingRenderer for windows
- raw-window-handle compatibility
- GPU adapter selection env vars
- Non-square pixel aspect (WIP)
Use cases
- 2D game and emulator prototypes
- Pixel-perfect scaled framebuffer
- Software renderer with GPU output
- Shader post-processing on pixels