summaryrefslogtreecommitdiff
path: root/glyphs.template
blob: bf0541f71d1cb78a77faea1a6d33e627638de89a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Automatically generated file; do not edit */

// This vertex shader takes inputs in integer pixels, as well as
// a glyph position in integer texels, and outputs
// in floating point coordinates understood by the DX drawing system.

struct VS_INPUT {
    uint2 pos :POSITION;
    uint2 glyph_pos :TEXCOORD0;
};

struct VS_OUTPUT {
    float2 tile_pos  :TEXCOORD0;
    float2 glyph_pos :TEXCOORD1;
    float2 out_pos   :TEXCOORD2;
    float4 pos       :SV_POSITION;
};

cbuffer info :register(b0) {
    float2 wh;  // Half width, half height of target drawable
    uint2  tile_offset;
    uint2  stipple_size;
    uint2  clip_offset;   // unused (glyph pos is taken from input.glyph_pos)
    uint2  clip_size;     // size of the entire glyph atlas
}
{{.Cbuf}}
VS_OUTPUT main(VS_INPUT input)
{
    VS_OUTPUT output;
    output.pos.x = input.pos.x / wh.x - 1.0f;
    output.pos.y = -(input.pos.y / wh.y - 1.0f);
    output.pos.z = 0;
    output.pos.w = 1;

    output.tile_pos = {{.TilePos}};
    output.tile_pos /= (float2)stipple_size;

    output.glyph_pos = {{.GlyphPos}};
    output.out_pos = {{.OutPos}};

    return output;
}