mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-06 06:52:44 -07:00
updates to sokol_demo & sokol backend
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx"
|
||||
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
||||
|
||||
Cmdline:
|
||||
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\draw_text.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\draw_text.odin --slang hlsl4 --format=sokol_odin --module =draw_text
|
||||
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\draw_text.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\draw_text.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin --module =draw_text
|
||||
|
||||
Overview:
|
||||
=========
|
||||
@@ -44,6 +44,250 @@ Draw_Text_Fs_Params :: struct #align(16) {
|
||||
colour: [4]f32,
|
||||
},
|
||||
}
|
||||
/*
|
||||
#version 410
|
||||
|
||||
layout(location = 0) out vec2 uv;
|
||||
layout(location = 1) in vec2 v_texture;
|
||||
layout(location = 0) in vec2 v_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = vec2(v_texture.x, 1.0 - v_texture.y);
|
||||
gl_Position = vec4((v_position * 2.0) - vec2(1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_vs_source_glsl410 := [261]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
|
||||
0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,
|
||||
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x76,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,
|
||||
0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,
|
||||
0x31,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
|
||||
0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#version 410
|
||||
|
||||
struct draw_text_fs_params
|
||||
{
|
||||
int down_sample;
|
||||
vec4 colour;
|
||||
};
|
||||
|
||||
uniform draw_text_fs_params _31;
|
||||
|
||||
uniform sampler2D draw_text_src_texture_draw_text_src_sampler;
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
float alpha = texture(draw_text_src_texture_draw_text_src_sampler, uv).x;
|
||||
if (_31.down_sample == 1)
|
||||
{
|
||||
alpha = 0.25 * (((texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(-0.000244140625, -0.0009765625)).x + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(-0.000244140625, 0.0009765625)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(0.000244140625, -0.0009765625)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(0.000244140625, 0.0009765625)).x);
|
||||
}
|
||||
frag_color = vec4(_31.colour.xyz, _31.colour.w * alpha);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_fs_source_glsl410 := [882]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x73,0x74,
|
||||
0x72,0x75,0x63,0x74,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,
|
||||
0x6e,0x74,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,
|
||||
0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x20,0x5f,0x33,0x31,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,
|
||||
0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,
|
||||
0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,
|
||||
0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,
|
||||
0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x31,0x2e,0x64,0x6f,0x77,0x6e,0x5f,
|
||||
0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,
|
||||
0x20,0x3d,0x20,0x30,0x2e,0x32,0x35,0x20,0x2a,0x20,0x28,0x28,0x28,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
|
||||
0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,
|
||||
0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,
|
||||
0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x20,0x2b,
|
||||
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,
|
||||
0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,
|
||||
0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,
|
||||
0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,
|
||||
0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,
|
||||
0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,
|
||||
0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,
|
||||
0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,
|
||||
0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,
|
||||
0x35,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,
|
||||
0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,
|
||||
0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,
|
||||
0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,
|
||||
0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f,0x75,
|
||||
0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f,0x75,
|
||||
0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x3b,0x0a,0x7d,0x0a,
|
||||
0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#version 300 es
|
||||
|
||||
out vec2 uv;
|
||||
layout(location = 1) in vec2 v_texture;
|
||||
layout(location = 0) in vec2 v_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = vec2(v_texture.x, 1.0 - v_texture.y);
|
||||
gl_Position = vec4((v_position * 2.0) - vec2(1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_vs_source_glsl300es := [243]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,
|
||||
0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x76,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x76,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,
|
||||
0x65,0x63,0x34,0x28,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,
|
||||
0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,
|
||||
0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
struct draw_text_fs_params
|
||||
{
|
||||
int down_sample;
|
||||
highp vec4 colour;
|
||||
};
|
||||
|
||||
uniform draw_text_fs_params _31;
|
||||
|
||||
uniform highp sampler2D draw_text_src_texture_draw_text_src_sampler;
|
||||
|
||||
in highp vec2 uv;
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
highp float alpha = texture(draw_text_src_texture_draw_text_src_sampler, uv).x;
|
||||
if (_31.down_sample == 1)
|
||||
{
|
||||
alpha = 0.25 * (((texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(-0.000244140625, -0.0009765625)).x + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(-0.000244140625, 0.0009765625)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(0.000244140625, -0.0009765625)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + vec2(0.000244140625, 0.0009765625)).x);
|
||||
}
|
||||
frag_color = vec4(_31.colour.xyz, _31.colour.w * alpha);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_fs_source_glsl300es := [940]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
||||
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
||||
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x73,
|
||||
0x74,0x72,0x75,0x63,0x74,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
|
||||
0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x69,0x6e,0x74,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,
|
||||
0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,
|
||||
0x6f,0x72,0x6d,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x5f,0x33,0x31,0x3b,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,0x70,
|
||||
0x6c,0x65,0x72,0x32,0x44,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
|
||||
0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
||||
0x72,0x3b,0x0a,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
|
||||
0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,
|
||||
0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
|
||||
0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,
|
||||
0x28,0x5f,0x33,0x31,0x2e,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
||||
0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x30,0x2e,0x32,
|
||||
0x35,0x20,0x2a,0x20,0x28,0x28,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,
|
||||
0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,
|
||||
0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,
|
||||
0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,
|
||||
0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,
|
||||
0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,
|
||||
0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,
|
||||
0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,
|
||||
0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,
|
||||
0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,
|
||||
0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x29,
|
||||
0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,
|
||||
0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,
|
||||
0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,
|
||||
0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,
|
||||
0x28,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,
|
||||
0x20,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,
|
||||
0x61,0x6c,0x70,0x68,0x61,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
static float4 gl_Position;
|
||||
static float2 uv;
|
||||
@@ -252,10 +496,487 @@ draw_text_fs_source_hlsl4 := [1257]u8 {
|
||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,
|
||||
0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float2 uv [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 v_position [[attribute(0)]];
|
||||
float2 v_texture [[attribute(1)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.uv = float2(in.v_texture.x, 1.0 - in.v_texture.y);
|
||||
out.gl_Position = float4((in.v_position * 2.0) - float2(1.0), 0.0, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_vs_source_metal_macos := [495]u8 {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,
|
||||
0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
||||
0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,
|
||||
0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,
|
||||
0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,
|
||||
0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,
|
||||
0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x69,0x6e,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x69,0x6e,0x2e,
|
||||
0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x69,0x6e,0x2e,0x76,
|
||||
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,
|
||||
0x20,0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,
|
||||
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,
|
||||
0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct draw_text_fs_params
|
||||
{
|
||||
int down_sample;
|
||||
float4 colour;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 uv [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], constant draw_text_fs_params& _31 [[buffer(0)]], texture2d<float> draw_text_src_texture [[texture(0)]], sampler draw_text_src_sampler [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float alpha = draw_text_src_texture.sample(draw_text_src_sampler, in.uv).x;
|
||||
if (_31.down_sample == 1)
|
||||
{
|
||||
alpha = 0.25 * (((draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + float2(-0.000244140625, -0.0009765625))).x + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + float2(-0.000244140625, 0.0009765625))).x) + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + float2(0.000244140625, -0.0009765625))).x) + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + float2(0.000244140625, 0.0009765625))).x);
|
||||
}
|
||||
out.frag_color = float4(_31.colour.xyz, _31.colour.w * alpha);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_fs_source_metal_macos := [1141]u8 {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x64,
|
||||
0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x64,0x6f,0x77,
|
||||
0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,
|
||||
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
|
||||
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,
|
||||
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,
|
||||
0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,
|
||||
0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,
|
||||
0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,
|
||||
0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x26,0x20,0x5f,0x33,0x31,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,
|
||||
0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x3e,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
|
||||
0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x5b,0x5b,0x74,0x65,
|
||||
0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,
|
||||
0x6c,0x65,0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,
|
||||
0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,
|
||||
0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,
|
||||
0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,
|
||||
0x70,0x68,0x61,0x20,0x3d,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
|
||||
0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x73,0x61,0x6d,0x70,
|
||||
0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,
|
||||
0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x29,
|
||||
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x31,0x2e,
|
||||
0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x3d,0x3d,0x20,0x31,
|
||||
0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x30,0x2e,0x32,0x35,0x20,0x2a,0x20,0x28,
|
||||
0x28,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x64,
|
||||
0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x72,0x2c,0x20,0x28,0x69,0x6e,0x2e,0x75,0x76,0x20,0x2b,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,
|
||||
0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,
|
||||
0x35,0x36,0x32,0x35,0x29,0x29,0x29,0x2e,0x78,0x20,0x2b,0x20,0x64,0x72,0x61,0x77,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,
|
||||
0x28,0x69,0x6e,0x2e,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,
|
||||
0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,
|
||||
0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x29,
|
||||
0x2e,0x78,0x29,0x20,0x2b,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
|
||||
0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x73,0x61,0x6d,0x70,
|
||||
0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,
|
||||
0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x28,0x69,0x6e,0x2e,0x75,0x76,
|
||||
0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,
|
||||
0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,
|
||||
0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,
|
||||
0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x75,0x72,0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x72,0x2c,0x20,0x28,0x69,0x6e,0x2e,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,
|
||||
0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,
|
||||
0x29,0x29,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x33,0x31,0x2e,0x63,0x6f,
|
||||
0x6c,0x6f,0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x33,0x31,0x2e,0x63,0x6f,
|
||||
0x6c,0x6f,0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,
|
||||
0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
diagnostic(off, derivative_uniformity);
|
||||
|
||||
var<private> uv : vec2f;
|
||||
|
||||
var<private> v_texture : vec2f;
|
||||
|
||||
var<private> v_position : vec2f;
|
||||
|
||||
var<private> gl_Position : vec4f;
|
||||
|
||||
fn main_1() {
|
||||
let x_16 : f32 = v_texture.x;
|
||||
let x_20 : f32 = v_texture.y;
|
||||
uv = vec2f(x_16, (1.0f - x_20));
|
||||
let x_31 : vec2f = v_position;
|
||||
let x_35 : vec2f = ((x_31 * 2.0f) - vec2f(1.0f, 1.0f));
|
||||
gl_Position = vec4f(x_35.x, x_35.y, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
@location(0)
|
||||
uv_1 : vec2f,
|
||||
@builtin(position)
|
||||
gl_Position : vec4f,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn main(@location(1) v_texture_param : vec2f, @location(0) v_position_param : vec2f) -> main_out {
|
||||
v_texture = v_texture_param;
|
||||
v_position = v_position_param;
|
||||
main_1();
|
||||
return main_out(uv, gl_Position);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_vs_source_wgsl := [756]u8 {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
|
||||
0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,
|
||||
0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,
|
||||
0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,
|
||||
0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,
|
||||
0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
|
||||
0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,
|
||||
0x36,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,
|
||||
0x30,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,
|
||||
0x63,0x32,0x66,0x28,0x78,0x5f,0x31,0x36,0x2c,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,
|
||||
0x2d,0x20,0x78,0x5f,0x32,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,
|
||||
0x78,0x5f,0x33,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x76,
|
||||
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
|
||||
0x20,0x78,0x5f,0x33,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,
|
||||
0x28,0x28,0x78,0x5f,0x33,0x31,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,
|
||||
0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,
|
||||
0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x33,0x35,0x2e,
|
||||
0x78,0x2c,0x20,0x78,0x5f,0x33,0x35,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,
|
||||
0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
|
||||
0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,
|
||||
0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,
|
||||
0x65,0x63,0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,
|
||||
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
|
||||
0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,
|
||||
0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,
|
||||
0x29,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,
|
||||
0x20,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x76,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,
|
||||
0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x5f,
|
||||
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,
|
||||
0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,
|
||||
0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x75,0x76,
|
||||
0x2c,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
diagnostic(off, derivative_uniformity);
|
||||
|
||||
struct draw_text_fs_params {
|
||||
/_ @offset(0) _/
|
||||
down_sample : i32,
|
||||
/_ @offset(16) _/
|
||||
colour : vec4f,
|
||||
}
|
||||
|
||||
@group(1) @binding(48) var draw_text_src_texture : texture_2d<f32>;
|
||||
|
||||
@group(1) @binding(64) var draw_text_src_sampler : sampler;
|
||||
|
||||
var<private> uv : vec2f;
|
||||
|
||||
@group(0) @binding(4) var<uniform> x_31 : draw_text_fs_params;
|
||||
|
||||
var<private> frag_color : vec4f;
|
||||
|
||||
fn main_1() {
|
||||
var alpha : f32;
|
||||
let x_22 : vec2f = uv;
|
||||
let x_24 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, x_22);
|
||||
alpha = x_24.x;
|
||||
let x_35 : i32 = x_31.down_sample;
|
||||
if ((x_35 == 1i)) {
|
||||
let x_44 : vec2f = uv;
|
||||
let x_49 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_44 + vec2f(-0.000244140625f, -0.0009765625f)));
|
||||
let x_56 : vec2f = uv;
|
||||
let x_60 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_56 + vec2f(-0.000244140625f, 0.0009765625f)));
|
||||
let x_67 : vec2f = uv;
|
||||
let x_71 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_67 + vec2f(0.000244140625f, -0.0009765625f)));
|
||||
let x_78 : vec2f = uv;
|
||||
let x_81 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_78 + vec2f(0.000244140625f, 0.0009765625f)));
|
||||
alpha = ((((x_49.x * 0.25f) + (x_60.x * 0.25f)) + (x_71.x * 0.25f)) + (x_81.x * 0.25f));
|
||||
}
|
||||
let x_90 : vec4f = x_31.colour;
|
||||
let x_91 : vec3f = vec3f(x_90.x, x_90.y, x_90.z);
|
||||
let x_95 : f32 = x_31.colour.w;
|
||||
let x_96 : f32 = alpha;
|
||||
frag_color = vec4f(x_91.x, x_91.y, x_91.z, (x_95 * x_96));
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
@location(0)
|
||||
frag_color_1 : vec4f,
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) uv_param : vec2f) -> main_out {
|
||||
uv = uv_param;
|
||||
main_1();
|
||||
return main_out(frag_color);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
draw_text_fs_source_wgsl := [1772]u8 {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
|
||||
0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,
|
||||
0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,
|
||||
0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x64,0x6f,0x77,0x6e,0x5f,
|
||||
0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x3a,0x20,0x69,0x33,0x32,0x2c,0x0a,0x20,0x20,
|
||||
0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,
|
||||
0x2f,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,
|
||||
0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,
|
||||
0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29,0x20,0x76,0x61,
|
||||
0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,
|
||||
0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,
|
||||
0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x3a,0x20,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,
|
||||
0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,
|
||||
0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x33,0x31,0x20,0x3a,0x20,0x64,0x72,0x61,
|
||||
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
|
||||
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,
|
||||
0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,
|
||||
0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3a,
|
||||
0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,
|
||||
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,
|
||||
0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2c,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,
|
||||
0x78,0x5f,0x32,0x32,0x29,0x3b,0x0a,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,
|
||||
0x20,0x78,0x5f,0x32,0x34,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,
|
||||
0x5f,0x33,0x35,0x20,0x3a,0x20,0x69,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x33,0x31,
|
||||
0x2e,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,
|
||||
0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x33,0x35,0x20,0x3d,0x3d,0x20,0x31,0x69,0x29,
|
||||
0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x34,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x39,0x20,0x3a,0x20,0x76,0x65,
|
||||
0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,
|
||||
0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2c,0x20,0x64,0x72,0x61,0x77,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
|
||||
0x2c,0x20,0x28,0x78,0x5f,0x34,0x34,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x66,0x28,
|
||||
0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,
|
||||
0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,
|
||||
0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,
|
||||
0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x30,0x20,0x3a,0x20,0x76,
|
||||
0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,
|
||||
0x6d,0x70,0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2c,0x20,0x64,0x72,0x61,0x77,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
||||
0x72,0x2c,0x20,0x28,0x78,0x5f,0x35,0x36,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,
|
||||
0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,
|
||||
0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,
|
||||
0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x31,0x20,0x3a,0x20,0x76,
|
||||
0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,
|
||||
0x6d,0x70,0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2c,0x20,0x64,0x72,0x61,0x77,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
||||
0x72,0x2c,0x20,0x28,0x78,0x5f,0x36,0x37,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,
|
||||
0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,
|
||||
0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,
|
||||
0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x31,0x20,0x3a,0x20,0x76,
|
||||
0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,
|
||||
0x6d,0x70,0x6c,0x65,0x28,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,
|
||||
0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2c,0x20,0x64,0x72,0x61,0x77,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
|
||||
0x72,0x2c,0x20,0x28,0x78,0x5f,0x37,0x38,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,
|
||||
0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,
|
||||
0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,
|
||||
0x28,0x28,0x28,0x28,0x78,0x5f,0x34,0x39,0x2e,0x78,0x20,0x2a,0x20,0x30,0x2e,0x32,
|
||||
0x35,0x66,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x36,0x30,0x2e,0x78,0x20,0x2a,0x20,
|
||||
0x30,0x2e,0x32,0x35,0x66,0x29,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x37,0x31,0x2e,
|
||||
0x78,0x20,0x2a,0x20,0x30,0x2e,0x32,0x35,0x66,0x29,0x29,0x20,0x2b,0x20,0x28,0x78,
|
||||
0x5f,0x38,0x31,0x2e,0x78,0x20,0x2a,0x20,0x30,0x2e,0x32,0x35,0x66,0x29,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x30,0x20,
|
||||
0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x33,0x31,0x2e,0x63,
|
||||
0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,
|
||||
0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,
|
||||
0x66,0x28,0x78,0x5f,0x39,0x30,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x39,0x30,0x2e,0x79,
|
||||
0x2c,0x20,0x78,0x5f,0x39,0x30,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
|
||||
0x20,0x78,0x5f,0x39,0x35,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,
|
||||
0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x6c,
|
||||
0x65,0x74,0x20,0x78,0x5f,0x39,0x36,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,
|
||||
0x61,0x6c,0x70,0x68,0x61,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x39,0x31,
|
||||
0x2e,0x78,0x2c,0x20,0x78,0x5f,0x39,0x31,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x39,0x31,
|
||||
0x2e,0x7a,0x2c,0x20,0x28,0x78,0x5f,0x39,0x35,0x20,0x2a,0x20,0x78,0x5f,0x39,0x36,
|
||||
0x29,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,
|
||||
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,
|
||||
0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,
|
||||
0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,
|
||||
0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x29,0x20,0x2d,0x3e,
|
||||
0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x75,0x76,
|
||||
0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
||||
0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc: sg.Shader_Desc
|
||||
desc.label = "draw_text_shader"
|
||||
#partial switch backend {
|
||||
case .GLCORE:
|
||||
desc.attrs[0].name = "v_position"
|
||||
desc.attrs[1].name = "v_texture"
|
||||
desc.vs.source = transmute(cstring)&draw_text_vs_source_glsl410
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&draw_text_fs_source_glsl410
|
||||
desc.fs.entry = "main"
|
||||
desc.fs.uniform_blocks[0].size = 32
|
||||
desc.fs.uniform_blocks[0].layout = .STD140
|
||||
desc.fs.uniform_blocks[0].uniforms[0].name = "_31.down_sample"
|
||||
desc.fs.uniform_blocks[0].uniforms[0].type = .INT
|
||||
desc.fs.uniform_blocks[0].uniforms[1].name = "_31.colour"
|
||||
desc.fs.uniform_blocks[0].uniforms[1].type = .FLOAT4
|
||||
desc.fs.images[0].used = true
|
||||
desc.fs.images[0].multisampled = false
|
||||
desc.fs.images[0].image_type = ._2D
|
||||
desc.fs.images[0].sample_type = .FLOAT
|
||||
desc.fs.samplers[0].used = true
|
||||
desc.fs.samplers[0].sampler_type = .FILTERING
|
||||
desc.fs.image_sampler_pairs[0].used = true
|
||||
desc.fs.image_sampler_pairs[0].image_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
case .GLES3:
|
||||
desc.attrs[0].name = "v_position"
|
||||
desc.attrs[1].name = "v_texture"
|
||||
desc.vs.source = transmute(cstring)&draw_text_vs_source_glsl300es
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&draw_text_fs_source_glsl300es
|
||||
desc.fs.entry = "main"
|
||||
desc.fs.uniform_blocks[0].size = 32
|
||||
desc.fs.uniform_blocks[0].layout = .STD140
|
||||
desc.fs.uniform_blocks[0].uniforms[0].name = "_31.down_sample"
|
||||
desc.fs.uniform_blocks[0].uniforms[0].type = .INT
|
||||
desc.fs.uniform_blocks[0].uniforms[1].name = "_31.colour"
|
||||
desc.fs.uniform_blocks[0].uniforms[1].type = .FLOAT4
|
||||
desc.fs.images[0].used = true
|
||||
desc.fs.images[0].multisampled = false
|
||||
desc.fs.images[0].image_type = ._2D
|
||||
desc.fs.images[0].sample_type = .FLOAT
|
||||
desc.fs.samplers[0].used = true
|
||||
desc.fs.samplers[0].sampler_type = .FILTERING
|
||||
desc.fs.image_sampler_pairs[0].used = true
|
||||
desc.fs.image_sampler_pairs[0].image_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
case .D3D11:
|
||||
desc.attrs[0].sem_name = "TEXCOORD"
|
||||
desc.attrs[0].sem_index = 0
|
||||
@@ -278,6 +999,38 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.fs.image_sampler_pairs[0].used = true
|
||||
desc.fs.image_sampler_pairs[0].image_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].sampler_slot = 0
|
||||
case .METAL_MACOS:
|
||||
desc.vs.source = transmute(cstring)&draw_text_vs_source_metal_macos
|
||||
desc.vs.entry = "main0"
|
||||
desc.fs.source = transmute(cstring)&draw_text_fs_source_metal_macos
|
||||
desc.fs.entry = "main0"
|
||||
desc.fs.uniform_blocks[0].size = 32
|
||||
desc.fs.uniform_blocks[0].layout = .STD140
|
||||
desc.fs.images[0].used = true
|
||||
desc.fs.images[0].multisampled = false
|
||||
desc.fs.images[0].image_type = ._2D
|
||||
desc.fs.images[0].sample_type = .FLOAT
|
||||
desc.fs.samplers[0].used = true
|
||||
desc.fs.samplers[0].sampler_type = .FILTERING
|
||||
desc.fs.image_sampler_pairs[0].used = true
|
||||
desc.fs.image_sampler_pairs[0].image_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].sampler_slot = 0
|
||||
case .WGPU:
|
||||
desc.vs.source = transmute(cstring)&draw_text_vs_source_wgsl
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&draw_text_fs_source_wgsl
|
||||
desc.fs.entry = "main"
|
||||
desc.fs.uniform_blocks[0].size = 32
|
||||
desc.fs.uniform_blocks[0].layout = .STD140
|
||||
desc.fs.images[0].used = true
|
||||
desc.fs.images[0].multisampled = false
|
||||
desc.fs.images[0].image_type = ._2D
|
||||
desc.fs.images[0].sample_type = .FLOAT
|
||||
desc.fs.samplers[0].used = true
|
||||
desc.fs.samplers[0].sampler_type = .FILTERING
|
||||
desc.fs.image_sampler_pairs[0].used = true
|
||||
desc.fs.image_sampler_pairs[0].image_slot = 0
|
||||
desc.fs.image_sampler_pairs[0].sampler_slot = 0
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx"
|
||||
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
||||
|
||||
Cmdline:
|
||||
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.odin --slang hlsl4 --format=sokol_odin --module =render_glyph
|
||||
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin --module =render_glyph
|
||||
|
||||
Overview:
|
||||
=========
|
||||
@@ -20,6 +20,123 @@ import sg "thirdparty:sokol/gfx"
|
||||
*/
|
||||
ATTR_render_glyph_vs_v_position :: 0
|
||||
ATTR_render_glyph_vs_v_texture :: 1
|
||||
/*
|
||||
#version 410
|
||||
|
||||
layout(location = 0) out vec2 uv;
|
||||
layout(location = 1) in vec2 v_texture;
|
||||
layout(location = 0) in vec2 v_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = vec2(v_texture.x, 1.0 - v_texture.y);
|
||||
gl_Position = vec4(v_position, 0.0, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_vs_source_glsl410 := [241]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
|
||||
0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,
|
||||
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x76,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,
|
||||
0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
}
|
||||
/*
|
||||
#version 410
|
||||
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
layout(location = 0) in vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = vec4(1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_fs_source_glsl410 := [136]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
|
||||
0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,
|
||||
0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#version 300 es
|
||||
|
||||
out vec2 uv;
|
||||
layout(location = 1) in vec2 v_texture;
|
||||
layout(location = 0) in vec2 v_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = vec2(v_texture.x, 1.0 - v_texture.y);
|
||||
gl_Position = vec4(v_position, 0.0, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_vs_source_glsl300es := [223]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,
|
||||
0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x76,0x5f,0x74,0x65,
|
||||
0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x76,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,
|
||||
0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,
|
||||
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
in highp vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = vec4(1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_fs_source_glsl300es := [176]u8 {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
||||
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
||||
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c,
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,
|
||||
0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,
|
||||
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
|
||||
0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
|
||||
}
|
||||
/*
|
||||
static float4 gl_Position;
|
||||
static float2 uv;
|
||||
@@ -161,10 +278,255 @@ render_glyph_fs_source_hlsl4 := [427]u8 {
|
||||
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
|
||||
0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float2 uv [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 v_position [[attribute(0)]];
|
||||
float2 v_texture [[attribute(1)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.uv = float2(in.v_texture.x, 1.0 - in.v_texture.y);
|
||||
out.gl_Position = float4(in.v_position, 0.0, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_vs_source_metal_macos := [473]u8 {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,
|
||||
0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
|
||||
0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,
|
||||
0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,
|
||||
0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,
|
||||
0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,
|
||||
0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x69,0x6e,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x69,0x6e,0x2e,
|
||||
0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x76,0x5f,
|
||||
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,
|
||||
0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
|
||||
0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
out.frag_color = float4(1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_fs_source_metal_macos := [238]u8 {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,
|
||||
0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
|
||||
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
|
||||
0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
diagnostic(off, derivative_uniformity);
|
||||
|
||||
var<private> uv : vec2f;
|
||||
|
||||
var<private> v_texture : vec2f;
|
||||
|
||||
var<private> v_position : vec2f;
|
||||
|
||||
var<private> gl_Position : vec4f;
|
||||
|
||||
fn main_1() {
|
||||
let x_16 : f32 = v_texture.x;
|
||||
let x_20 : f32 = v_texture.y;
|
||||
uv = vec2f(x_16, (1.0f - x_20));
|
||||
let x_31 : vec2f = v_position;
|
||||
gl_Position = vec4f(x_31.x, x_31.y, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
@location(0)
|
||||
uv_1 : vec2f,
|
||||
@builtin(position)
|
||||
gl_Position : vec4f,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn main(@location(1) v_texture_param : vec2f, @location(0) v_position_param : vec2f) -> main_out {
|
||||
v_texture = v_texture_param;
|
||||
v_position = v_position_param;
|
||||
main_1();
|
||||
return main_out(uv, gl_Position);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_vs_source_wgsl := [698]u8 {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
|
||||
0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
|
||||
0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,
|
||||
0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,
|
||||
0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,
|
||||
0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,
|
||||
0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
|
||||
0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,
|
||||
0x36,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,
|
||||
0x30,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,
|
||||
0x63,0x32,0x66,0x28,0x78,0x5f,0x31,0x36,0x2c,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,
|
||||
0x2d,0x20,0x78,0x5f,0x32,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,
|
||||
0x78,0x5f,0x33,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x76,
|
||||
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,
|
||||
0x28,0x78,0x5f,0x33,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x31,0x2e,0x79,0x2c,
|
||||
0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,
|
||||
0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76,
|
||||
0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x62,
|
||||
0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,
|
||||
0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
|
||||
0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,
|
||||
0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,
|
||||
0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x76,0x5f,
|
||||
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,
|
||||
0x20,0x76,0x65,0x63,0x32,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,
|
||||
0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,
|
||||
0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,
|
||||
0x6f,0x75,0x74,0x28,0x75,0x76,0x2c,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
|
||||
0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
/*
|
||||
diagnostic(off, derivative_uniformity);
|
||||
|
||||
var<private> frag_color : vec4f;
|
||||
|
||||
var<private> uv : vec2f;
|
||||
|
||||
fn main_1() {
|
||||
frag_color = vec4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
@location(0)
|
||||
frag_color_1 : vec4f,
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) uv_param : vec2f) -> main_out {
|
||||
uv = uv_param;
|
||||
main_1();
|
||||
return main_out(frag_color);
|
||||
}
|
||||
|
||||
*/
|
||||
@(private)
|
||||
render_glyph_fs_source_wgsl := [361]u8 {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,
|
||||
0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,
|
||||
0x32,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,
|
||||
0x20,0x7b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,
|
||||
0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,
|
||||
0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,
|
||||
0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,
|
||||
0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,
|
||||
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,
|
||||
0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,
|
||||
0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,
|
||||
0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
}
|
||||
render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc: sg.Shader_Desc
|
||||
desc.label = "render_glyph_shader"
|
||||
#partial switch backend {
|
||||
case .GLCORE:
|
||||
desc.attrs[0].name = "v_position"
|
||||
desc.attrs[1].name = "v_texture"
|
||||
desc.vs.source = transmute(cstring)&render_glyph_vs_source_glsl410
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&render_glyph_fs_source_glsl410
|
||||
desc.fs.entry = "main"
|
||||
case .GLES3:
|
||||
desc.attrs[0].name = "v_position"
|
||||
desc.attrs[1].name = "v_texture"
|
||||
desc.vs.source = transmute(cstring)&render_glyph_vs_source_glsl300es
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&render_glyph_fs_source_glsl300es
|
||||
desc.fs.entry = "main"
|
||||
case .D3D11:
|
||||
desc.attrs[0].sem_name = "TEXCOORD"
|
||||
desc.attrs[0].sem_index = 0
|
||||
@@ -176,6 +538,16 @@ render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.fs.source = transmute(cstring)&render_glyph_fs_source_hlsl4
|
||||
desc.fs.d3d11_target = "ps_4_0"
|
||||
desc.fs.entry = "main"
|
||||
case .METAL_MACOS:
|
||||
desc.vs.source = transmute(cstring)&render_glyph_vs_source_metal_macos
|
||||
desc.vs.entry = "main0"
|
||||
desc.fs.source = transmute(cstring)&render_glyph_fs_source_metal_macos
|
||||
desc.fs.entry = "main0"
|
||||
case .WGPU:
|
||||
desc.vs.source = transmute(cstring)&render_glyph_vs_source_wgsl
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&render_glyph_fs_source_wgsl
|
||||
desc.fs.entry = "main"
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@@ -50,8 +50,6 @@ Font_Load_Gen_ID :: ""
|
||||
// Working directory assumed to be the build folder
|
||||
Path_Fonts :: "../fonts/"
|
||||
|
||||
Screen_Size : [2]f32 : { 1600, 900 }
|
||||
|
||||
FontID :: struct {
|
||||
label : string,
|
||||
}
|
||||
@@ -68,6 +66,8 @@ Demo_Context :: struct {
|
||||
font_ids : map[string]FontDef,
|
||||
|
||||
font_firacode : FontID,
|
||||
|
||||
screen_size : [2]f32
|
||||
}
|
||||
|
||||
demo_ctx : Demo_Context
|
||||
@@ -135,7 +135,7 @@ measure_text_size :: proc( text : string, font : FontID, font_size := Font_Use_D
|
||||
return measured
|
||||
}
|
||||
|
||||
get_font_vertical_metrics :: #force_inline proc ( font : FontID, font_size := Font_Use_Default_Size ) -> ( ascent, descent, line_gap : f32 )
|
||||
get_font_vertical_metrics :: #force_inline proc ( font : FontID, font_size := Font_Use_Default_Size ) -> ( ascent, descent, line_gap : f32 )
|
||||
{
|
||||
ve_id, size := font_provider_resolve_draw_id( font, font_size )
|
||||
ascent, descent, line_gap = ve.get_font_vertical_metrics( & demo_ctx.ve_ctx, ve_id )
|
||||
@@ -145,8 +145,8 @@ get_font_vertical_metrics :: #force_inline proc ( font : FontID, font_size := Fo
|
||||
// Draw text using a string and normalized render coordinates
|
||||
draw_text_string_pos_norm :: proc( content : string, id : FontID, size : f32, pos : Vec2, color := Color_White, scale : f32 = 1.0 )
|
||||
{
|
||||
width :: Screen_Size.x
|
||||
height :: Screen_Size.y
|
||||
width := demo_ctx.screen_size.x
|
||||
height := demo_ctx.screen_size.y
|
||||
|
||||
ve_id, resolved_size := font_provider_resolve_draw_id( id, size )
|
||||
color_norm := normalize_rgba8(color)
|
||||
@@ -157,10 +157,9 @@ draw_text_string_pos_norm :: proc( content : string, id : FontID, size : f32, po
|
||||
}
|
||||
|
||||
// Draw text using a string and extent-based screen coordinates
|
||||
draw_text_string_pos_extent :: proc( content : string, id : FontID, size : f32, pos : Vec2, color := Color_White )
|
||||
{
|
||||
render_pos := pos + Screen_Size * 0.5
|
||||
normalized_pos := render_pos * (1.0 / Screen_Size)
|
||||
draw_text_string_pos_extent :: proc( content : string, id : FontID, size : f32, pos : Vec2, color := Color_White ) {
|
||||
render_pos := pos + demo_ctx.screen_size * 0.5
|
||||
normalized_pos := render_pos * (1.0 / demo_ctx.screen_size)
|
||||
draw_text_string_pos_norm( content, id, size, normalized_pos, color )
|
||||
}
|
||||
|
||||
@@ -233,13 +232,14 @@ frame :: proc "c" ()
|
||||
{
|
||||
context = runtime.default_context()
|
||||
|
||||
demo_ctx.screen_size = { app.widthf(), app.heightf() }
|
||||
|
||||
pass_action : gfx.Pass_Action;
|
||||
pass_action.colors[0] = { load_action = .CLEAR, clear_value = { 0.18 * 0.18, 0.204 * 0.204, 0.251 * 0.251, 1.0 } }
|
||||
gfx.begin_pass({ action = pass_action, swapchain = glue.swapchain() })
|
||||
gfx.end_pass()
|
||||
{
|
||||
ve.configure_snap( & demo_ctx.ve_ctx, u32(Screen_Size.x), u32(Screen_Size.y) )
|
||||
|
||||
ve.configure_snap( & demo_ctx.ve_ctx, u32(demo_ctx.screen_size.x), u32(demo_ctx.screen_size.y) )
|
||||
ve.set_colour( & demo_ctx.ve_ctx, ve.Colour { 1.0, 1.0, 1.0, 1.0 })
|
||||
|
||||
ve_id, size := font_provider_resolve_draw_id( demo_ctx.font_firacode, 100 )
|
||||
@@ -248,32 +248,34 @@ frame :: proc "c" ()
|
||||
ve_id,
|
||||
"Hello VE FONT CACHE???",
|
||||
Vec2{0.1, 0.1},
|
||||
Vec2{1 / Screen_Size.x, 1 / Screen_Size.y }
|
||||
Vec2{1 / demo_ctx.screen_size.x, 1 / demo_ctx.screen_size.y }
|
||||
)
|
||||
|
||||
draw_text_string_pos_extent( "Hello VEFontCache!", demo_ctx.font_firacode, 48, {0, 0}, Color_White )
|
||||
draw_text_string_pos_norm( "Hello VEFontCache!", demo_ctx.font_firacode, 24, {0, 0}, Color_White )
|
||||
|
||||
ve_sokol.render_text_layer( Screen_Size * 0.5, & demo_ctx.ve_ctx, demo_ctx.render_ctx )
|
||||
ve_sokol.render_text_layer( demo_ctx.screen_size * 0.5, & demo_ctx.ve_ctx, demo_ctx.render_ctx )
|
||||
}
|
||||
gfx.commit()
|
||||
ve.flush_draw_list( & demo_ctx.ve_ctx )
|
||||
}
|
||||
|
||||
cleanup :: proc "c" ()
|
||||
{
|
||||
cleanup :: proc "c" () {
|
||||
context = runtime.default_context()
|
||||
ve.shutdown( & demo_ctx.ve_ctx )
|
||||
gfx.shutdown()
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
main :: proc()
|
||||
{
|
||||
demo_ctx.screen_size = Vec2 { 1600, 900 }
|
||||
|
||||
app.run({
|
||||
init_cb = init,
|
||||
frame_cb = frame,
|
||||
cleanup_cb = cleanup,
|
||||
width = i32(Screen_Size.x),
|
||||
height = i32(Screen_Size.y),
|
||||
width = i32(demo_ctx.screen_size.x),
|
||||
height = i32(demo_ctx.screen_size.y),
|
||||
window_title = "VEFonCache: Sokol Backend Demo",
|
||||
icon = { sokol_default = true },
|
||||
logger = { func = slog.func },
|
||||
|
Reference in New Issue
Block a user