Matches the GLSL convention: demo-shader.{msl,hlsl,wgsl} live
alongside demo-fragment.glsl and get stringified by the same
gen-gpu-shader-artifacts.py helper into demo-shader-{msl,hlsl,
wgsl}.hh. No more giant inline R"msl(...)" / R"hlsl(...)" /
R"wgsl(...)" blobs in the .mm / .cc files.
Each language combines vertex and fragment entry points in one
source, as is idiomatic for MSL / HLSL / WGSL compilers; GLSL's
split (demo-vertex.glsl + demo-fragment.glsl) is preserved
because glCompileShader takes separate stages.
No functional change.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
demo_vertex_glsl and demo_fragment_glsl were inline R"glsl(...)"
string literals in util/gpu/demo-shader.cc. Pull them into
dedicated util/gpu/demo-{vertex,fragment}.glsl source files with
their own copyright headers, and wire the existing
gen-gpu-shader-artifacts.py generator to stringize them into
demo-*-glsl.hh at build time.
Also simplifies gen-gpu-shader-artifacts.py: the decl_map had
grown to cover every shader and its entries were all trivial
filename-to-symbol derivations. Replace the map with direct
derivation (hyphens -> underscores, strip .hh), so adding more
shaders anywhere -- library or demo -- needs no generator edit.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GPU library always builds (no deps). GPU demo controlled by
gpu_demo option (auto default). Only MSVC CI disables it
(GLEW wrap broken with -nodefaultlib). All other CIs install
GLEW/GLFW system packages.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop gpu_demo option. GLEW/GLFW use required:false — demo builds
when deps are found, skipped when not. Install GLEW/GLFW on all
CIs (Linux already had them, add to macOS and Rust). MinGW CI
uses wraps via --wrap-mode=default.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GPU library is always built (no deps). GPU demo (hb-gpu) requires
GLEW/GLFW/GL and is controlled by gpu_demo option (auto by default).
When disabled, deps aren't even looked up — fixes MSVC pulling in
broken GLEW wrap. MinGW CI explicitly enables with -Dgpu_demo=enabled.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wire demo_renderer_create_d3d11 into gpu-output.hh with --direct3d
flag. Add to meson build conditionally on Windows with d3d11 and
d3dcompiler libraries. Remove standalone D3D11 demo (superseded).
hb-gpu.exe --demo --direct3d now works under Wine.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace separate .glsl files and generated .hh headers with C++11
raw string literals (R"glsl(...)glsl") directly in demo-shader.cc.
Matches the pattern already used by demo-metal.mm and the WebGPU
demo. Removes demo shader generation from meson and the generator
script.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
Replace backend-specific branches with a demo_renderer_t base class
that both GL and Metal implement. This eliminates all if(metal) checks
in the view code and makes adding future backends (WebGPU) clean.
- Add demo-renderer.h with virtual interface
- Add demo-renderer-gl.cc wrapping existing GL code
- Rewrite demo-metal.mm to implement renderer interface
- Move VBO/VAO management from demo_buffer into GL renderer
- Fix Metal vsync (CAMetalLayer.displaySyncEnabled)
- Fix dark mode crash on Metal (was calling GL directly)
- Add set_background to renderer for clear color control
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add MSL shader translations of the Slug GPU text rasterizer, and a
Metal rendering backend for hb-gpu-demo selectable via --metal flag.
Library changes:
- Add HB_GPU_SHADER_LANG_MSL enum value
- Add hb-gpu-vertex.msl and hb-gpu-fragment.msl
- Extend gen-gpu-shader-artifacts.py for MSL
Demo changes:
- Add demo-metal.h/mm with CAMetalLayer rendering
- Add external atlas backend for non-GL paths
- Add demo_buffer_get_vertices for Metal draw path
- Skip GL init when using Metal (GLFW_NO_API)
- Add --metal command-line flag
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dependency('gl') resolves to Mesa's libGL via Homebrew, which
can't render to native macOS windows.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Check the font's GSUB table for Latin and Arabic script support.
Build default demo text from English (Lorem Ipsum) and Persian
paragraphs for supported scripts, cropped to 35 lines each.
Source paragraphs live in perf/texts/{en,fa}-paragraph.txt.
gen-default-texts.py wraps them at fixed width and generates
the .hh headers.
Web demo hardcodes both texts since the embedded font supports
both scripts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge the .c and .h files into single .hh headers with
static inline functions. Eliminates the C/C++ linkage issue
and simplifies the web demo build to a single em++ call.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The demo headers are pre-generated and committed; the
custom_target generation was already removed but the empty
variable and its reference remained.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-generate demo shader headers, default text, and default font
so the demo builds without stringize or hexify at compile time.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-generate hb-gpu-{fragment,vertex}-glsl.hh from the .glsl
sources so the library builds without Python/stringize at
compile time.
When stringize is found, a build rule regenerates them from
the .glsl sources and copies back to the source tree, matching
the ragel artifact pattern.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the manual getopt-based demo main with the standard
main_font_text_t / shape_consumer_t composition, getting all
harfbuzz options for free: --variations, --features, --script,
--direction, --face-index, --font-funcs, etc.
New gpu_output_t (in util/gpu-output.hh) implements the output
interface, feeding shaped glyphs to the demo's GL renderer.
Add demo_buffer_add_glyph() and demo_buffer_current_line() to
demo-buffer for glyph-at-a-time insertion (vs the old batch
add_text which did its own shaping).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The demo requires GLEW, GLFW3, and GL. Make these optional so the
library still builds on headless systems. The demo is skipped when
they're missing.
Install the GL packages in the Linux CI workflow so the demo
builds there.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the executable definition to util/meson.build so the binary
lands at util/hb-gpu, consistent with other utilities.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fall back to an embedded font when no font file is given,
matching the glyphy-demo behaviour.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port the glyphy-demo to use the hb-gpu API. Builds as util/hb-gpu
and requires GLEW, GLFW3, and OpenGL 3.3. Includes default text
and embedded font for quick testing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>