diff options
Diffstat (limited to 'render_glyphs.hlvs')
-rw-r--r-- | render_glyphs.hlvs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/render_glyphs.hlvs b/render_glyphs.hlvs new file mode 100644 index 0000000..be38a51 --- /dev/null +++ b/render_glyphs.hlvs @@ -0,0 +1,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 +} + +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.glyph_pos; + output.tile_pos /= (float2)stipple_size; + + output.glyph_pos = 0; + output.out_pos = 0; + + return output; +} |