static const char *demo_shader_hlsl =
"/*\n"
" * Copyright 2026 Behdad Esfahbod. All Rights Reserved.\n"
" */\n"
"\n"
"cbuffer Uniforms : register(b0) {\n"
"  float4x4 mvp;\n"
"  float2 viewport;\n"
"  float gamma;\n"
"  float stem_darkening;\n"
"  float4 foreground;\n"
"  float debug;\n"
"  float3 _pad;\n"
"};\n"
"\n"
"struct VSInput {\n"
"  float2 position : POSITION;\n"
"  float2 texcoord : TEXCOORD0;\n"
"  float2 normal   : NORMAL;\n"
"  float emPerPos   : TEXCOORD1;\n"
"  uint glyphLoc    : TEXCOORD2;\n"
"};\n"
"\n"
"struct PSInput {\n"
"  float4 pos      : SV_Position;\n"
"  float2 texcoord : TEXCOORD0;\n"
"  nointerpolation uint glyphLoc : TEXCOORD1;\n"
"};\n"
"\n"
"PSInput vs_main (VSInput input) {\n"
"  float2 pos = input.position;\n"
"  float2 tex = input.texcoord;\n"
"  float4 jac = float4 (input.emPerPos, 0.0, 0.0, -input.emPerPos);\n"
"  hb_gpu_dilate (pos, tex, input.normal, jac, mvp, viewport);\n"
"  PSInput output;\n"
"  output.pos = mul (mvp, float4 (pos, 0.0, 1.0));\n"
"  output.texcoord = tex;\n"
"  output.glyphLoc = input.glyphLoc;\n"
"  return output;\n"
"}\n"
"\n"
"float4 ps_main (PSInput input) : SV_Target {\n"
"#ifdef HB_GPU_DEMO_DRAW\n"
"  float cov = hb_gpu_draw (input.texcoord, input.glyphLoc);\n"
"  float4 c = float4 (foreground.rgb * foreground.a, foreground.a) * cov;\n"
"#else\n"
"  float cov;\n"
"  float4 c = hb_gpu_paint (input.texcoord, input.glyphLoc, foreground, cov);\n"
"\n"
"  if (cov > 0.0 && cov < 1.0) {\n"
"    float adj = cov;\n"
"    if (stem_darkening > 0.0) {\n"
"      float brightness = c.a > 0.0\n"
"        ? dot (c.rgb, float3 (1.0/3.0, 1.0/3.0, 1.0/3.0)) / c.a : 0.0;\n"
"      float2 fw = fwidth (input.texcoord);\n"
"      adj = hb_gpu_stem_darken (adj, brightness,\n"
"        1.0 / max (fw.x, fw.y));\n"
"    }\n"
"    if (gamma != 1.0)\n"
"      adj = pow (adj, gamma);\n"
"    c *= adj / cov;\n"
"  }\n"
"#endif\n"
"  return c;\n"
"}\n"
;
