[][src]Crate pixels

A tiny library providing a GPU-powered pixel buffer.

Pixels represents a 2D pixel buffer with an explicit image resolution, making it ideal for prototyping simple pixel-based games, animations, and emulators. The pixel buffer is rendered entirely on the GPU, allowing developers to easily incorporate special effects with shaders and a customizable pipeline.

The GPU interface is offered by wgpu, and is re-exported for your convenience. Use a windowing framework or context manager of your choice; winit is a good place to start. Any windowing framework that uses raw-window-handle will work.

Environment variables

  • PIXELS_HIGH_PERF: Switch the default adapter to high performance.
  • PIXELS_LOW_POWER: Switch the default adapter to low power.

These variables change the default adapter to request either high performance or low power. (I.e. discrete or integrated GPUs.) The value is not checked, only the existence of the variable is relevant.

The order of precedence for choosing a power preference is:

  1. Application's specific adapter request through PixelsBuilder::request_adapter_options
  2. PIXELS_HIGH_PERF
  3. PIXELS_LOW_POWER
  4. wgpu default power preference (usually low power)

Re-exports

pub use raw_window_handle;
pub use wgpu;

Structs

Pixels

Represents a 2D pixel buffer with an explicit image resolution.

PixelsBuilder

A builder to help create customized pixel buffers.

PixelsContext

Provides the internal state for custom shaders.

ScalingRenderer

The default renderer that scales your frame to the screen size.

SurfaceSize

A logical texture size for a window surface.

SurfaceTexture

A logical texture for a window surface.

Enums

Error

All the ways in which creating a pixel buffer can fail.