Commit Graph
66 Commits
Author SHA1 Message Date
Behdad Esfahbod 59d819f09c [util/gpu/web] Live palette via postMessage
Add web_set_palette() to both GL and WebGPU bindings (forwards
to demo_font_set_palette + buffer rebuild) and accept a
{ kind: 'palette', value: <int> } message in shell.html.  Lets
the harfbuzz-world.cc host page push the user's CPAL pick into
the embedded GPU iframe alongside text / font / variations.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 15:22:13 -06:00
Behdad EsfahbodandClaude Opus 4.6 d17ff1e8d6 [util/gpu/web] Live variations via postMessage
Add web_set_variations(const char *) to both the WebGL and
WebGPU hb-gpu-web wasm modules.  Parses a comma-separated
"wght=400,wdth=100" string via hb_variation_from_string,
applies via hb_font_set_variations on the current font, and
rebuilds the shaping buffer.  Cheap to call repeatedly --
suitable for live slider pushes once a slider UI lands.

Shell.html grows a matching applyVariations() helper and a
'variations' postMessage case.  config-override.h undefs
HB_NO_VAR so the new function actually links.  EXPORTED
_FUNCTIONS on both build scripts list _web_set_variations.

Also plumbed in a small cap (32 axes) on the stack so the
parser doesn't need hb's internal containers -- no font has
anywhere near that many.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 12:57:18 -06:00
Behdad EsfahbodandClaude Opus 4.6 d35cdadd2a [util/gpu/web] Ignore 0x0 resizeCanvas calls; keep default buffer
The iframe-hosted case ran resizeCanvas() at script parse
time, before the iframe had laid out its canvas, which
installed a 0x0 drawing buffer.  getContext('webgl2')
grabbed that 0x0 context and every subsequent setup (atlas,
viewport, swap chain) was frozen at 0x0 even when
ResizeObserver later re-ran resizeCanvas with real dims --
the existing context doesn't resize with the canvas
attribute.

Bail out of resizeCanvas when either dimension is 0, so the
canvas keeps its intrinsic default (300x150) until a real
layout arrives.  getContext then grabs a non-degenerate
context, and the first ResizeObserver callback bumps it up
to the actual iframe-sized buffer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 12:00:17 -06:00
Behdad EsfahbodandClaude Opus 4.6 b13da1a712 [util/gpu/web] Re-fire window resize from the canvas observer
Changing canvas.width/height directly doesn't reach
emscripten's GLFW port -- its framebuffer-size callback
fires on window 'resize' events, not canvas mutation
records.  When ResizeObserver picks up the iframe's first
real layout, also dispatch a synthetic 'resize' event so
the framebuffer_size callback runs in wasm and glViewport
gets re-set to the real size.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:58:57 -06:00
Behdad EsfahbodandClaude Opus 4.6 05cb6623f6 [util/gpu/web] ResizeObserver on canvas; pick up first real layout
Initial resizeCanvas() runs at script parse time -- when the
shell is inside a just-mounted iframe, the canvas's
clientWidth / clientHeight are 0 (iframe hasn't laid out
yet) and the GL drawing buffer installs at 0x0.  A plain
window 'resize' event never fires just because the iframe
has sized itself, so the buffer stays 0x0 and the tab looks
blank forever.

Watch the canvas with a ResizeObserver and re-run
resizeCanvas + requestRedraw on any observed size change,
which catches the first real size the moment the iframe
lays out.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:57:36 -06:00
Behdad EsfahbodandClaude Opus 4.6 8c99cf0a9a [util/gpu/web] Accept ?embed without a value, not just ?embed=1
Be permissive about the embed-mode URL form: ?embed,
?embed=1, ?embed=true all turn the mode on; only explicit
?embed=0 / ?embed=false leave it off.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 06:13:45 -06:00
Behdad EsfahbodandClaude Opus 4.6 bdea49603c [util/gpu/web] Add embed-mode + postMessage protocol to the web demo
Lets a host page embed hb-gpu-demo as an iframe and drive it
from outside.  harfbuzz-world.cc uses this to share its
text/font controls with the GPU tab without reinventing the
GPU stack.

Shell additions:
  - ?embed=1 URL param hides the demo's own chrome (font
    picker, text button, backend selector, FPS counter,
    keyboard-help overlay) by setting html.embed.
  - Message protocol:
      { kind: 'text', value: '…' }           -> applyText
      { kind: 'font', bytes: ArrayBuffer }    -> _web_load_font
    On runtime init the shell posts { kind: 'ready' } to its
    parent so the host can send font bytes (which can't ride
    on the URL for file-uploaded fonts).

Existing ?text= and ?font= URL params still work and are
useful for "link to a specific demo" sharing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 06:09:28 -06:00
Behdad Esfahbod ea88d25d07 [util/gpu] Web demos: drop stale gamma-toggle hints
The `g` key was removed when we hardcoded gamma 2.2; the shell's
help overlay still mentioned it.  Drop the lines.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 22:29:00 -06:00
Behdad Esfahbod 585154aa10 [util/gpu] Web demos: fix URL-param handling for ?font= and ?text=
rebuild_buffer did free(current_text); strdup(text); but was often
called with text == current_text (from web_load_font's
"custom_text ? current_text : default").  Strdup of freed memory
shaped garbage and made multi-char strings look like 1 char.  Fix:
strdup first, then free.

The WebGL rebuild_buffer also called demo_view_display itself,
which runs fine from a main loop tick but not from a fetch
promise's microtask (the canvas back-buffer doesn't swap).  Drop
it: demo_view_reset sets needs_redraw=true, and the next
main_loop_iter renders inside a proper rAF tick.

Emscripten allocates argv on the JS stack, which is unwound when
main returns.  WebGPU's init is async and reads arg_text/arg_font
after main returns, so those pointers were dangling -- early null
bytes in freed stack memory made the emoji URL shape to 1 glyph.
strdup them in main so they survive.

Finally, forward ?font= to argv as --font= (already done for
?text=) so the C side's "skip initial default-font glyph upload
when a font fetch is pending" path actually triggers.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 18:12:47 -06:00
Behdad Esfahbod b616298d73 [util/gpu] Web demos: skip default-font upload when ?font= pending; preserve URL on backend switch; reflect custom text in URL
Three small UX improvements to the web demos.

### Skip default-font upload when ?font= is pending

When ?font= is set, the async fetch replaces the font later.  main
was still populating the atlas with the default font's glyphs for
the initial text, just to throw them away when _web_load_font ran
its own rebuild_buffer.  Gate demo_buffer_add_text() on !arg_font
so the buffer stays empty until the real font lands.

### WebGPU ready signal

WebGPU's init_demo is async (awaits adapter/device), so
onRuntimeInitialized fires before the demo is usable; calling
_web_load_font from the ?font= fetch at that point tripped a wasm
indirect-call signature mismatch.  init_demo now EM_ASMs a
window._webDemoReady() hook at its tail; the shell installs
_webDemoReady = startFontFetch when running the WebGPU build and
starts the fetch immediately for WebGL.

### URL ergonomics

* Backend-selector change now carries location.search across the
  navigation -- ?text= and ?font= survive the WebGL <-> WebGPU
  switch.
* The text-edit modal's Apply button updates history.replaceState
  with a ?text= param so the typed text is copy/pasteable.  Skips
  the update when the text is unchanged from what was open.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:10:31 -06:00
Behdad Esfahbod c85b453e90 [util/gpu] Web demos: URL ?text= and ?font=; wider default font
Two user-visible features plus a font swap.

### URL parameters

Forwards ?text= and ?font= from the query string into the C main
as --text=... and --font=... via Module.arguments, so the initial
text is applied before the first rendered frame (no flash of
default demo text).  ?font= is still fetched asynchronously on
the JS side; once loaded, the text is re-applied to the new font.

If neither parameter is present, behaviour is unchanged: the
baked-in default text renders in the baked-in default font.

Data URLs (?font=data:font/ttf;base64,...) work naturally via
fetch().  Remote URLs need CORS; raw.githubusercontent.com and
jsdelivr both work, github.com/.../raw/... does not.

### Wider default font

The baked-in default-font.hh was a narrow subset that didn't
include uppercase Latin, so `?text=Hello` shaped to .notdef for
H and W.  Re-subset Parastoo-Regular.ttf via hb-subset with:

    --unicodes='U+0020-007E,U+0600-06FF,U+FB50-FDFF,U+FE70-FEFF'

covering printable ASCII plus the Arabic block and the two
Arabic presentation-forms blocks.

Font size:
    source Parastoo-Regular.ttf     109152
    new subset                       49940

Wasm size impact (webgl build, Oz+lto):
    before  443628  181597 gz
    after   466657  196209 gz
    delta   +23029  +14612 gz

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:03:53 -06:00
Behdad Esfahbod 2c15cb9123 [web] Continue pan after pinch handoff
The previous fix stopped the 2->1 jump by swallowing the pinch-ending
touchend and seeding a synthetic left-button press at the remaining
finger. But subsequent one-finger motion was still left to the browser,
which does not reliably resume mouse emulation mid-gesture.

Track an explicit single-finger pan mode after the pinch handoff, route
its touchmove events to synthetic mousemove, and end it with a
gesture-cancelled synthetic mouseup on lift or touchcancel.

Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh

Assisted-by: OpenAI Codex
2026-03-30 18:25:42 -06:00
Behdad Esfahbod 7c3c313bbc [web] Fix pinch to single-finger handoff
The WebGL touch path only tracked the initial 3->2 reseed with
skipNextPinchMove. Once a real pinch was underway, the later 2->1
transition stopped being treated as a gesture handoff and fell back
into the browser/GLFW single-touch path.

Track pinch-active state explicitly, swallow the pinch-ending touchend,
and hand single-finger pan off from the remaining touch by syncing the
cursor before synthesizing mousedown. This keeps the 3->2->1 sequence
from jumping the view when the second finger lifts.

Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh

Assisted-by: OpenAI Codex
2026-03-30 18:22:03 -06:00
Behdad Esfahbod 4ebb454061 Revert "[gpu] Sync cursor position on 2→1 touch transition"
This reverts commit d44b0958fa.
2026-03-30 18:18:15 -06:00
Behdad EsfahbodandClaude Opus 4.6 d44b0958fa [gpu] Sync cursor position on 2→1 touch transition
Dispatch mousemove before mousedown when transitioning from
pinch to single-finger pan, so GLFW's cursor position matches
the remaining finger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 18:17:34 -06:00
Behdad EsfahbodandClaude Opus 4.6 1c242329dc [gpu] Double-click reset on both left and right buttons
Double-left-click and double-right-click both reset view.
Middle-click reset also still works. Updated help text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 12:55:19 -06:00
Behdad EsfahbodandClaude Opus 4.6 453eb77634 [gpu] Fix pan after pinch: synthesize mousedown on 2→1 transition
GLFW doesn't see the remaining finger after a swallowed pinch,
so synthesize a mousedown to start drag tracking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 12:42:59 -06:00
Behdad Esfahbod db6d2c27ec Revert "[web] Move tap recognition to touchend"
This reverts commit 7db69c0cd0.
2026-03-30 12:32:50 -06:00
Behdad Esfahbod 7db69c0cd0 [web] Move tap recognition to touchend
WebGL mobile currently commits a tap on touchstart, then the second
tap in a double-tap zoom has to undo that animation toggle. This
makes tap and double-tap drag compete and can start animation before
gesture intent is clear.

Track a pending single tap until touchend, suppress the synthetic
click toggle on release, and only fire the animation toggle after the
double-tap timeout expires. A second tap now cancels that pending
toggle and claims double-tap zoom directly.

Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
  EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh

Assisted-by: OpenAI Codex
2026-03-30 12:31:24 -06:00
Behdad Esfahbod bef4c6a79e [web] Handle touchcancel in touch gestures
Track the last gesture centroid and explicitly handle touchcancel
for both web gesture paths. This clears active gesture state
without turning browser-driven cancellation into a tap, fling, or
stuck drag.

Testing:
- sh -n util/gpu/web/build.sh
- sh -n util/gpu/web/build-webgpu.sh
- EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh
  (blocked offline fetching emdawnwebgpu)

Assisted-by: OpenAI Codex
2026-03-30 12:14:59 -06:00
0bdd933a1e [gpu] Fix 3-finger to 2-finger touch transition
Properly handle finger count transitions with cooldown and
state reinitialization to prevent jumps in zoom/rotation.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:54:03 -06:00
Behdad EsfahbodandClaude Opus 4.6 d8f1c44fd3 [gpu] Skip first touchmove after finger count change
Prevents jumps during 3→2→1 finger transitions by dropping
one frame and reinitializing pinch state for the new finger
count.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:36:22 -06:00
Behdad EsfahbodandClaude Opus 4.6 dac2716b2a [gpu] Fix 3-finger to 2-finger transition jump
Reinitialize pinch state (distance, angle, centroid) when
exiting 3-finger mode with 2 fingers remaining. Prevents
large zoom/rotate delta from stale pinch values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:29:07 -06:00
fa50f16e51 [gpu] Fix black screen on resume with web_request_redraw
Add demo_view_request_redraw() and export as _web_request_redraw.
Shell calls it on visibilitychange, focus, pageshow, and
webglcontextrestored events to force a redraw after phone
lock/unlock or tab switch.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:17:42 -06:00
Behdad EsfahbodandClaude Opus 4.6 34d0280f80 [gpu] Revert canvas width hack, keep visibilitychange listener
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:12:00 -06:00
Behdad EsfahbodandClaude Opus 4.6 8e8322eb8d [gpu] Force canvas resize on visibility change
Toggle canvas width by 1px to ensure GLFW detects the size
change and triggers a redraw after phone lock/unlock.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:08:38 -06:00
Behdad EsfahbodandClaude Opus 4.6 317dffe886 [gpu] Redraw on visibility change and context restore
Fixes black screen after phone lock/unlock or tab switch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:06:42 -06:00
Behdad EsfahbodandClaude Opus 4.6 c4f8c58433 [gpu] Prevent animation toggle after long-press reset
preventDefault on touchend after long-press fires, so GLFW
doesn't see it as a click.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:01:14 -06:00
Behdad EsfahbodandClaude Opus 4.6 6b111e5ca2 [gpu] Fix mobile gestures: long-press reset, double-tap-drag zoom
Long-press uses _web_reset directly with 10px jitter threshold.
Double-tap-drag undoes first tap's animation toggle via
_web_toggle_animation, then preventDefault blocks GLFW from
seeing the second tap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:59:04 -06:00
Behdad EsfahbodandClaude Opus 4.6 10ca3ef37f [gpu] Fix long-press reset and double-tap-drag animation
Use exported _web_reset() for long-press instead of synthesized
keyboard event. Second tap of double-tap-drag naturally undoes
the first tap's animation toggle via GLFW click handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:51:03 -06:00
Behdad EsfahbodandClaude Opus 4.6 d2469853e8 [gpu] Add mobile gestures: long-press reset, double-tap-drag zoom
Long-press (500ms) resets view. Double-tap and drag vertically
zooms in/out (one-handed zoom like Google Maps).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:46:59 -06:00
Behdad EsfahbodandClaude Opus 4.6 9da25b8a1f [gpu] Rework pinch: unified pan+zoom+rotate gesture
Single demo_view_pinch() handles all three components atomically:
- Pan from centroid movement
- Zoom around centroid (proven middle-drag math)
- Screen-space Z rotation (separate from 3D quaternion)

Pinch rotation uses a screen_angle field applied as a post-MVP
2D rotation, keeping it independent from the 3D trackball.
Zoom centering works correctly; rotation centering is approximate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:19:45 -06:00
Behdad EsfahbodandClaude Opus 4.6 7659baca01 [gpu] Pinch-zoom around pinch center
Adds demo_view_zoom_around() which scales while compensating
translation so the midpoint between fingers stays fixed.
Same maps-like behavior as the pinch rotation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 09:44:40 -06:00
Behdad EsfahbodandClaude Opus 4.6 c1550337db [gpu] Pinch-rotate around pinch center, not screen center
Adds demo_view_rotate_z_around() which compensates translation
so the point between the two fingers stays fixed during rotation,
like maps apps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 09:40:56 -06:00
Behdad EsfahbodandClaude Opus 4.6 16c30ac052 [gpu] Add pinch-to-rotate alongside pinch-to-zoom
Two-finger pinch now does both zoom (distance change) and Z-axis
rotation (angle change) simultaneously. Adds demo_view_rotate_z()
for direct Z-axis rotation from touch input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 09:35:53 -06:00
Behdad EsfahbodandClaude Opus 4.6 0c96216518 [gpu] Move / and ? to keyboard section in help modal
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 00:11:57 -06:00
Behdad EsfahbodandClaude Opus 4.6 8e460c5298 [gpu] Add / clean screen to help modal
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 00:09:52 -06:00
Behdad EsfahbodandClaude Opus 4.6 c81010f99f [gpu] Split / and ?: / toggles HUD, ? shows help modal
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 00:08:42 -06:00
Behdad EsfahbodandClaude Opus 4.6 c8e37ce1f5 [gpu] Rearrange help modal, add HarfBuzz link
Keyboard first, mouse/touch second. Link to HarfBuzz GitHub
at bottom right.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 00:00:31 -06:00
Behdad EsfahbodandClaude Opus 4.6 936486dea8 [gpu] Fix help text alignment
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:56:46 -06:00
Behdad EsfahbodandClaude Opus 4.6 47e83b0bac [gpu] Show ?: help in quick-guide
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:54:09 -06:00
Behdad EsfahbodandClaude Opus 4.6 41798ff4d3 [gpu] Fix help modal toggle and polish help text
Only toggle on keydown (not keyup). Remove vsync from web help.
Format key names with spaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:52:36 -06:00
Behdad EsfahbodandClaude Opus 4.6 af6891a307 [gpu] Add ? help overlay to web demo
Press ? or / to show full keyboard/mouse/touch reference.
Esc or ? again to dismiss.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:49:11 -06:00
Behdad EsfahbodandClaude Opus 4.6 0118c285ef [gpu] / and ? toggle help: print in desktop, toggle HUD in web
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:44:37 -06:00
Behdad EsfahbodandClaude Opus 4.6 b8a17218d1 [gpu] Shift+R to reload page in web demo
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:33:25 -06:00
Behdad EsfahbodandClaude Opus 4.6 02edb7ba46 [gpu] Treat empty text as cancel in text modal
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:29:53 -06:00
Behdad EsfahbodandClaude Opus 4.6 ed91b9645f [gpu] Add keyboard shortcuts: t=text, f=font, w=switch backend
Also Ctrl/Shift/Cmd+Enter commits text in the text modal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 23:27:43 -06:00
Behdad EsfahbodandClaude Opus 4.6 0ec8ed2e62 [gpu] Update web demo help text
Add stem darkening, shorten labels, remove =/-: zoom.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:37:02 -06:00
Behdad EsfahbodandClaude Opus 4.6 8022d64440 [gpu] Add WebGL2 availability check to web demo
Show helpful error with link to webglreport.com when WebGL2
context creation fails (e.g. Firefox with hardware acceleration
disabled or GPU blocklisted).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:41:30 -06:00
Behdad EsfahbodandClaude Opus 4.6 ddd6a86470 [gpu] Add debug heatmap mode (d key)
Refactor library fragment shaders (GLSL, MSL, WGSL) to extract
_hb_gpu_decode_glyph and _hb_gpu_curve_counts helpers, used by
both hb_gpu_render and the debug visualization.

Debug mode (d key) shows per-pixel curve counts as a heatmap:
R = horizontal band curves, G = vertical band curves, B = text
coverage. Scale 0-8 curves maps to 0-1 intensity.

Also auto-generates demo shader headers via meson, and adds
set_debug to the renderer interface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 17:40:38 -06:00