MCPcopy Index your code
hub / github.com/audulus/vger-rs

github.com/audulus/vger-rs @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
137 symbols 453 edges 12 files 28 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

vger-rs

build status dependency status

vger is a vector graphics renderer which renders a limited set of primitives, but does so almost entirely on the GPU. Port of VGER to Rust. Used in rui.

Status

  • ✅ Quadratic bezier strokes
  • ✅ Round Rectangles
  • ✅ Circles
  • ✅ Line segments (need square ends for Audulus)
  • ✅ Arcs
  • ✅ Text (Audulus only uses one font, but could add support for more if anyone is interested)
  • ✅ Multi-line text
  • ✅ Path Fills.
  • ✅ Scissoring
  • ❌ Images

Why?

I was previously using nanovg for Audulus, which was consuming too much CPU for the immediate-mode UI. nanovg is certainly more full featured, but for Audulus, vger maintains 120fps while nanovg falls to 30fps on my 120Hz iPad because of CPU-side path tessellation, and other overhead. vger renders analytically without tessellation, leaning heavily on the fragment shader.

How it works

vger draws one or more quads for each primitive and computes the actual primitive shape in the fragment function with an SDF. For path fills, vger splits paths into horizontal slabs (see path.rs) to reduce the number of tests in the fragment function.

The bezier path fill case is somewhat original. To avoid having to solve quadratic equations (which has numerical issues), the fragment function uses a sort-of reverse Loop-Blinn. To determine if a point is inside or outside, vger tests against the lines formed between the endpoints of each bezier curve, flipping inside/outside for each intersection with a +x ray from the point. Then vger tests the point against the area between the bezier segment and the line, flipping inside/outside again if inside. This avoids the pre-computation of Loop-Blinn, and the AA issues of Kokojima.

References

Text Rendering Hates You

Adventures in Text Rendering

Vector Graphics on GPU

GPU UIs at 120 FPS

Core symbols most depended-on inside this repo

push
called by 23
src/gpu_vec.rs
begin
called by 21
src/lib.rs
render_test
called by 21
tests/common.rs
len
called by 14
src/gpu_vec.rs
linear_gradient
called by 11
src/lib.rs
render
called by 9
src/lib.rs
add_xform
called by 9
src/lib.rs
add_scissor
called by 9
src/lib.rs

Shape

Method 78
Function 36
Class 22
Enum 1

Languages

Rust100%

Modules by API surface

src/lib.rs42 symbols
tests/tests.rs24 symbols
src/path.rs10 symbols
src/gpu_vec.rs10 symbols
src/atlas.rs10 symbols
src/color.rs9 symbols
src/glyphs.rs8 symbols
tests/common.rs6 symbols
src/scene.rs6 symbols
src/paint.rs6 symbols
src/prim.rs3 symbols
src/defs.rs3 symbols

For agents

$ claude mcp add vger-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact