Files
harfbuzz/util/gpu
Behdad Esfahbod 5e2b77d2ea [gpu] Port paint fragment shader to MSL; wire Metal demo
MSL transcription of the GLSL paint fragment interpreter.  Same
per-pixel op-stream walk and LAYER_SOLID SRC_OVER composite; the
only surface difference is that MSL's hb_gpu_fetch /
hb_gpu_paint take the atlas and palette as explicit buffer
pointer parameters (matching MSL's lack of globally-scoped
device-address-space globals).

  float4 hb_gpu_paint (float2 renderCoord, uint glyphLoc,
		       float4 foreground,
		       device const short4* hb_gpu_atlas,
		       constant float4* hb_gpu_palette);

hb_gpu_paint_shader_source() now returns a real string for
HB_GPU_SHADER_LANG_MSL fragment; vertex and WGSL/HLSL still stub
to "".

util/gpu/demo-metal.mm: concatenates the paint source alongside
the draw source into the Metal library, fragment_main switches
from hb_gpu_draw to hb_gpu_paint, and a 256-element palette
MTLBuffer is created + bound at fragment buffer index 2.  The
palette buffer is zero-filled for now; real palette upload from
the font's active palette is a follow-up (the GL path in
demo-font.cc uses glUniform4fv, which is GL-specific; a cleaner
cross-backend upload will come with the general palette plumbing).

Non-color text (u_foreground path) should render correctly on
Metal.  COLRv0 color glyphs will render transparent until the
palette upload lands -- ready for Mac smoke-testing.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:14:36 -06:00
..
2026-03-26 18:30:13 -06:00