Skip to main content

Crate ravenrs_render

Crate ravenrs_render 

Source
Expand description

The RavenRS render engine.

Renderer turns a ravenrs_core::Scene into one wgpu render pass:

  • Quads (rounded rectangles, borders, linear gradients, soft shadows) are instanced and shaded with a signed-distance function (shaders/quad.wgsl), so edges are anti-aliased analytically at any scale factor.
  • Images are textures with a full mip chain, cached by image id, drawn with the same rounded-corner SDF mask as quads (shaders/image.wgsl).
  • Text is rasterized once per glyph/size/subpixel offset with swash into an R8 atlas and drawn as textured quads (shaders/glyph.wgsl).

Consecutive primitives of the same kind are batched; painter’s order is kept. Instance buffers are reused and only grow. Nothing is read back from the GPU.

The crate does not own windows or surfaces: platform crates create the device and call Renderer::render with the frame’s texture view.

Re-exports§

pub use wgpu;

Structs§

GpuContext
A device and queue ready for rendering.
RenderStats
Counters for profiling and tests.
Renderer
Draws Scenes with wgpu. Create one per device; it is reused every frame.

Enums§

GpuError
Failure to set up the GPU for rendering.

Functions§

gpu_report
Describes the adapter in use and the alternatives. permissive is an instance that also accepts non-conformant drivers, since instance never shows those.
preferred_surface_format
Picks the surface format. Non-sRGB formats are preferred so blending happens in sRGB space, matching browsers and design tools; *Srgb formats still work because the shaders linearize colors when told to.
surface_report
Describes format and present_mode on a surface with these capabilities.