mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
Adds command-line flags --draw (force monochrome Slug path) and
--paint (force COLRv1 paint path) to hb-gpu, defaulting to
auto-detect based on hb_ot_color_has_paint(face). Threads a
draw_only bool through the demo layer so each backend compiles
exactly one fragment program (draw or paint, not both).
The paint pipeline is ~10x slower than the draw pipeline on
monochrome content; auto-detect lets monochrome fonts keep the
fast path while still exercising both code paths from the same
binary.
Plumbing:
- demo_renderer_create_{gl,metal,d3d11} and demo_font_create
take a draw_only argument.
- demo-fragment.{glsl,msl,hlsl} branch on HB_GPU_DEMO_DRAW,
calling either hb_gpu_draw or hb_gpu_paint.
- demo-shader / glstate / d3d11 / metal include only the
fragment helper for the chosen path and prepend
HB_GPU_DEMO_DRAW to the source when draw_only.
- demo-font dispatches glyph upload to hb_gpu_draw_* or
hb_gpu_paint_* and hides palette/foreground setters in
draw mode.
Web demos pass false (paint-only) for now; a runtime
re-creation hook on font change would be needed there.
Tested on desktop GL, win64 D3D11, WebGL, WebGPU.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
47 lines
872 B
C
47 lines
872 B
C
/*
|
|
* Copyright 2026 Behdad Esfahbod. All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef DEMO_GLSTATE_H
|
|
#define DEMO_GLSTATE_H
|
|
|
|
#include "demo-common.h"
|
|
#include "demo-buffer.h"
|
|
|
|
#include "demo-atlas.h"
|
|
#include "demo-shader.h"
|
|
|
|
typedef struct demo_glstate_t demo_glstate_t;
|
|
|
|
demo_glstate_t *
|
|
demo_glstate_create (bool draw_only);
|
|
|
|
void
|
|
demo_glstate_destroy (demo_glstate_t *st);
|
|
|
|
|
|
void
|
|
demo_glstate_setup (demo_glstate_t *st);
|
|
|
|
demo_atlas_t *
|
|
demo_glstate_get_atlas (demo_glstate_t *st);
|
|
|
|
void
|
|
demo_glstate_set_matrix (demo_glstate_t *st, float mat[16]);
|
|
|
|
void
|
|
demo_glstate_set_gamma (demo_glstate_t *st, float gamma);
|
|
|
|
void
|
|
demo_glstate_set_foreground (demo_glstate_t *st,
|
|
float r, float g, float b, float a);
|
|
|
|
void
|
|
demo_glstate_set_debug (demo_glstate_t *st, bool enabled);
|
|
|
|
void
|
|
demo_glstate_set_stem_darkening (demo_glstate_t *st, bool enabled);
|
|
|
|
|
|
#endif /* DEMO_GLSTATE_H */
|