Commit Graph
21 Commits
Author SHA1 Message Date
Behdad EsfahbodandClaude Opus 4.6 2f486f7447 [gpu] Fix help text: align columns, s→g for gamma
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 03:30:49 -06:00
Behdad EsfahbodandClaude Opus 4.6 7087170797 [gpu] Add gamma correction for non-sRGB displays
When GL_FRAMEBUFFER_SRGB is not available (e.g. WebGL2), fall
back to shader-based gamma correction (pow(coverage, gamma)).

Press 'g' to cycle: sRGB → gamma 2.2 → no correction.
Default tries sRGB, falls back to gamma 2.2 automatically.

Replaces the old 's' (sRGB toggle) key binding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 03:23:49 -06:00
Behdad EsfahbodandClaude Opus 4.6 a002a14b2e [amalgamation] Add harfbuzz-world.cc single-compilation-unit build
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:57:56 -06:00
Behdad EsfahbodandClaude Opus 4.6 0172453697 [gpu] Remove unused gpu_demo_generated from meson
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>
2026-03-28 01:46:29 -06:00
Behdad EsfahbodandClaude Opus 4.6 3b7bfd4289 [gpu] Pinch-to-zoom and proportional scroll zoom
Make scroll zoom proportional to delta (pow(STEP, yoffset))
instead of fixed steps.  Add JS pinch-to-zoom handler that
translates two-finger touch to wheel events with a dead zone
to prevent jitter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 01:44:28 -06:00
Behdad EsfahbodandClaude Opus 4.6 95aa2c083b [gpu] Add drag threshold for tap detection on mobile
Small finger movements (< 5 pixels) during a touch no longer
count as a drag, allowing tap-to-toggle-animation to work
reliably on touchscreens.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 01:38:13 -06:00
Behdad EsfahbodandClaude Opus 4.6 90e8b99cd5 [gpu] Add Emscripten web demo; mobile touch support
Web build using Emscripten + WebGL2 with HB_GPU_ATLAS_2D mode.
Touch support: drag to pan, tap to toggle animation.
FPS counter overlay. Viewport meta for mobile.

Fix cursor position on first touch by querying glfwGetCursorPos
in mouse_func. Left click/tap also toggles animation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 01:31:28 -06:00
Behdad EsfahbodandClaude Opus 4.6 d46f8e3444 [gpu] Rename HB_GPU_SHADER_GLSL_330 to HB_GPU_SHADER_LANG_GLSL
The shader source is compatible with both GLSL 3.30 and
GLSL ES 3.00.  Rename the enum value to reflect this and
match the type name convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:40:11 -06:00
Behdad EsfahbodandClaude Opus 4.6 d07b1fbbb2 [gpu] Commit demo generated headers; remove stringize/hexify dependency
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>
2026-03-27 23:48:28 -06:00
Behdad EsfahbodandClaude Opus 4.6 b1ad797e50 [gpu] Commit stringized shader headers; auto-regenerate like ragel
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>
2026-03-27 23:37:52 -06:00
Behdad EsfahbodandClaude Opus 4.6 f2eb9d58bc [gpu] Reduce default perspective in demo
The large default text block looked too distorted with
perspective=4.  Use 16 for a flatter initial view.
The user can still adjust with Shift+right-drag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 18:38:27 -06:00
Behdad EsfahbodandClaude Opus 4.6 e4c174015f [gpu] Rename u_atlas uniform to hb_gpu_atlas
Namespace the GLSL uniform to avoid conflicts with user code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 17:21:27 -06:00
Behdad EsfahbodandClaude Opus 4.6 0582846c08 [gpu] Simplify shader API: return single string per language
Change hb_gpu_shader_{fragment,vertex}_sources() (array + count)
to hb_gpu_shader_{fragment,vertex}_source() returning a single
const char *.  Each language variant is one complete string.

Simplifies the demo shader compilation and documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 17:10:04 -06:00
Behdad EsfahbodandClaude Opus 4.6 25e69d9b96 [gpu] Port hb-gpu-demo to options.hh infrastructure
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>
2026-03-27 16:34:04 -06:00
Behdad EsfahbodandClaude Opus 4.6 686f3caa86 [gpu] Implement blob recycling in encode
recycle_blob stores the blob; encode reuses both the blob object
and its data buffer when the buffer is >= needed and < 2x needed.
Otherwise malloc fresh and replace_buffer on the recycled blob.

hb_blob_t::replace_buffer now skips destroy_user_data when the
new data pointer is the same as the old one (same-buffer reuse).

Add explicit destructor to hb_gpu_draw_t for recycled_blob cleanup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:13:44 -06:00
Behdad EsfahbodandClaude Opus 4.6 69686b0768 [gpu] Use hb-gpu-demo name in help text and window title
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 19:23:17 -06:00
Behdad EsfahbodandClaude Opus 4.6 e8d2bddfab [gpu] Make GL deps optional; add them to Linux CI
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>
2026-03-26 19:14:10 -06:00
Behdad EsfahbodandClaude Opus 4.6 65d357f808 [gpu] Rename hb_gpu_glyph_t to hb_gpu_draw_t
The object is a draw_funcs_t closure, same role as hb_raster_draw_t.
Rename for consistency with the other modules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 19:09:40 -06:00
Behdad EsfahbodandClaude Opus 4.6 9732ad4bcf [gpu] Build hb-gpu binary in util/ instead of util/gpu/
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>
2026-03-26 18:50:41 -06:00
Behdad EsfahbodandClaude Opus 4.6 294b625f7c [gpu] Wire up default font/text in demo
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>
2026-03-26 18:32:21 -06:00
Behdad EsfahbodandClaude Opus 4.6 03c2688436 [gpu] Add GPU demo app in util/gpu
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>
2026-03-26 18:30:13 -06:00