summaryrefslogtreecommitdiff
path: root/core_glyphs.hlvs
blob: 64ce29199a4b584bc2b5596ce923a0a2e0e30a53 (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
43
44
45
46
/* 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
}

cbuffer output_info :register(b1) {
    uint2  out_offset;
}

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 = input.pos - tile_offset;
    output.tile_pos /= (float2)stipple_size;

    output.glyph_pos = input.glyph_pos / (float2)clip_size;
    output.out_pos = input.pos - out_offset;

    return output;
}