diff options
| author | eunhhu <[email protected]> | 2026-09-27 13:02:41 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 13:02:41 +0100 |
| commit | ba76d3810713bb67569114e9458416df0f78687a (patch) | |
| tree | 357c5285b72626ff7f77d0339ccc0e6d2cc66b7d /tests | |
| parent | 2acf27f665f8a926d244efa58f6ef2c92d65e8c4 (diff) | |
| download | vega-ba76d3810713bb67569114e9458416df0f78687a.tar.gz vega-ba76d3810713bb67569114e9458416df0f78687a.zip | |
Draw symbols on the GPU from the point table as it is
OpenGL ES 3.1: the file's points go up as one storage buffer, each symbol
gets 16 row bands listing the curves they reach (cut by integer division of
doubled coordinates, so CPU and shader agree), and every pixel of a symbol's
box sums the exact area of its bands' curves, as vega_coverage does.
vega-symbols gpu draws every symbol against the CPU reference and times
1080p pages.
On the Pi 5's V3D it matches the reference (mean 0.001-0.1 levels, worst
4) but takes 142-757 ms a page, 83% of it in the area function. A sorting
network in registers made it 2.3x faster yet computes wrong rows in the
fragment stage with this driver, while the same code is exact in a compute
shader; so drawing each glyph size once into an atlas by compute comes next.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/check.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/check.py b/tests/check.py index 288bd37..e49718a 100644 --- a/tests/check.py +++ b/tests/check.py @@ -33,7 +33,8 @@ outlines of the right area, an icon asking for what symbols cannot hold is refused by name, damaged files are refused whole, and (when DejaVu Sans is there) glyphs keep their exact area and draw within a few levels of - FreeType's own coverage. + FreeType's own coverage, and (when there is an OpenGL ES 3.1 device) the + GPU draws them as the CPU reference does. """ import argparse import json @@ -984,6 +985,15 @@ def symbols(tool, work): size = json.loads(line) assert size['glyphs'] == 94 and size['mean_difference'] < 3 and size['within_16'] > 0.99, size report['glyph_sizes'] = len(lines) - 1 + # The GPU draws what vega_coverage computes (when there is an OpenGL ES 3.1 device). + drawn = run(tool, 'gpu', glyphs, '--sizes', '12,32', '--frames', 1) + if drawn.returncode == 0: + for line in drawn.stdout.splitlines()[1:]: + size = json.loads(line) + assert size['symbols'] == 95 and size['mean_difference'] < 0.5 and size['worst'] <= 8, size + report['gpu_sizes'] = len(drawn.stdout.splitlines()) - 1 + else: + assert 'EGL' in drawn.stderr or 'OpenGL' in drawn.stderr, drawn.stderr try: from fontTools.pens.areaPen import AreaPen from fontTools.ttLib import TTFont |
