Skip to main content

Crate frus_gpu

Crate frus_gpu 

Source
Expand description

frus-gpu — the GPU context and the 2D rendering engine.

This crate depends on no windowing library: it is handed a wgpu::SurfaceTarget by the platform layer — frus-shell, say — and takes care of everything else: device, queue, pipeline, presentation.

What is to be drawn is described in a Scene — coloured Rects and the rest — which is then handed to Renderer::render.

Re-exports§

pub use wgpu;

Structs§

Color
An RGBA colour. Components lie in [0.0, 1.0].
OffscreenFrame
A frame rendered offscreen: sRGB RGBA bytes, row by row.
Rect
An axis-aligned rectangle, in logical pixels.
RenderTimings
Where a frame’s rendering spent its time, in milliseconds. See Renderer::last_timings.
Renderer
Holds the GPU state bound to a surface and presents the frames.
Scene
A 2D scene: the declarative description of what to draw.
StartupTimes
What making the renderer took, phase by phase (milestone 683, #211): a part of an application’s time to its first frame. See Renderer::startup_times.

Enums§

RenderOutcome
What happened when Renderer::render tried to present a frame.

Functions§

backdrop
The window’s background where nothing is drawn — the clear colour, as a scene colour — for a see-through renderer, whose frames start transparent and whose owner paints it where the window is not meant to be seen through (milestone 643).
draw_calls
How many draw calls a scene’s rectangles, images and paths will cost.
render_offscreen
Renders scene into a width×height texture cleared to clear, then reads the pixels back. None when no GPU adapter is available — a machine with neither GPU nor software rasteriser — in which case test callers skip themselves.
set_pipeline_cache_dir
Keeps the renderer’s compiled pipelines in dir between launches, where the device can: the next start reads them instead of compiling them again (Vulkan; nothing elsewhere).