Files
harfbuzz/util/gpu/web
Behdad Esfahbod cf3d69bc54 [util/gpu] Cross-backend palette upload via demo_renderer_t::set_palette
Reorganises the palette-upload plumbing so every backend handles
it uniformly and the hacky atlas-backend palette callback goes
away.

Before: demo_font_upload_palette in demo-font.cc mixed a GL
glUniform4fv direct call with a detour through an extra
demo_atlas_backend_t.upload_palette callback used by the Metal
renderer.  demo-font and demo-atlas both knew about palettes.

After:

* demo_font_get_palette (font, out, capacity) just reports the
  active palette as RGBA floats; demo-font no longer touches GL
  state or the atlas for palettes.

* demo_renderer_t gains a virtual set_palette (rgba, count).
  Default is a no-op.  Backends override:
   - demo-renderer-gl.cc -> demo_glstate_set_palette() ->
     glUniform4fv.
   - demo-metal.mm -> memcpy into the MTLBuffer's contents.
   - demo-renderer-d3d11.cc -> ID3D11DeviceContext::UpdateSubresource
     (palette buffer switched from IMMUTABLE to DEFAULT).
   - hb-gpu-web-webgpu.cc -> wgpuQueueWriteBuffer on the palette
     storage buffer.

* Callers invoke renderer->set_palette (palette, n) right after
  demo_font_create:
   - util/gpu-output.hh (desktop demo: GL / Metal / D3D11).
   - util/gpu/web/hb-gpu-web.cc (WebGL).
   - util/gpu/web/hb-gpu-web-webgpu.cc (WebGPU).

* The extra upload_palette field on demo_atlas_backend_t is
  removed along with demo_atlas_upload_palette / _is_external --
  atlas is back to being about glyph data only.

COLRv0 rendering now works with proper palette colours through
every backend that implements set_palette (WebGL, WebGPU, and
Metal/D3D11 once tested).

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:19:13 -06:00
..
2026-03-30 22:35:10 -06:00