Skip to content
项目

关于

WebGPU implementation of Eric Lengyel's Slug algorithm for resolution-independent vector text rendering on the GPU

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Slug WGSL preview

Slug Algorithm (WebGPU)

A WebGPU implementation of the Slug algorithm, originally created by Eric Lengyel.

This project ports the original HLSL shaders to WGSL and demonstrates a modern GPU-driven text rendering pipeline.

Overview

The Slug algorithm renders high-quality vector text entirely on the GPU by converting glyph outlines into a banded Bézier representation.

This repository includes:

  • WGSL shader implementations of the Slug algorithm
  • A minimal WebGPU rendering setup
  • A TypeScript-based shaping pipeline using text-shaper (a HarfBuzz alternative)
  • An example using the Inter font

Rendering Pipeline

  1. Text shaping (CPU)
    Text is shaped into positioned glyphs using text-shaper.

  2. Curve extraction (CPU)
    Glyph outlines are converted into quadratic Bézier curves.

  3. Band organization (CPU)
    Curves are partitioned into vertical and horizontal bands.

  4. Rendering (GPU)
    The Slug algorithm evaluates the bands and rasterizes glyphs fully on the GPU.

Getting Started

Requirements

  • Bun v1.2+
  • A WebGPU-compatible browser (e.g. Chrome, Edge)

Install

bun install

Acknowledgements

Huge thanks to Eric Lengyel for creating the Slug algorithm and releasing it into the public domain.

Sources

探索相关项目

加载中…