Files
harfbuzz/util/gpu/demo-vertex.glsl
T
Behdad Esfahbod 34a9f22f25 [util/gpu] Extract demo shaders into .glsl files
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>
2026-04-13 15:10:09 -06:00

31 lines
583 B
GLSL

/*
* Copyright 2026 Behdad Esfahbod. All Rights Reserved.
*/
uniform mat4 u_matViewProjection;
uniform vec2 u_viewport;
in vec2 a_position;
in vec2 a_texcoord;
in vec2 a_normal;
in float a_emPerPos;
in uint a_glyphLoc;
out vec2 v_texcoord;
flat out uint v_glyphLoc;
void main ()
{
vec2 pos = a_position;
vec2 tex = a_texcoord;
vec4 jac = vec4 (a_emPerPos, 0.0, 0.0, -a_emPerPos);
hb_gpu_dilate (pos, tex, a_normal, jac,
u_matViewProjection, u_viewport);
gl_Position = u_matViewProjection * vec4 (pos, 0.0, 1.0);
v_texcoord = tex;
v_glyphLoc = a_glyphLoc;
}