From 2c1e29780da41bba13ac84ad01472d550e6d02e8 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 14:21:39 +0100 Subject: Draw text from an atlas the CPU fills, composed by the GPU Each size's symbols are drawn on the CPU into one 8-bit atlas, every pixel the exact area its curves cover, and text is a quad per glyph reading it. A 1080p page of 11,382 glyphs composes in 1.07 ms at 16 px (it took 525 ms computing coverage per fragment), and the composed pixels are the CPU raster's exactly (worst difference 0 for DejaVu's ASCII, 1 for Noto's 11,172 Hangul syllables). Computing coverage on the GPU lost on both counts: a compute pass filling the atlas took 5-13x longer than one Cortex-A76 core (35 against 2.7 ms at 16 px), and its faster sorting-network form computed whole rows wrongly under this Mesa V3D. Coverage now has one implementation, in C, and the shaders only compose. vega_symbol_raster takes a row stride to draw into the atlas in place. --- tests/check.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/check.py') diff --git a/tests/check.py b/tests/check.py index e49718a..3669fdb 100644 --- a/tests/check.py +++ b/tests/check.py @@ -33,8 +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, and (when there is an OpenGL ES 3.1 device) the - GPU draws them as the CPU reference does. + FreeType's own coverage, and (when there is an OpenGL ES 3.1 device) text + the GPU composes from an atlas is what the CPU reference draws. """ import argparse import json @@ -985,12 +985,13 @@ 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). + # Text composed by the GPU from the atlas is what vega_symbol_raster + # draws at the same pen positions (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 + assert size['symbols'] == 95 and size['worst'] <= 1 and size['page_glyphs'] > 1000, size report['gpu_sizes'] = len(drawn.stdout.splitlines()) - 1 else: assert 'EGL' in drawn.stderr or 'OpenGL' in drawn.stderr, drawn.stderr -- cgit v1.2.3