mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
WGSL transcription of the paint interpreter. Takes the atlas and
palette as explicit storage-buffer pointer parameters (matching
the WGSL draw helper's calling convention):
fn hb_gpu_paint (renderCoord: vec2f, glyphLoc: u32,
foreground: vec4f,
hb_gpu_atlas: ptr<storage, array<vec4<i32>>, read>,
hb_gpu_palette: ptr<storage, array<vec4f>, read>) -> vec4f
hb_gpu_paint_shader_source() now returns real content for
HB_GPU_SHADER_LANG_WGSL fragment; HLSL still stubs to "".
util/gpu/web/hb-gpu-web-webgpu.cc:
- Concats the paint source alongside the draw source into the
WGSL shader module.
- Declares @group(0) @binding(2) for hb_gpu_palette.
- Allocates a 256 * vec4f storage buffer (zero-filled for now;
real palette upload is TODO), binds it at entry index 2.
- Fragment main switches from hb_gpu_draw to hb_gpu_paint.
util/gpu/web/gl-stub.h: adds glUniform4fv stub (demo-font.cc now
calls it for the GL palette path) and makes
glGetUniformLocation return -1 so the WebGPU build's
demo_font_upload_palette short-circuits.
Wasm sizes:
WebGL index.wasm : 443628 181597 gz
WebGPU webgpu.wasm : 461110 188045 gz
Non-color text should render through WebGPU. COLRv0 color glyphs
come up transparent until the cross-backend palette upload lands.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>