3 unstable releases
| 0.1.0 | Dec 16, 2025 |
|---|---|
| 0.0.2 | Mar 6, 2024 |
| 0.0.1 | Mar 5, 2024 |
#216 in Graphics APIs
115KB
3K
SLoC
Pixstage
Pixstage is a tiny pixel buffer library built on top of wgpu.
It targets retro game emulators and software renderers, with two core goals:
- Retro-friendly: first-class
Indexed8 + Paletterendering (palette lookup happens on the GPU). - Fast uploads: dirty-rect tracking to avoid uploading the whole frame when only a small area changes.
Pixstage is windowing-framework-agnostic: any framework that supports raw-window-handle can be used.
Features
PixstageRgba:RGBA8pixel buffer with incremental texture updatesPixstageIndexed:Indexed8 + Palettewith GPU palette lookup (great for palette cycling)PixstageRgb565:RGB565input with incremental upload (converted to RGBA8 only for dirty regions)PixstageArgb1555:ARGB1555input with incremental upload (1-bit alpha)ScalingMode::PixelPerfectandScalingMode::FillPixstageOptions: shared configuration (backends/present_mode/scaling/clear_color)
Examples
rectangle_and_line: simple drawing usingPixstageRgbapalette_cycle: palette animation usingPixstageIndexedrgb565_checker: RGB565 input example usingPixstageRgb565argb1555_alpha: ARGB1555 (1-bit alpha) example usingPixstageArgb1555
Run:
cargo run --example rectangle_and_line
cargo run --example palette_cycle
cargo run --example rgb565_checker
cargo run --example argb1555_alpha
Minimal usage (winit)
use pixstage::{PixstageRgba, SurfaceTexture};
use winit::event_loop::EventLoop;
use winit::window::Window;
# let event_loop = EventLoop::new().unwrap();
# let window = Window::new(&event_loop).unwrap();
# let size = window.inner_size();
let surface = SurfaceTexture::new(size.width, size.height, &window)?;
let mut stage = PixstageRgba::new_async(320, 240, surface).await?;
// Write pixels
stage.set_pixel(10, 10, [255, 0, 0, 255]);
stage.render()?;
# Ok::<(), pixstage::Error>(())
Notes
- The examples use
winit, but the library itself does not depend on it.
Dependencies
~4–34MB
~451K SLoC