Skip to main content

Crate kova_native_render

Crate kova_native_render 

Source
Expand description

GPU renderer for Kova Native.

The renderer is built around a single “uber” pipeline: every primitive — rounded rectangles with independent corner radii, borders, linear gradients, drop shadows, inset shadows, glyphs, images, frosted-glass backdrops — is an instance of a unit quad evaluated analytically in the fragment shader. Primitives therefore batch regardless of type, and a typical frame with thousands of elements is one draw call. Effects that need the pixels drawn so far (backdrop blur) split the frame into segments.

Glyphs and images live in growable texture-array atlases, so atlas growth never breaks batches either.

Scene::push_layer/Scene::pop_layer render a group of primitives offscreen and composite it through a LayerMask (SVG/image coverage or an alpha gradient). register_shader adds custom WGSL fragment shaders drawn with Scene::push_custom.

Re-exports§

pub use shaders::ShaderId;
pub use shaders::register_shader;
pub use wgpu;

Modules§

shaders
Registration of custom WGSL fragment shaders.

Structs§

Atlas
CPU side of the atlases: allocation, key lookup and pending uploads.
AtlasImage
Pixel data to insert into the atlas.
AtlasTile
Location of an image inside the atlas.
ContentMask
Clip region (device pixels), optionally with rounded corners.
DrawState
Transform, clip and group opacity applied to a primitive.
GpuContext
The GPU instance, adapter, device and queue shared by all windows.
Quad
A rounded rectangle with fill and border.
Renderer
Renders Scenes. One renderer (and one set of atlases) is shared by all windows of an application.
Scene
An ordered list of primitives in painter’s order.
SceneStats
Statistics about a built scene.
Shadow
A box shadow (CSS semantics: blur is the blur radius, spread grows the shadow shape).
SurfaceOptions
Presentation configuration of a window surface.
WindowSurface
A window’s swapchain.

Enums§

AtlasKey
What is stored in the atlas.
AtlasKind
Effect
Effects that split the scene into multiple render passes.
LayerMask
How a layer opened with Scene::push_layer is composited onto what lies below it.

Constants§

ATLAS_SIZE
Edge length of every atlas layer, in texels.