7 Commits
dev ... main

87 changed files with 5103 additions and 4269 deletions

2
.gitignore vendored
View File

@@ -4,3 +4,5 @@ build
# thirdparty/harfbuzz
# thirdparty/sokol
# thirdparty/sokol-tools
vefontcache.proj
vefontcache.user

View File

@@ -39,11 +39,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
Blend_State :: gfx.Blend_State
Border_Color :: gfx.Border_Color
Buffer_Desciption :: gfx.Buffer_Desc
Buffer_Usage :: gfx.Usage
Buffer_Type :: gfx.Buffer_Type
Buffer_Usage :: gfx.Buffer_Usage
Color_Target_State :: gfx.Color_Target_State
Filter :: gfx.Filter
Image_Desc :: gfx.Image_Desc
Image_Usage :: gfx.Image_Usage
Pass_Action :: gfx.Pass_Action
Range :: gfx.Range
Resource_State :: gfx.Resource_State
@@ -65,15 +65,13 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
ctx.draw_list_vbuf = gfx.make_buffer( Buffer_Desciption {
size = cast(uint)(size_of([4]f32) * vert_cap),
usage = Buffer_Usage.STREAM,
type = Buffer_Type.VERTEXBUFFER,
usage = Buffer_Usage { vertex_buffer = true, stream_update = true, immutable = false },
})
assert( gfx.query_buffer_state( ctx.draw_list_vbuf) < Resource_State.FAILED, "Failed to make draw_list_vbuf" )
ctx.draw_list_ibuf = gfx.make_buffer( Buffer_Desciption {
size = cast(uint)(size_of(u32) * index_cap),
usage = Buffer_Usage.STREAM,
type = Buffer_Type.INDEXBUFFER,
usage = { index_buffer = true, stream_update = true, immutable = false },
})
assert( gfx.query_buffer_state( ctx.draw_list_ibuf) < Resource_State.FAILED, "Failed to make draw_list_iubuf" )
@@ -136,12 +134,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
{
ctx.glyph_rt_color = gfx.make_image( Image_Desc {
type = ._2D,
render_target = true,
usage = Image_Usage { render_attachment = true, immutable = true },
width = i32(ve_ctx.glyph_buffer.size.x),
height = i32(ve_ctx.glyph_buffer.size.y),
num_slices = 1,
num_mipmaps = 1,
usage = .IMMUTABLE,
pixel_format = .R8,
sample_count = 1,
})
@@ -149,12 +146,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
ctx.glyph_rt_depth = gfx.make_image( Image_Desc {
type = ._2D,
render_target = true,
usage = Image_Usage { render_attachment = true, immutable = true },
width = i32(ve_ctx.glyph_buffer.size.x),
height = i32(ve_ctx.glyph_buffer.size.y),
num_slices = 1,
num_mipmaps = 1,
usage = .IMMUTABLE,
pixel_format = .DEPTH,
sample_count = 1,
})
@@ -270,12 +266,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
{
ctx.atlas_rt_color = gfx.make_image( Image_Desc {
type = ._2D,
render_target = true,
usage = { render_attachment = true, immutable = true },
width = i32(ve_ctx.atlas.size.x),
height = i32(ve_ctx.atlas.size.y),
num_slices = 1,
num_mipmaps = 1,
usage = .IMMUTABLE,
pixel_format = .R8,
sample_count = 1,
// TODO(Ed): Setup labels for debug tracing/logging
@@ -285,12 +280,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
ctx.atlas_rt_depth = gfx.make_image( Image_Desc {
type = ._2D,
render_target = true,
usage = { render_attachment = true, immutable = true },
width = i32(ve_ctx.atlas.size.x),
height = i32(ve_ctx.atlas.size.y),
num_slices = 1,
num_mipmaps = 1,
usage = .IMMUTABLE,
pixel_format = .DEPTH,
sample_count = 1,
})

File diff suppressed because it is too large Load Diff

View File

@@ -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 glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin
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
Overview:
=========
@@ -87,12 +87,12 @@ draw_text_vs_source_glsl410 := [255]u8 {
void main()
{
frag_color = vec4(draw_text_fs_params[1].xyz, draw_text_fs_params[1].w * ((1.0 / draw_text_fs_params[0].z) * (((texture(draw_text_src_texture_draw_text_src_sampler, fma(vec2(-0.5), draw_text_fs_params[0].xy, uv)).x + texture(draw_text_src_texture_draw_text_src_sampler, fma(vec2(-0.5, 0.5), draw_text_fs_params[0].xy, uv)).x) + texture(draw_text_src_texture_draw_text_src_sampler, fma(vec2(0.5, -0.5), draw_text_fs_params[0].xy, uv)).x) + texture(draw_text_src_texture_draw_text_src_sampler, fma(vec2(0.5), draw_text_fs_params[0].xy, uv)).x)));
frag_color = vec4(draw_text_fs_params[1].xyz, draw_text_fs_params[1].w * ((1.0 / draw_text_fs_params[0].z) * (((texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(-0.5) * draw_text_fs_params[0].xy)).x + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(-0.5, 0.5) * draw_text_fs_params[0].xy)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(0.5, -0.5) * draw_text_fs_params[0].xy)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(0.5) * draw_text_fs_params[0].xy)).x)));
}
*/
@(private="file")
draw_text_fs_source_glsl410 := [758]u8 {
draw_text_fs_source_glsl410 := [754]u8 {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x64,0x72,0x61,0x77,0x5f,
0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,
@@ -116,31 +116,31 @@ draw_text_fs_source_glsl410 := [758]u8 {
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,0x66,0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28,0x2d,
0x30,0x2e,0x35,0x29,0x2c,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x2c,
0x20,0x75,0x76,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,0x66,
0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x35,0x2c,0x20,0x30,0x2e,
0x35,0x29,0x2c,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x2c,0x20,0x75,
0x76,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,
0x28,0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,
0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,
0x78,0x79,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,0x66,0x6d,
0x61,0x28,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,
0x29,0x2c,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x2c,0x20,0x75,0x76,
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,0x66,0x6d,0x61,
0x28,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x2c,0x20,0x64,0x72,0x61,0x77,
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,
0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x35,0x2c,0x20,0x30,
0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,
0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,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,0x28,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,
0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,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,0x28,
0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,
0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2e,0x78,0x79,0x2c,0x20,0x75,0x76,0x29,0x29,0x2e,0x78,0x29,0x29,0x29,
0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x30,0x5d,0x2e,0x78,0x79,0x29,0x29,0x2e,0x78,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
}
/*
#version 300 es
@@ -187,12 +187,12 @@ draw_text_vs_source_glsl300es := [237]u8 {
void main()
{
frag_color = vec4(draw_text_fs_params[1].xyz, draw_text_fs_params[1].w * ((1.0 / draw_text_fs_params[0].z) * (((texture(draw_text_src_texture_draw_text_src_sampler, vec2(-0.5) * draw_text_fs_params[0].xy + uv).x + texture(draw_text_src_texture_draw_text_src_sampler, vec2(-0.5, 0.5) * draw_text_fs_params[0].xy + uv).x) + texture(draw_text_src_texture_draw_text_src_sampler, vec2(0.5, -0.5) * draw_text_fs_params[0].xy + uv).x) + texture(draw_text_src_texture_draw_text_src_sampler, vec2(0.5) * draw_text_fs_params[0].xy + uv).x)));
frag_color = vec4(draw_text_fs_params[1].xyz, draw_text_fs_params[1].w * ((1.0 / draw_text_fs_params[0].z) * (((texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(-0.5) * draw_text_fs_params[0].xy)).x + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(-0.5, 0.5) * draw_text_fs_params[0].xy)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(0.5, -0.5) * draw_text_fs_params[0].xy)).x) + texture(draw_text_src_texture_draw_text_src_sampler, uv + (vec2(0.5) * draw_text_fs_params[0].xy)).x)));
}
*/
@(private="file")
draw_text_fs_source_glsl300es := [798]u8 {
draw_text_fs_source_glsl300es := [806]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,
@@ -219,30 +219,31 @@ draw_text_fs_source_glsl300es := [798]u8 {
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,0x76,0x65,0x63,0x32,0x28,0x2d,
0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,
0x20,0x2b,0x20,0x75,0x76,0x29,0x2e,0x78,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,
0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x28,
0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,
0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x30,0x5d,0x2e,0x78,0x79,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,0x28,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,
0x35,0x2c,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,
0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,
0x2e,0x78,0x79,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,
0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x35,0x2c,0x20,0x30,0x2e,0x35,0x29,0x20,
0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x20,0x2b,0x20,0x75,0x76,
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,0x76,0x65,0x63,0x32,
0x28,0x30,0x2e,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,
0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x20,0x2b,0x20,0x75,0x76,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,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,
0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x20,0x2b,0x20,
0x75,0x76,0x29,0x2e,0x78,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x75,0x76,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x2c,0x20,
0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,
0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,
0x79,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,0x28,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,
0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x29,0x29,0x2e,0x78,0x29,0x29,0x29,
0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
}
/*
static float4 gl_Position;
@@ -354,7 +355,7 @@ draw_text_vs_source_hlsl4 := [724]u8 {
void frag_main()
{
frag_color = float4(_32_colour.xyz, _32_colour.w * ((1.0f / _32_over_sample) * (((draw_text_src_texture.Sample(draw_text_src_sampler, mad((-0.5f).xx, _32_glyph_buffer_size, uv)).x + draw_text_src_texture.Sample(draw_text_src_sampler, mad(float2(-0.5f, 0.5f), _32_glyph_buffer_size, uv)).x) + draw_text_src_texture.Sample(draw_text_src_sampler, mad(float2(0.5f, -0.5f), _32_glyph_buffer_size, uv)).x) + draw_text_src_texture.Sample(draw_text_src_sampler, mad(0.5f.xx, _32_glyph_buffer_size, uv)).x)));
frag_color = float4(_32_colour.xyz, _32_colour.w * ((1.0f / _32_over_sample) * (((draw_text_src_texture.Sample(draw_text_src_sampler, uv + ((-0.5f).xx * _32_glyph_buffer_size)).x + draw_text_src_texture.Sample(draw_text_src_sampler, uv + (float2(-0.5f, 0.5f) * _32_glyph_buffer_size)).x) + draw_text_src_texture.Sample(draw_text_src_sampler, uv + (float2(0.5f, -0.5f) * _32_glyph_buffer_size)).x) + draw_text_src_texture.Sample(draw_text_src_sampler, uv + (0.5f.xx * _32_glyph_buffer_size)).x)));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
@@ -367,7 +368,7 @@ draw_text_vs_source_hlsl4 := [724]u8 {
}
*/
@(private="file")
draw_text_fs_source_hlsl4 := [1198]u8 {
draw_text_fs_source_hlsl4 := [1194]u8 {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,
0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a,0x20,0x72,0x65,
0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
@@ -406,43 +407,43 @@ draw_text_fs_source_hlsl4 := [1198]u8 {
0x70,0x6c,0x65,0x29,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,
0x53,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,0x6d,0x61,
0x64,0x28,0x28,0x2d,0x30,0x2e,0x35,0x66,0x29,0x2e,0x78,0x78,0x2c,0x20,0x5f,0x33,
0x32,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,
0x69,0x7a,0x65,0x2c,0x20,0x75,0x76,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,0x53,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,0x6d,0x61,0x64,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,
0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,0x66,0x29,0x2c,0x20,0x5f,0x33,0x32,0x5f,0x67,
0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,
0x2c,0x20,0x75,0x76,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,0x53,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,
0x6d,0x61,0x64,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x66,0x2c,
0x20,0x2d,0x30,0x2e,0x35,0x66,0x29,0x2c,0x20,0x5f,0x33,0x32,0x5f,0x67,0x6c,0x79,
0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,
0x75,0x76,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,
0x20,0x2b,0x20,0x28,0x28,0x2d,0x30,0x2e,0x35,0x66,0x29,0x2e,0x78,0x78,0x20,0x2a,
0x20,0x5f,0x33,0x32,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,
0x72,0x5f,0x73,0x69,0x7a,0x65,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,0x53,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,0x75,0x76,0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,
0x2e,0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,
0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,
0x7a,0x65,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,
0x53,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,0x6d,0x61,
0x64,0x28,0x30,0x2e,0x35,0x66,0x2e,0x78,0x78,0x2c,0x20,0x5f,0x33,0x32,0x5f,0x67,
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,
0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x66,0x2c,
0x20,0x2d,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x5f,0x67,0x6c,
0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,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,0x53,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,0x75,0x76,0x20,0x2b,0x20,
0x28,0x30,0x2e,0x35,0x66,0x2e,0x78,0x78,0x20,0x2a,0x20,0x5f,0x33,0x32,0x5f,0x67,
0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,
0x2c,0x20,0x75,0x76,0x29,0x29,0x2e,0x78,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,
0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,
0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,
0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x3b,0x0a,0x20,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,
0x29,0x29,0x2e,0x78,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,
0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,
0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,
0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,
0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,
0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,
0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,
0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,
0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,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>
@@ -531,13 +532,13 @@ draw_text_vs_source_metal_macos := [495]u8 {
fragment main0_out main0(main0_in in [[stage_in]], constant draw_text_fs_params& _32 [[buffer(0)]], texture2d<float> draw_text_src_texture [[texture(0)]], sampler draw_text_src_sampler [[sampler(0)]])
{
main0_out out = {};
out.frag_color = float4(_32.colour.xyz, _32.colour.w * ((1.0 / _32.over_sample) * (((draw_text_src_texture.sample(draw_text_src_sampler, fma(float2(-0.5), _32.glyph_buffer_size, in.uv)).x + draw_text_src_texture.sample(draw_text_src_sampler, fma(float2(-0.5, 0.5), _32.glyph_buffer_size, in.uv)).x) + draw_text_src_texture.sample(draw_text_src_sampler, fma(float2(0.5, -0.5), _32.glyph_buffer_size, in.uv)).x) + draw_text_src_texture.sample(draw_text_src_sampler, fma(float2(0.5), _32.glyph_buffer_size, in.uv)).x)));
out.frag_color = float4(_32.colour.xyz, _32.colour.w * ((1.0 / _32.over_sample) * (((draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + (float2(-0.5) * _32.glyph_buffer_size))).x + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + (float2(-0.5, 0.5) * _32.glyph_buffer_size))).x) + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + (float2(0.5, -0.5) * _32.glyph_buffer_size))).x) + draw_text_src_texture.sample(draw_text_src_sampler, (in.uv + (float2(0.5) * _32.glyph_buffer_size))).x)));
return out;
}
*/
@(private="file")
draw_text_fs_source_metal_macos := [1058]u8 {
draw_text_fs_source_metal_macos := [1062]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,
@@ -579,32 +580,32 @@ draw_text_fs_source_metal_macos := [1058]u8 {
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,0x66,0x6d,0x61,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x35,
0x29,0x2c,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,
0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,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,0x66,0x6d,0x61,0x28,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x35,0x2c,0x20,0x30,0x2e,0x35,0x29,0x2c,
0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,
0x72,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,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,0x66,0x6d,0x61,0x28,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,0x29,0x2c,0x20,
0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,
0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,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,0x66,0x6d,0x61,0x28,0x66,0x6c,0x6f,0x61,
0x74,0x32,0x28,0x30,0x2e,0x35,0x29,0x2c,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,
0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,
0x69,0x6e,0x2e,0x75,0x76,0x29,0x29,0x2e,0x78,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
0x20,0x28,0x69,0x6e,0x2e,0x75,0x76,0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,
0x32,0x28,0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,
0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,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,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x35,
0x2c,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,
0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,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,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x2c,
0x20,0x2d,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,
0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,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,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,
0x20,0x2a,0x20,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,
0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,0x29,0x29,0x29,0x2e,0x78,0x29,0x29,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);
@@ -618,11 +619,8 @@ draw_text_fs_source_metal_macos := [1058]u8 {
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));
uv = vec2f(v_texture.x, (1.0f - v_texture.y));
let x_35 = ((v_position * 2.0f) - vec2f(1.0f));
gl_Position = vec4f(x_35.x, x_35.y, 0.0f, 1.0f);
return;
}
@@ -641,10 +639,9 @@ draw_text_fs_source_metal_macos := [1058]u8 {
main_1();
return main_out(uv, gl_Position);
}
*/
@(private="file")
draw_text_vs_source_wgsl := [756]u8 {
draw_text_vs_source_wgsl := [664]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,
@@ -656,43 +653,37 @@ draw_text_vs_source_wgsl := [756]u8 {
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,
0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,
0x63,0x32,0x66,0x28,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,
0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,
0x72,0x65,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
0x33,0x35,0x20,0x3d,0x20,0x28,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,
0x66,0x28,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,0x00,
}
/*
diagnostic(off, derivative_uniformity);
@@ -706,13 +697,13 @@ draw_text_vs_source_wgsl := [756]u8 {
colour : vec4f,
}
@group(1) @binding(64) var draw_text_src_texture : texture_2d<f32>;
@binding(64) @group(1) var draw_text_src_texture : texture_2d<f32>;
@group(1) @binding(80) var draw_text_src_sampler : sampler;
@binding(80) @group(1) var draw_text_src_sampler : sampler;
var<private> uv : vec2f;
@group(0) @binding(8) var<uniform> x_32 : draw_text_fs_params;
@binding(8) @group(0) var<uniform> x_32 : draw_text_fs_params;
var<private> frag_color : vec4f;
@@ -720,35 +711,29 @@ draw_text_vs_source_wgsl := [756]u8 {
var alpha : f32;
var texture_size : vec2f;
var down_sample : f32;
let x_22 : vec2f = uv;
let x_24 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, x_22);
let x_22 = uv;
let x_24 = textureSample(draw_text_src_texture, draw_text_src_sampler, x_22);
alpha = x_24.x;
let x_37 : vec2f = x_32.glyph_buffer_size;
texture_size = x_37;
let x_43 : f32 = x_32.over_sample;
down_sample = (1.0f / x_43);
let x_48 : vec2f = uv;
let x_51 : vec2f = texture_size;
let x_54 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_48 + (vec2f(-0.5f, -0.5f) * x_51)));
let x_56 : f32 = down_sample;
let x_61 : vec2f = uv;
let x_64 : vec2f = texture_size;
let x_67 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_61 + (vec2f(-0.5f, 0.5f) * x_64)));
let x_69 : f32 = down_sample;
let x_75 : vec2f = uv;
let x_77 : vec2f = texture_size;
let x_80 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_75 + (vec2f(0.5f, -0.5f) * x_77)));
let x_82 : f32 = down_sample;
let x_88 : vec2f = uv;
let x_90 : vec2f = texture_size;
let x_93 : vec4f = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_88 + (vec2f(0.5f, 0.5f) * x_90)));
let x_95 : f32 = down_sample;
alpha = ((((x_54.x * x_56) + (x_67.x * x_69)) + (x_80.x * x_82)) + (x_93.x * x_95));
let x_104 : vec4f = x_32.colour;
let x_105 : vec3f = vec3f(x_104.x, x_104.y, x_104.z);
let x_108 : f32 = x_32.colour.w;
let x_109 : f32 = alpha;
frag_color = vec4f(x_105.x, x_105.y, x_105.z, (x_108 * x_109));
texture_size = x_32.glyph_buffer_size;
down_sample = (1.0f / x_32.over_sample);
let x_48 = uv;
let x_51 = texture_size;
let x_54 = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_48 + (vec2f(-0.5f) * x_51)));
let x_56 = down_sample;
let x_61 = uv;
let x_64 = texture_size;
let x_67 = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_61 + (vec2f(-0.5f, 0.5f) * x_64)));
let x_69 = down_sample;
let x_75 = uv;
let x_77 = texture_size;
let x_80 = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_75 + (vec2f(0.5f, -0.5f) * x_77)));
let x_82 = down_sample;
let x_88 = uv;
let x_90 = texture_size;
let x_93 = textureSample(draw_text_src_texture, draw_text_src_sampler, (x_88 + (vec2f(0.5f) * x_90)));
alpha = ((((x_54.x * x_56) + (x_67.x * x_69)) + (x_80.x * x_82)) + (x_93.x * down_sample));
let x_105 = x_32.colour.xyz;
frag_color = vec4f(x_105.x, x_105.y, x_105.z, (x_32.colour.w * alpha));
return;
}
@@ -763,10 +748,9 @@ draw_text_vs_source_wgsl := [756]u8 {
main_1();
return main_out(frag_color);
}
*/
@(private="file")
draw_text_fs_source_wgsl := [2160]u8 {
draw_text_fs_source_wgsl := [1825]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,
@@ -779,18 +763,18 @@ draw_text_fs_source_wgsl := [2160]u8 {
0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x3a,0x20,0x66,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,0x36,0x34,0x29,0x20,0x76,0x61,
0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,
0x36,0x34,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,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,0x38,
0x30,0x29,0x20,0x76,0x61,0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,
0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,
0x31,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,0x38,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,
0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38,0x29,0x20,0x40,
0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,
0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x33,0x32,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,
@@ -801,108 +785,87 @@ draw_text_fs_source_wgsl := [2160]u8 {
0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,
0x70,0x6c,0x65,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,
0x20,0x78,0x5f,0x32,0x32,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,
0x74,0x20,0x78,0x5f,0x32,0x34,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,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,
0x20,0x3d,0x20,0x78,0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,
0x66,0x66,0x65,0x72,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,
0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x20,0x3d,0x20,0x78,0x5f,0x33,0x37,
0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x33,0x20,0x3a,0x20,0x66,
0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x33,0x32,0x2e,0x6f,0x76,0x65,0x72,0x5f,0x73,
0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x20,0x3d,0x20,0x78,
0x5f,0x33,0x32,0x2e,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x75,0x66,0x66,0x65,0x72,
0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,
0x6d,0x70,0x6c,0x65,0x20,0x3d,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2f,0x20,0x78,
0x5f,0x34,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x38,
0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,
0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,
0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x34,0x20,0x3a,0x20,0x76,
0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,
0x5f,0x33,0x32,0x2e,0x6f,0x76,0x65,0x72,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x29,
0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x38,0x20,0x3d,0x20,0x75,
0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x31,0x20,0x3d,0x20,
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,
0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x34,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,0x38,0x20,0x2b,0x20,0x28,
0x76,0x65,0x63,0x32,0x66,0x28,0x2d,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x78,
0x5f,0x35,0x31,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
0x35,0x36,0x20,0x3d,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x31,0x20,0x3d,0x20,0x75,
0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x34,0x20,0x3d,0x20,
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,
0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x37,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,0x31,0x20,0x2b,0x20,0x28,
0x76,0x65,0x63,0x32,0x66,0x28,0x2d,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,
0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x36,0x34,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,
0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x39,0x20,0x3d,0x20,0x64,0x6f,0x77,0x6e,0x5f,
0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
0x37,0x35,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,
0x5f,0x37,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,
0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x30,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,0x35,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,0x66,0x28,0x30,0x2e,0x35,0x66,
0x2c,0x20,0x2d,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x37,0x37,0x29,
0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x32,0x20,0x3d,
0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,
0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x38,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x30,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,
0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,
0x78,0x5f,0x39,0x33,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,0x38,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,
0x66,0x28,0x2d,0x30,0x2e,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x35,0x66,0x29,0x20,
0x2a,0x20,0x78,0x5f,0x35,0x31,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
0x20,0x78,0x5f,0x35,0x36,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x64,0x6f,
0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
0x20,0x78,0x5f,0x36,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,
0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x34,0x20,0x3a,
0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,
0x37,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,0x31,0x20,0x2b,0x20,
0x28,0x76,0x65,0x63,0x32,0x66,0x28,0x2d,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30,0x2e,
0x35,0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x36,0x34,0x29,0x29,0x29,0x3b,0x0a,0x20,
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x39,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,
0x3d,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,
0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
0x37,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,
0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
0x20,0x78,0x5f,0x38,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,0x37,
0x35,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,0x66,0x28,0x30,0x2e,0x35,0x66,0x2c,
0x20,0x2d,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x37,0x37,0x29,0x29,
0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x32,0x20,0x3a,0x20,
0x66,0x33,0x32,0x20,0x3d,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,
0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x38,0x20,0x3a,0x20,
0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,
0x74,0x20,0x78,0x5f,0x39,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,
0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x33,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,0x38,0x38,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,0x66,0x28,0x30,
0x2e,0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x39,
0x30,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x35,
0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,
0x6d,0x70,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,
0x28,0x28,0x28,0x28,0x78,0x5f,0x35,0x34,0x2e,0x78,0x20,0x2a,0x20,0x78,0x5f,0x35,
0x36,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x36,0x37,0x2e,0x78,0x20,0x2a,0x20,0x78,
0x5f,0x36,0x39,0x29,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x38,0x30,0x2e,0x78,0x20,
0x2a,0x20,0x78,0x5f,0x38,0x32,0x29,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x39,0x33,
0x2e,0x78,0x20,0x2a,0x20,0x78,0x5f,0x39,0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,
0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
0x20,0x3d,0x20,0x78,0x5f,0x33,0x32,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x3b,0x0a,
0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x35,0x20,0x3a,0x20,0x76,0x65,
0x63,0x33,0x66,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x31,0x30,
0x34,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x31,0x30,0x34,0x2e,0x79,0x2c,0x20,0x78,0x5f,
0x31,0x30,0x34,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
0x31,0x30,0x38,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x33,0x32,
0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,
0x20,0x78,0x5f,0x31,0x30,0x39,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,0x31,0x30,0x35,
0x2e,0x78,0x2c,0x20,0x78,0x5f,0x31,0x30,0x35,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,
0x30,0x35,0x2e,0x7a,0x2c,0x20,0x28,0x78,0x5f,0x31,0x30,0x38,0x20,0x2a,0x20,0x78,
0x5f,0x31,0x30,0x39,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,
0x72,0x2c,0x20,0x28,0x78,0x5f,0x38,0x38,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x32,
0x66,0x28,0x30,0x2e,0x35,0x66,0x29,0x20,0x2a,0x20,0x78,0x5f,0x39,0x30,0x29,0x29,
0x29,0x3b,0x0a,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x28,0x28,0x28,
0x28,0x78,0x5f,0x35,0x34,0x2e,0x78,0x20,0x2a,0x20,0x78,0x5f,0x35,0x36,0x29,0x20,
0x2b,0x20,0x28,0x78,0x5f,0x36,0x37,0x2e,0x78,0x20,0x2a,0x20,0x78,0x5f,0x36,0x39,
0x29,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x38,0x30,0x2e,0x78,0x20,0x2a,0x20,0x78,
0x5f,0x38,0x32,0x29,0x29,0x20,0x2b,0x20,0x28,0x78,0x5f,0x39,0x33,0x2e,0x78,0x20,
0x2a,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x29,0x29,0x3b,
0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x35,0x20,0x3d,0x20,0x78,
0x5f,0x33,0x32,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x78,0x79,0x7a,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,0x31,0x30,0x35,0x2e,0x78,0x2c,0x20,0x78,0x5f,
0x31,0x30,0x35,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x30,0x35,0x2e,0x7a,0x2c,0x20,
0x28,0x78,0x5f,0x33,0x32,0x2e,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x20,0x2a,
0x20,0x61,0x6c,0x70,0x68,0x61,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,
0x00,
}
draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc: sg.Shader_Desc

View File

@@ -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 glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin
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
Overview:
=========
@@ -387,11 +387,8 @@ render_glyph_fs_source_metal_macos := [238]u8 {
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);
uv = vec2f(v_texture.x, (1.0f - v_texture.y));
gl_Position = vec4f(v_position.x, v_position.y, 0.0f, 1.0f);
return;
}
@@ -409,10 +406,9 @@ render_glyph_fs_source_metal_macos := [238]u8 {
main_1();
return main_out(uv, gl_Position);
}
*/
@(private="file")
render_glyph_vs_source_wgsl := [698]u8 {
render_glyph_vs_source_wgsl := [626]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,
@@ -424,39 +420,35 @@ render_glyph_vs_source_wgsl := [698]u8 {
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,
0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x65,
0x63,0x32,0x66,0x28,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x78,0x2c,
0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,
0x72,0x65,0x2e,0x79,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,0x76,0x5f,
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x2c,0x20,0x76,0x5f,0x70,0x6f,
0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x00,
}
/*
diagnostic(off, derivative_uniformity);
@@ -466,7 +458,7 @@ render_glyph_vs_source_wgsl := [698]u8 {
var<private> uv : vec2f;
fn main_1() {
frag_color = vec4f(1.0f, 1.0f, 1.0f, 1.0f);
frag_color = vec4f(1.0f);
return;
}
@@ -481,10 +473,9 @@ render_glyph_vs_source_wgsl := [698]u8 {
main_1();
return main_out(frag_color);
}
*/
@(private="file")
render_glyph_fs_source_wgsl := [361]u8 {
render_glyph_fs_source_wgsl := [342]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,
@@ -493,21 +484,20 @@ render_glyph_fs_source_wgsl := [361]u8 {
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,
0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,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,0x00,
}
render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc: sg.Shader_Desc

View File

@@ -17,7 +17,7 @@ A custom version of the vendor:stb/truetype is maintained by this library:
* Added ability to set the stb_truetype allocator for `STBTT_MALLOC` and `STBTT_FREE`.
* Changed procedure signatures to pass the font_info struct by immutable ptr (#by_ptr) when the C equivalent has their parameter as `const*`.
All other dependencies are provided directly into the thirdparty directory. However they can be cloned from their corresponding github repos:
All other dependencies are provided directly into the thirdparty directory (EXCEPT sokol-tools, its cloned). However they can be cloned from their corresponding github repos:
[harfbuzz](https://github.com/Ed94/odin_harfbuzz) is configured to pull & build the C++ library, it will use the MSVC toolchain (you can change it to use meson instead of preferred).
[sokol](https://github.com/floooh/sokol) built using `build_sokol_library.ps1`.
@@ -57,7 +57,7 @@ Build sokol manually if not using a fresh clone.
#### Note on dependency packages
All other dependencies are provided directly into the thirdparty directory. However they can be cloned from their corresponding github repos:
All other dependencies are provided directly into the thirdparty directory (EXCEPT sokol-tools, its cloned). However they can be cloned from their corresponding github repos:
[harfbuzz](https://github.com/Ed94/odin_harfbuzz) is configured to pull & build the C++ library, it will use the gcc toolchain (you can change it to use meson instead of preferred).

1
thirdparty/harfbuzz/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
lib

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +0,0 @@
.vscode/
.zig-cache/
zig-out/
*.pyc

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Andre Weissflog
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,2 +0,0 @@
# sokol-tools-bin
Binaries and fips integration for https://github.com/floooh/sokol-tools

View File

@@ -1,2 +0,0 @@
Precompiled binaries for Linux go here (64-bit statically linked).

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
Precompiled binaries for macOS go here.

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
Precompiled binaries for Windows (64-bit) go here.

Binary file not shown.

View File

@@ -1,143 +0,0 @@
//! Helper code to invoke sokol-shdc from the Zig build system.
//! See https://github.com/floooh/sokol-zig for an example
//! of how to use sokol-tools-bin as a lazy dependency and
//! compile shaders (search for `shdc.compile` in the sokol-zig build.zig)
const std = @import("std");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
const Build = std.Build;
pub const Options = struct {
dep_shdc: *Build.Dependency,
input: Build.LazyPath,
output: Build.LazyPath,
slang: Slang,
format: Format = .sokol_zig,
tmp_dir: ?Build.LazyPath = null,
defines: ?[][]const u8 = null,
module: ?[]const u8 = null,
reflection: bool = false,
bytecode: bool = false,
dump: bool = false,
genver: ?[]const u8 = null,
ifdef: bool = false,
noifdef: bool = false,
save_intermediate_spirv: bool = false,
no_log_cmdline: bool = true,
};
pub fn compile(b: *Build, opts: Options) !*Build.Step.Run {
const shdc_path = try getShdcLazyPath(opts.dep_shdc);
const args = try optsToArgs(opts, b, shdc_path);
var step = b.addSystemCommand(args);
step.addFileArg(opts.input);
return step;
}
/// target shader languages
/// NOTE: make sure that field names match the cmdline arg string
pub const Slang = packed struct(u10) {
glsl410: bool = false,
glsl430: bool = false,
glsl300es: bool = false,
glsl310es: bool = false,
hlsl4: bool = false,
hlsl5: bool = false,
metal_macos: bool = false,
metal_ios: bool = false,
metal_sim: bool = false,
wgsl: bool = false,
};
fn slangToString(slang: Slang, a: Allocator) ![]const u8 {
var strings: [16][]const u8 = undefined;
var num_strings: usize = 0;
inline for (std.meta.fields(Slang)) |field| {
if (@field(slang, field.name)) {
strings[num_strings] = field.name;
num_strings += 1;
}
}
return std.mem.join(a, ":", strings[0..num_strings]);
}
/// the code-generation target language
/// NOTE: make sure that the item names match the cmdline arg string
pub const Format = enum {
sokol,
sokol_impl,
sokol_zig,
sokol_nim,
sokol_odin,
sokol_rust,
sokol_d,
sokol_jai,
};
fn formatToString(f: Format) []const u8 {
return @tagName(f);
}
fn getShdcLazyPath(dep_shdc: *Build.Dependency) !Build.LazyPath {
const intel = builtin.cpu.arch.isX86();
const opt_sub_path: ?[]const u8 = switch (builtin.os.tag) {
.windows => "bin/win32/sokol-shdc.exe",
.linux => if (intel) "bin/linux/sokol-shdc" else "bin/linux_arm64/sokol-shdc",
.macos => if (intel) "bin/osx/sokol-shdc" else "bin/osx_arm64/sokol-shdc",
else => null,
};
if (opt_sub_path) |sub_path| {
return dep_shdc.path(sub_path);
} else {
return error.ShdcUnsupportedPlatform;
}
}
fn optsToArgs(opts: Options, b: *Build, tool_path: Build.LazyPath) ![]const []const u8 {
const a = b.allocator;
var arr: std.ArrayListUnmanaged([]const u8) = .empty;
try arr.append(a, tool_path.getPath(b));
try arr.appendSlice(a, &.{ "-o", opts.output.getPath(b) });
try arr.appendSlice(a, &.{ "-l", try slangToString(opts.slang, a) });
try arr.appendSlice(a, &.{ "-f", formatToString(opts.format) });
if (opts.tmp_dir) |tmp_dir| {
try arr.appendSlice(a, &.{ "--tmpdir", tmp_dir.getPath(b) });
}
if (opts.defines) |defines| {
try arr.appendSlice(a, &.{ "--defines", try std.mem.join(a, ":", defines) });
}
if (opts.module) |module| {
try arr.appendSlice(a, &.{ "--module", b.dupe(module) });
}
if (opts.reflection) {
try arr.append(a, "--reflection");
}
if (opts.bytecode) {
try arr.append(a, "--bytecode");
}
if (opts.dump) {
try arr.append(a, "--dump");
}
if (opts.genver) |genver| {
try arr.appendSlice(a, &.{ "--genver", b.dupe(genver) });
}
if (opts.ifdef) {
try arr.append(a, "--ifdef");
}
if (opts.noifdef) {
try arr.append(a, "--noifdef");
}
if (opts.save_intermediate_spirv) {
try arr.append(a, "--save-intermediate-spirv");
}
if (opts.no_log_cmdline) {
try arr.append(a, "--no-log-cmdline");
}
// important: keep this last
try arr.append(a, "-i");
return arr.toOwnedSlice(a);
}
pub fn build(b: *Build) void {
_ = b;
}

View File

@@ -1,7 +0,0 @@
.{
.name = .sokolshdc,
.fingerprint = 0xe0596dde0e9962af,
.version = "0.1.0",
.minimum_zig_version = "0.14.0",
.paths = .{ "bin", "build.zig", "build.zig.zon" },
}

View File

@@ -1,62 +0,0 @@
#-------------------------------------------------------------------------------
# SokolShader.py
#
# Fips code-generator script for invoking sokol-shdc during the build.
#
# Use the cmake macro 'sokol_shader([glsl-file] [shader-dialects])' inside a
# fips target (fips_begin_* / fips_end_*) to hook the code-generation
# build job into the build process.
#-------------------------------------------------------------------------------
Version = 5
import os, platform, subprocess
import genutil as util
from mod import log
#-------------------------------------------------------------------------------
def find_shdc():
shdc_path = os.path.dirname(os.path.abspath(__file__))
shdc_path += '/../../bin/'
if platform.system() == 'Windows':
shdc_path += 'win32/'
elif platform.system() == 'Darwin':
if platform.machine() == 'arm64':
shdc_path += 'osx_arm64/'
else:
shdc_path += 'osx/'
elif platform.system() == 'Linux':
if platform.machine() in ['aarch64', 'arm64']:
shdc_path += 'linux_arm64/'
else:
shdc_path += 'linux/'
else:
log.error('Unknown host system {}'.format(platform.system()))
return shdc_path + 'sokol-shdc'
#-------------------------------------------------------------------------------
def generate(input, out_src, out_hdr, args):
errfmt = 'msvc' if args['compiler']=='MSVC' else 'gcc'
if util.isDirty(Version, [input], [out_hdr]):
print('## sokol-shdc: {} {} {}'.format(input, out_hdr, str(args)))
cmd = [find_shdc(),
'--input', input,
'--output', out_hdr,
'--slang', args['slang'],
'--genver', str(Version),
'--errfmt', errfmt,
'--format', 'sokol']
if 'defines' in args:
cmd.extend(['--defines', args['defines']])
if 'module' in args:
cmd.extend(['--module', args['module']])
if 'reflection' in args:
if args['reflection']:
cmd.extend(['--reflection'])
if 'debuggable' in args and args['debuggable']:
pass
else:
cmd.extend(['--bytecode'])
res = subprocess.call(cmd)
if res != 0:
log.error('sokol-shdc returned with error code {}'.format(res))

View File

@@ -1,25 +0,0 @@
macro(sokol_shader shd slang)
set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}' }")
fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args})
endmacro()
# special version which doesn't generate binary output, this allows shaders to be debugged
macro(sokol_shader_debuggable shd slang)
set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', debuggable: true }")
fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args})
endmacro()
macro(sokol_shader_variant shd slang module defines)
set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', defines: '${defines}', module: '${module}' }")
fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.${module}.h OUT_OF_SOURCE ARGS ${args})
endmacro()
macro(sokol_shader_with_reflection shd slang)
set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', reflection: true }")
fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args})
endmacro()
macro(sokol_shader_variant_with_reflection shd slang module defines)
set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', defines: '${defines}', module: '${module}', reflection: true }")
fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.${module}.h OUT_OF_SOURCE ARGS ${args})
endmacro()

View File

@@ -0,0 +1,80 @@
name: Odin
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
# NOTE: odin macos and ubuntu releases are zipped twice, so this is bit of a hack.
# The examples folder also conflicts with the sokol examples, so we just remove it.
steps:
- uses: actions/checkout@main
- uses: ilammy/msvc-dev-cmd@v1
- if: runner.os == 'Linux'
name: prepare-linux
run: |
sudo apt-get update
sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-ubuntu-amd64-dev-2024-04.zip --output odin.zip
unzip odin.zip
unzip dist.zip
rm -r ./dist/examples
mv ./dist/* ./
chmod a+x ./odin
cd sokol
chmod a+x ./build_clibs_linux.sh
./build_clibs_linux.sh
cd ..
- if: runner.os == 'macOS'
name: prepare-macos
run: |
brew install llvm@17
curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-macos-amd64-dev-2024-04.zip --output odin.zip
unzip odin.zip
unzip dist.zip
rm -r ./dist/examples
mv ./dist/* ./
chmod a+x ./odin
cd sokol
chmod a+x ./build_clibs_macos.sh
./build_clibs_macos.sh
./build_clibs_macos_dylib.sh
cd ..
- if: runner.os == 'Windows'
name: prepare-windows
shell: cmd
run: |
curl -L https://github.com/odin-lang/Odin/releases/download/dev-2024-04/odin-windows-amd64-dev-2024-04.zip --output odin.zip
unzip odin.zip
cd sokol
build_clibs_windows.cmd
cd ..
- name: build
run: |
./odin build examples/blend -debug
./odin build examples/bufferoffsets -debug
./odin build examples/clear -debug
./odin build examples/cube -debug
./odin build examples/debugtext -debug
./odin build examples/debugtext-print -debug
./odin build examples/debugtext-userfont -debug
./odin build examples/instancing -debug
./odin build examples/mrt -debug
./odin build examples/noninterleaved -debug
./odin build examples/offscreen -debug
./odin build examples/quad -debug
./odin build examples/saudio -debug
./odin build examples/sgl -debug
./odin build examples/sgl-context -debug
./odin build examples/sgl-points -debug
./odin build examples/shapes -debug
./odin build examples/texcube -debug
./odin build examples/triangle -debug
./odin build examples/vertexpull -debug
./odin build examples/instancing-compute -debug

View File

@@ -1,3 +1,15 @@
.vscode/
build/
*.a
*.o
*.lib
*.obj
*.pdb
*.bin
*.exp
*.ilk
*.dll
*.dylib
*.exe
*.dSYM/
ols.json

View File

@@ -31,7 +31,8 @@ package sokol_app
SOKOL_ASSERT(c) - your own assert macro (default: assert(c))
SOKOL_UNREACHABLE() - a guard macro for unreachable code (default: assert(false))
SOKOL_WIN32_FORCE_MAIN - define this on Win32 to add a main() entry point
SOKOL_WIN32_FORCE_WINMAIN - define this on Win32 to add a WinMain() entry point (enabled by default unless SOKOL_WIN32_FORCE_MAIN or SOKOL_NO_ENTRY is defined)
SOKOL_WIN32_FORCE_WINMAIN - define this on Win32 to add a WinMain() entry point (enabled by default unless
SOKOL_WIN32_FORCE_MAIN or SOKOL_NO_ENTRY is defined)
SOKOL_NO_ENTRY - define this if sokol_app.h shouldn't "hijack" the main() function
SOKOL_APP_API_DECL - public function declaration prefix (default: extern)
SOKOL_API_DECL - same as SOKOL_APP_API_DECL
@@ -83,6 +84,11 @@ package sokol_app
On macOS and iOS, the implementation must be compiled as Objective-C.
On Emscripten:
- for WebGL2: add the linker option `-s USE_WEBGL2=1`
- for WebGPU: compile and link with `--use-port=emdawnwebgpu`
(for more exotic situations, read: https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/pkg/README.md)
FEATURE OVERVIEW
================
sokol_app.h provides a minimalistic cross-platform API which
@@ -1905,11 +1911,12 @@ Log_Item :: enum i32 {
ANDROID_CREATE_THREAD_PIPE_FAILED,
ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS,
WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED,
WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED,
WGPU_SWAPCHAIN_SURFACE_GET_CAPABILITIES_FAILED,
WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED,
WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED,
WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED,
WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED,
WGPU_SWAPCHAIN_GETCURRENTTEXTURE_FAILED,
WGPU_REQUEST_DEVICE_STATUS_ERROR,
WGPU_REQUEST_DEVICE_STATUS_UNKNOWN,
WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE,

View File

@@ -30,7 +30,8 @@
SOKOL_ASSERT(c) - your own assert macro (default: assert(c))
SOKOL_UNREACHABLE() - a guard macro for unreachable code (default: assert(false))
SOKOL_WIN32_FORCE_MAIN - define this on Win32 to add a main() entry point
SOKOL_WIN32_FORCE_WINMAIN - define this on Win32 to add a WinMain() entry point (enabled by default unless SOKOL_WIN32_FORCE_MAIN or SOKOL_NO_ENTRY is defined)
SOKOL_WIN32_FORCE_WINMAIN - define this on Win32 to add a WinMain() entry point (enabled by default unless
SOKOL_WIN32_FORCE_MAIN or SOKOL_NO_ENTRY is defined)
SOKOL_NO_ENTRY - define this if sokol_app.h shouldn't "hijack" the main() function
SOKOL_APP_API_DECL - public function declaration prefix (default: extern)
SOKOL_API_DECL - same as SOKOL_APP_API_DECL
@@ -82,6 +83,11 @@
On macOS and iOS, the implementation must be compiled as Objective-C.
On Emscripten:
- for WebGL2: add the linker option `-s USE_WEBGL2=1`
- for WebGPU: compile and link with `--use-port=emdawnwebgpu`
(for more exotic situations, read: https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/pkg/README.md)
FEATURE OVERVIEW
================
sokol_app.h provides a minimalistic cross-platform API which
@@ -1743,11 +1749,12 @@ typedef struct sapp_allocator {
_SAPP_LOGITEM_XMACRO(ANDROID_CREATE_THREAD_PIPE_FAILED, "failed to create thread pipe") \
_SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS, "NativeActivity successfully created") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED, "wgpu: failed to create surface for swapchain") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED, "wgpu: failed to create swapchain object") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_SURFACE_GET_CAPABILITIES_FAILED, "wgpu: wgpuSurfaceGetCapabilities failed") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED, "wgpu: failed to create depth-stencil texture for swapchain") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED, "wgpu: failed to create view object for swapchain depth-stencil texture") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED, "wgpu: failed to create msaa texture for swapchain") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED, "wgpu: failed to create view object for swapchain msaa texture") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_GETCURRENTTEXTURE_FAILED, "wgpu: wgpuSurfaceGetCurrentTexture() failed") \
_SAPP_LOGITEM_XMACRO(WGPU_REQUEST_DEVICE_STATUS_ERROR, "wgpu: requesting device failed with status 'error'") \
_SAPP_LOGITEM_XMACRO(WGPU_REQUEST_DEVICE_STATUS_UNKNOWN, "wgpu: requesting device failed with status 'unknown'") \
_SAPP_LOGITEM_XMACRO(WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE, "wgpu: requesting adapter failed with 'unavailable'") \
@@ -2162,6 +2169,10 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#define _SOKOL_UNUSED(x) (void)(x)
#endif
#if defined(SOKOL_WGPU)
#include <webgpu/webgpu.h>
#endif
#if defined(_SAPP_APPLE)
#if defined(SOKOL_METAL)
#import <Metal/Metal.h>
@@ -2185,9 +2196,6 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#include <AvailabilityMacros.h>
#include <mach/mach_time.h>
#elif defined(_SAPP_EMSCRIPTEN)
#if defined(SOKOL_WGPU)
#include <webgpu/webgpu.h>
#endif
#if defined(SOKOL_GLES3)
#include <GLES3/gl3.h>
#endif
@@ -2515,6 +2523,22 @@ _SOKOL_PRIVATE double _sapp_timing_get_avg(_sapp_timing_t* t) {
// ███████ ██ ██ ██ ██████ ██████ ██ ███████
//
// >> structs
#if defined(SOKOL_WGPU)
typedef struct {
WGPUInstance instance;
WGPUAdapter adapter;
WGPUDevice device;
WGPUSurface surface;
WGPUTextureFormat render_format;
WGPUTexture msaa_tex;
WGPUTextureView msaa_view;
WGPUTexture depth_stencil_tex;
WGPUTextureView depth_stencil_view;
WGPUTextureView swapchain_view;
bool async_init_done;
} _sapp_wgpu_t;
#endif
#if defined(_SAPP_MACOS)
@interface _sapp_macos_app_delegate : NSObject<NSApplicationDelegate>
@end
@@ -2584,23 +2608,6 @@ typedef struct {
#if defined(_SAPP_EMSCRIPTEN)
#if defined(SOKOL_WGPU)
typedef struct {
WGPUInstance instance;
WGPUAdapter adapter;
WGPUDevice device;
WGPUTextureFormat render_format;
WGPUSurface surface;
WGPUSwapChain swapchain;
WGPUTexture msaa_tex;
WGPUTextureView msaa_view;
WGPUTexture depth_stencil_tex;
WGPUTextureView depth_stencil_view;
WGPUTextureView swapchain_view;
bool async_init_done;
} _sapp_wgpu_t;
#endif
typedef struct {
bool mouse_lock_requested;
uint16_t mouse_buttons;
@@ -2675,7 +2682,10 @@ typedef struct {
bool tracked;
uint8_t capture_mask;
} mouse;
uint8_t raw_input_data[256];
struct {
size_t size;
void* ptr;
} raw_input_data;
} _sapp_win32_t;
#if defined(SOKOL_GLCORE)
@@ -3002,15 +3012,15 @@ typedef struct {
_sapp_drop_t drop;
sapp_icon_desc default_icon_desc;
uint32_t* default_icon_pixels;
#if defined(SOKOL_WGPU)
_sapp_wgpu_t wgpu;
#endif
#if defined(_SAPP_MACOS)
_sapp_macos_t macos;
#elif defined(_SAPP_IOS)
_sapp_ios_t ios;
#elif defined(_SAPP_EMSCRIPTEN)
_sapp_emsc_t emsc;
#if defined(SOKOL_WGPU)
_sapp_wgpu_t wgpu;
#endif
#elif defined(_SAPP_WIN32)
_sapp_win32_t win32;
#if defined(SOKOL_D3D11)
@@ -3509,6 +3519,273 @@ _SOKOL_PRIVATE void _sapp_setup_default_icon(void) {
SOKOL_ASSERT(dst == dst_end);
}
// ██ ██ ██████ ██████ ██ ██
// ██ ██ ██ ██ ██ ██ ██
// ██ █ ██ ██ ███ ██████ ██ ██
// ██ ███ ██ ██ ██ ██ ██ ██
// ███ ███ ██████ ██ ██████
//
// >>wgpu
#if defined(SOKOL_WGPU)
_SOKOL_PRIVATE WGPUStringView _sapp_wgpu_stringview(const char* str) {
WGPUStringView res;
if (str) {
res.data = str;
res.length = strlen(str);
} else {
res.data = 0;
res.length = 0;
}
return res;
}
_SOKOL_PRIVATE void _sapp_wgpu_create_swapchain(bool called_from_resize) {
SOKOL_ASSERT(_sapp.wgpu.instance);
SOKOL_ASSERT(_sapp.wgpu.device);
SOKOL_ASSERT(0 == _sapp.wgpu.msaa_tex);
SOKOL_ASSERT(0 == _sapp.wgpu.msaa_view);
SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_tex);
SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_view);
SOKOL_ASSERT(0 == _sapp.wgpu.swapchain_view);
if (!called_from_resize) {
SOKOL_ASSERT(0 == _sapp.wgpu.surface);
WGPUSurfaceDescriptor surf_desc;
_sapp_clear(&surf_desc, sizeof(surf_desc));
#if defined (_SAPP_EMSCRIPTEN)
WGPUEmscriptenSurfaceSourceCanvasHTMLSelector html_canvas_desc;
_sapp_clear(&html_canvas_desc, sizeof(html_canvas_desc));
html_canvas_desc.chain.sType = WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector;
html_canvas_desc.selector = _sapp_wgpu_stringview(_sapp.html5_canvas_selector);
surf_desc.nextInChain = &html_canvas_desc.chain;
#else
#error "Unsupported platform for SOKOL_WGPU"
#endif
_sapp.wgpu.surface = wgpuInstanceCreateSurface(_sapp.wgpu.instance, &surf_desc);
if (0 == _sapp.wgpu.surface) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED);
}
WGPUSurfaceCapabilities surf_caps;
_sapp_clear(&surf_caps, sizeof(surf_caps));
WGPUStatus caps_status = wgpuSurfaceGetCapabilities(_sapp.wgpu.surface, _sapp.wgpu.adapter, &surf_caps);
if (caps_status != WGPUStatus_Success) {
_SAPP_PANIC(WGPU_SWAPCHAIN_SURFACE_GET_CAPABILITIES_FAILED);
}
_sapp.wgpu.render_format = surf_caps.formats[0];
}
SOKOL_ASSERT(_sapp.wgpu.surface);
WGPUSurfaceConfiguration surf_conf;
_sapp_clear(&surf_conf, sizeof(surf_conf));
surf_conf.device = _sapp.wgpu.device;
surf_conf.format = _sapp.wgpu.render_format;
surf_conf.usage = WGPUTextureUsage_RenderAttachment;
surf_conf.width = (uint32_t)_sapp.framebuffer_width;
surf_conf.height = (uint32_t)_sapp.framebuffer_height;
surf_conf.alphaMode = WGPUCompositeAlphaMode_Opaque;
#if defined(_SAPP_EMSCRIPTEN)
// FIXME: make this further configurable?
if (_sapp.desc.html5_premultiplied_alpha) {
surf_conf.alphaMode = WGPUCompositeAlphaMode_Premultiplied;
}
#endif
surf_conf.presentMode = WGPUPresentMode_Fifo;
wgpuSurfaceConfigure(_sapp.wgpu.surface, &surf_conf);
WGPUTextureDescriptor ds_desc;
_sapp_clear(&ds_desc, sizeof(ds_desc));
ds_desc.usage = WGPUTextureUsage_RenderAttachment;
ds_desc.dimension = WGPUTextureDimension_2D;
ds_desc.size.width = (uint32_t)_sapp.framebuffer_width;
ds_desc.size.height = (uint32_t)_sapp.framebuffer_height;
ds_desc.size.depthOrArrayLayers = 1;
ds_desc.format = WGPUTextureFormat_Depth32FloatStencil8;
ds_desc.mipLevelCount = 1;
ds_desc.sampleCount = (uint32_t)_sapp.sample_count;
_sapp.wgpu.depth_stencil_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &ds_desc);
if (0 == _sapp.wgpu.depth_stencil_tex) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED);
}
_sapp.wgpu.depth_stencil_view = wgpuTextureCreateView(_sapp.wgpu.depth_stencil_tex, 0);
if (0 == _sapp.wgpu.depth_stencil_view) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED);
}
if (_sapp.sample_count > 1) {
WGPUTextureDescriptor msaa_desc;
_sapp_clear(&msaa_desc, sizeof(msaa_desc));
msaa_desc.usage = WGPUTextureUsage_RenderAttachment;
msaa_desc.dimension = WGPUTextureDimension_2D;
msaa_desc.size.width = (uint32_t)_sapp.framebuffer_width;
msaa_desc.size.height = (uint32_t)_sapp.framebuffer_height;
msaa_desc.size.depthOrArrayLayers = 1;
msaa_desc.format = _sapp.wgpu.render_format;
msaa_desc.mipLevelCount = 1;
msaa_desc.sampleCount = (uint32_t)_sapp.sample_count;
_sapp.wgpu.msaa_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &msaa_desc);
if (0 == _sapp.wgpu.msaa_tex) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED);
}
_sapp.wgpu.msaa_view = wgpuTextureCreateView(_sapp.wgpu.msaa_tex, 0);
if (0 == _sapp.wgpu.msaa_view) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED);
}
}
}
_SOKOL_PRIVATE void _sapp_wgpu_discard_swapchain(bool called_from_resize) {
if (_sapp.wgpu.msaa_view) {
wgpuTextureViewRelease(_sapp.wgpu.msaa_view);
_sapp.wgpu.msaa_view = 0;
}
if (_sapp.wgpu.msaa_tex) {
wgpuTextureRelease(_sapp.wgpu.msaa_tex);
_sapp.wgpu.msaa_tex = 0;
}
if (_sapp.wgpu.depth_stencil_view) {
wgpuTextureViewRelease(_sapp.wgpu.depth_stencil_view);
_sapp.wgpu.depth_stencil_view = 0;
}
if (_sapp.wgpu.depth_stencil_tex) {
wgpuTextureRelease(_sapp.wgpu.depth_stencil_tex);
_sapp.wgpu.depth_stencil_tex = 0;
}
if (!called_from_resize) {
if (_sapp.wgpu.surface) {
wgpuSurfaceRelease(_sapp.wgpu.surface);
_sapp.wgpu.surface = 0;
}
}
}
_SOKOL_PRIVATE WGPUTextureView _sapp_wgpu_swapchain_next(void) {
WGPUSurfaceTexture surf_tex;
_sapp_clear(&surf_tex, sizeof(surf_tex));
wgpuSurfaceGetCurrentTexture(_sapp.wgpu.surface, &surf_tex);
switch (surf_tex.status) {
case WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal:
case WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal:
// all ok
break;
case WGPUSurfaceGetCurrentTextureStatus_Timeout:
case WGPUSurfaceGetCurrentTextureStatus_Outdated:
case WGPUSurfaceGetCurrentTextureStatus_Lost:
// skip this frame and reconfigure surface
if (surf_tex.texture) {
wgpuTextureRelease(surf_tex.texture);
}
_sapp_wgpu_discard_swapchain(false);
_sapp_wgpu_create_swapchain(false);
return 0;
case WGPUSurfaceGetCurrentTextureStatus_Error:
default:
_SAPP_PANIC(WGPU_SWAPCHAIN_GETCURRENTTEXTURE_FAILED);
break;
}
return wgpuTextureCreateView(surf_tex.texture, 0);
}
_SOKOL_PRIVATE void _sapp_wgpu_size_changed(void) {
if (_sapp.wgpu.surface) {
_sapp_wgpu_discard_swapchain(true);
_sapp_wgpu_create_swapchain(true);
}
}
_SOKOL_PRIVATE void _sapp_wgpu_request_device_cb(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView msg, void* userdata1, void* userdata2) {
_SOKOL_UNUSED(msg);
_SOKOL_UNUSED(userdata1);
_SOKOL_UNUSED(userdata2);
SOKOL_ASSERT(!_sapp.wgpu.async_init_done);
if (status != WGPURequestDeviceStatus_Success) {
if (status == WGPURequestDeviceStatus_Error) {
_SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_ERROR);
} else {
_SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_UNKNOWN);
}
}
SOKOL_ASSERT(device);
_sapp.wgpu.device = device;
_sapp_wgpu_create_swapchain(false);
_sapp.wgpu.async_init_done = true;
}
_SOKOL_PRIVATE void _sapp_wgpu_request_adapter_cb(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView msg, void* userdata1, void* userdata2) {
_SOKOL_UNUSED(msg);
_SOKOL_UNUSED(userdata1);
_SOKOL_UNUSED(userdata2);
if (status != WGPURequestAdapterStatus_Success) {
switch (status) {
case WGPURequestAdapterStatus_Unavailable: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE); break;
case WGPURequestAdapterStatus_Error: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_ERROR); break;
default: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNKNOWN); break;
}
}
SOKOL_ASSERT(adapter);
_sapp.wgpu.adapter = adapter;
size_t cur_feature_index = 1;
#define _SAPP_WGPU_MAX_REQUESTED_FEATURES (8)
WGPUFeatureName requiredFeatures[_SAPP_WGPU_MAX_REQUESTED_FEATURES] = {
WGPUFeatureName_Depth32FloatStencil8,
};
// check for optional features we're interested in
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionBC)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionBC;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionETC2)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionETC2;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionASTC)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionASTC;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_Float32Filterable)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_Float32Filterable;
}
#undef _SAPP_WGPU_MAX_REQUESTED_FEATURES
WGPURequestDeviceCallbackInfo cb_info;
_sapp_clear(&cb_info, sizeof(cb_info));
cb_info.mode = WGPUCallbackMode_AllowProcessEvents;
cb_info.callback = _sapp_wgpu_request_device_cb;
WGPUDeviceDescriptor dev_desc;
_sapp_clear(&dev_desc, sizeof(dev_desc));
dev_desc.requiredFeatureCount = cur_feature_index;
dev_desc.requiredFeatures = requiredFeatures,
wgpuAdapterRequestDevice(adapter, &dev_desc, cb_info);
}
_SOKOL_PRIVATE void _sapp_wgpu_init(void) {
SOKOL_ASSERT(0 == _sapp.wgpu.instance);
SOKOL_ASSERT(!_sapp.wgpu.async_init_done);
_sapp.wgpu.instance = wgpuCreateInstance(0);
if (0 == _sapp.wgpu.instance) {
_SAPP_PANIC(WGPU_CREATE_INSTANCE_FAILED);
}
// FIXME: power preference?
WGPURequestAdapterCallbackInfo cb_info;
_sapp_clear(&cb_info, sizeof(cb_info));
cb_info.mode = WGPUCallbackMode_AllowProcessEvents;
cb_info.callback = _sapp_wgpu_request_adapter_cb;
wgpuInstanceRequestAdapter(_sapp.wgpu.instance, 0, cb_info);
}
_SOKOL_PRIVATE void _sapp_wgpu_frame(void) {
wgpuInstanceProcessEvents(_sapp.wgpu.instance);
if (_sapp.wgpu.async_init_done) {
_sapp.wgpu.swapchain_view = _sapp_wgpu_swapchain_next();
_sapp_frame();
wgpuTextureViewRelease(_sapp.wgpu.swapchain_view);
_sapp.wgpu.swapchain_view = 0;
}
}
#endif // SOKOL_WGPU
// █████ ██████ ██████ ██ ███████
// ██ ██ ██ ██ ██ ██ ██ ██
// ███████ ██████ ██████ ██ █████
@@ -4094,11 +4371,11 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
#endif
[_sapp.macos.window center];
_sapp.valid = true;
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
if (_sapp.fullscreen) {
/* ^^^ on GL, this already toggles a rendered frame, so set the valid flag before */
[_sapp.macos.window toggleFullScreen:self];
}
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
[NSApp activateIgnoringOtherApps:YES];
[_sapp.macos.window makeKeyAndOrderFront:nil];
_sapp_macos_update_dimensions();
@@ -5322,10 +5599,6 @@ _SOKOL_PRIVATE uint32_t _sapp_emsc_touch_event_mods(const EmscriptenTouchEvent*
return m;
}
#if defined(SOKOL_WGPU)
_SOKOL_PRIVATE void _sapp_emsc_wgpu_size_changed(void);
#endif
_SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenUiEvent* ui_event, void* user_data) {
_SOKOL_UNUSED(event_type);
_SOKOL_UNUSED(user_data);
@@ -5372,7 +5645,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU
emscripten_set_canvas_element_size(_sapp.html5_canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height);
#if defined(SOKOL_WGPU)
// on WebGPU: recreate size-dependent rendering surfaces
_sapp_emsc_wgpu_size_changed();
_sapp_wgpu_size_changed();
#endif
if (_sapp_events_enabled()) {
_sapp_init_event(SAPP_EVENTTYPE_RESIZED);
@@ -5775,198 +6048,6 @@ _SOKOL_PRIVATE void _sapp_emsc_webgl_init(void) {
}
#endif
#if defined(SOKOL_WGPU)
_SOKOL_PRIVATE void _sapp_emsc_wgpu_create_swapchain(void) {
SOKOL_ASSERT(_sapp.wgpu.instance);
SOKOL_ASSERT(_sapp.wgpu.device);
SOKOL_ASSERT(0 == _sapp.wgpu.surface);
SOKOL_ASSERT(0 == _sapp.wgpu.swapchain);
SOKOL_ASSERT(0 == _sapp.wgpu.msaa_tex);
SOKOL_ASSERT(0 == _sapp.wgpu.msaa_view);
SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_tex);
SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_view);
SOKOL_ASSERT(0 == _sapp.wgpu.swapchain_view);
WGPUSurfaceDescriptorFromCanvasHTMLSelector canvas_desc;
_sapp_clear(&canvas_desc, sizeof(canvas_desc));
canvas_desc.chain.sType = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector;
canvas_desc.selector = _sapp.html5_canvas_selector;
WGPUSurfaceDescriptor surf_desc;
_sapp_clear(&surf_desc, sizeof(surf_desc));
surf_desc.nextInChain = &canvas_desc.chain;
_sapp.wgpu.surface = wgpuInstanceCreateSurface(_sapp.wgpu.instance, &surf_desc);
if (0 == _sapp.wgpu.surface) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED);
}
_sapp.wgpu.render_format = wgpuSurfaceGetPreferredFormat(_sapp.wgpu.surface, _sapp.wgpu.adapter);
WGPUSwapChainDescriptor sc_desc;
_sapp_clear(&sc_desc, sizeof(sc_desc));
sc_desc.usage = WGPUTextureUsage_RenderAttachment;
sc_desc.format = _sapp.wgpu.render_format;
sc_desc.width = (uint32_t)_sapp.framebuffer_width;
sc_desc.height = (uint32_t)_sapp.framebuffer_height;
sc_desc.presentMode = WGPUPresentMode_Fifo;
_sapp.wgpu.swapchain = wgpuDeviceCreateSwapChain(_sapp.wgpu.device, _sapp.wgpu.surface, &sc_desc);
if (0 == _sapp.wgpu.swapchain) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED);
}
WGPUTextureDescriptor ds_desc;
_sapp_clear(&ds_desc, sizeof(ds_desc));
ds_desc.usage = WGPUTextureUsage_RenderAttachment;
ds_desc.dimension = WGPUTextureDimension_2D;
ds_desc.size.width = (uint32_t)_sapp.framebuffer_width;
ds_desc.size.height = (uint32_t)_sapp.framebuffer_height;
ds_desc.size.depthOrArrayLayers = 1;
ds_desc.format = WGPUTextureFormat_Depth32FloatStencil8;
ds_desc.mipLevelCount = 1;
ds_desc.sampleCount = (uint32_t)_sapp.sample_count;
_sapp.wgpu.depth_stencil_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &ds_desc);
if (0 == _sapp.wgpu.depth_stencil_tex) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED);
}
_sapp.wgpu.depth_stencil_view = wgpuTextureCreateView(_sapp.wgpu.depth_stencil_tex, 0);
if (0 == _sapp.wgpu.depth_stencil_view) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED);
}
if (_sapp.sample_count > 1) {
WGPUTextureDescriptor msaa_desc;
_sapp_clear(&msaa_desc, sizeof(msaa_desc));
msaa_desc.usage = WGPUTextureUsage_RenderAttachment;
msaa_desc.dimension = WGPUTextureDimension_2D;
msaa_desc.size.width = (uint32_t)_sapp.framebuffer_width;
msaa_desc.size.height = (uint32_t)_sapp.framebuffer_height;
msaa_desc.size.depthOrArrayLayers = 1;
msaa_desc.format = _sapp.wgpu.render_format;
msaa_desc.mipLevelCount = 1;
msaa_desc.sampleCount = (uint32_t)_sapp.sample_count;
_sapp.wgpu.msaa_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &msaa_desc);
if (0 == _sapp.wgpu.msaa_tex) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED);
}
_sapp.wgpu.msaa_view = wgpuTextureCreateView(_sapp.wgpu.msaa_tex, 0);
if (0 == _sapp.wgpu.msaa_view) {
_SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED);
}
}
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_discard_swapchain(void) {
if (_sapp.wgpu.msaa_view) {
wgpuTextureViewRelease(_sapp.wgpu.msaa_view);
_sapp.wgpu.msaa_view = 0;
}
if (_sapp.wgpu.msaa_tex) {
wgpuTextureRelease(_sapp.wgpu.msaa_tex);
_sapp.wgpu.msaa_tex = 0;
}
if (_sapp.wgpu.depth_stencil_view) {
wgpuTextureViewRelease(_sapp.wgpu.depth_stencil_view);
_sapp.wgpu.depth_stencil_view = 0;
}
if (_sapp.wgpu.depth_stencil_tex) {
wgpuTextureRelease(_sapp.wgpu.depth_stencil_tex);
_sapp.wgpu.depth_stencil_tex = 0;
}
if (_sapp.wgpu.swapchain) {
wgpuSwapChainRelease(_sapp.wgpu.swapchain);
_sapp.wgpu.swapchain = 0;
}
if (_sapp.wgpu.surface) {
wgpuSurfaceRelease(_sapp.wgpu.surface);
_sapp.wgpu.surface = 0;
}
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_size_changed(void) {
_sapp_emsc_wgpu_discard_swapchain();
_sapp_emsc_wgpu_create_swapchain();
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_request_device_cb(WGPURequestDeviceStatus status, WGPUDevice device, const char* msg, void* userdata) {
_SOKOL_UNUSED(msg);
_SOKOL_UNUSED(userdata);
SOKOL_ASSERT(!_sapp.wgpu.async_init_done);
if (status != WGPURequestDeviceStatus_Success) {
if (status == WGPURequestDeviceStatus_Error) {
_SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_ERROR);
} else {
_SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_UNKNOWN);
}
}
SOKOL_ASSERT(device);
_sapp.wgpu.device = device;
_sapp_emsc_wgpu_create_swapchain();
_sapp.wgpu.async_init_done = true;
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_request_adapter_cb(WGPURequestAdapterStatus status, WGPUAdapter adapter, const char* msg, void* userdata) {
_SOKOL_UNUSED(msg);
_SOKOL_UNUSED(userdata);
if (status != WGPURequestAdapterStatus_Success) {
switch (status) {
case WGPURequestAdapterStatus_Unavailable: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE); break;
case WGPURequestAdapterStatus_Error: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_ERROR); break;
default: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNKNOWN); break;
}
}
SOKOL_ASSERT(adapter);
_sapp.wgpu.adapter = adapter;
size_t cur_feature_index = 1;
#define _SAPP_WGPU_MAX_REQUESTED_FEATURES (8)
WGPUFeatureName requiredFeatures[_SAPP_WGPU_MAX_REQUESTED_FEATURES] = {
WGPUFeatureName_Depth32FloatStencil8,
};
// check for optional features we're interested in
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionBC)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionBC;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionETC2)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionETC2;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionASTC)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionASTC;
}
if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_Float32Filterable)) {
SOKOL_ASSERT(cur_feature_index < _SAPP_WGPU_MAX_REQUESTED_FEATURES);
requiredFeatures[cur_feature_index++] = WGPUFeatureName_Float32Filterable;
}
#undef _SAPP_WGPU_MAX_REQUESTED_FEATURES
WGPUDeviceDescriptor dev_desc;
_sapp_clear(&dev_desc, sizeof(dev_desc));
dev_desc.requiredFeatureCount = cur_feature_index;
dev_desc.requiredFeatures = requiredFeatures,
wgpuAdapterRequestDevice(adapter, &dev_desc, _sapp_emsc_wgpu_request_device_cb, 0);
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_init(void) {
SOKOL_ASSERT(0 == _sapp.wgpu.instance);
SOKOL_ASSERT(!_sapp.wgpu.async_init_done);
_sapp.wgpu.instance = wgpuCreateInstance(0);
if (0 == _sapp.wgpu.instance) {
_SAPP_PANIC(WGPU_CREATE_INSTANCE_FAILED);
}
// FIXME: power preference?
wgpuInstanceRequestAdapter(_sapp.wgpu.instance, 0, _sapp_emsc_wgpu_request_adapter_cb, 0);
}
_SOKOL_PRIVATE void _sapp_emsc_wgpu_frame(void) {
if (_sapp.wgpu.async_init_done) {
_sapp.wgpu.swapchain_view = wgpuSwapChainGetCurrentTextureView(_sapp.wgpu.swapchain);
_sapp_frame();
wgpuTextureViewRelease(_sapp.wgpu.swapchain_view);
_sapp.wgpu.swapchain_view = 0;
}
}
#endif // SOKOL_WGPU
_SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) {
// NOTE: HTML canvas doesn't receive input focus, this is why key event handlers are added
// to the window object (this could be worked around by adding a "tab index" to the
@@ -6040,7 +6121,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_frame_animation_loop(double time, void* userDa
_sapp_timing_external(&_sapp.timing, time / 1000.0);
#if defined(SOKOL_WGPU)
_sapp_emsc_wgpu_frame();
_sapp_wgpu_frame();
#else
_sapp_frame();
#endif
@@ -6055,6 +6136,9 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_frame_animation_loop(double time, void* userDa
}
if (_sapp.quit_ordered) {
_sapp_emsc_unregister_eventhandlers();
#if defined(SOKOL_WGPU)
_sapp_wgpu_discard_swapchain(false);
#endif
_sapp_call_cleanup();
_sapp_discard_state();
return EM_FALSE;
@@ -6093,7 +6177,7 @@ _SOKOL_PRIVATE void _sapp_emsc_run(const sapp_desc* desc) {
#if defined(SOKOL_GLES3)
_sapp_emsc_webgl_init();
#elif defined(SOKOL_WGPU)
_sapp_emsc_wgpu_init();
_sapp_wgpu_init();
#endif
_sapp.valid = true;
_sapp_emsc_register_eventhandlers();
@@ -6621,19 +6705,20 @@ _SOKOL_PRIVATE void _sapp_d3d11_create_device_and_swapchain(void) {
#if defined(SOKOL_DEBUG)
create_flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_FEATURE_LEVEL feature_level;
D3D_FEATURE_LEVEL requested_feature_levels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0 };
D3D_FEATURE_LEVEL result_feature_level;
HRESULT hr = D3D11CreateDeviceAndSwapChain(
NULL, /* pAdapter (use default) */
D3D_DRIVER_TYPE_HARDWARE, /* DriverType */
NULL, /* Software */
create_flags, /* Flags */
NULL, /* pFeatureLevels */
0, /* FeatureLevels */
requested_feature_levels, /* pFeatureLevels */
2, /* FeatureLevels */
D3D11_SDK_VERSION, /* SDKVersion */
sc_desc, /* pSwapChainDesc */
&_sapp.d3d11.swap_chain, /* ppSwapChain */
&_sapp.d3d11.device, /* ppDevice */
&feature_level, /* pFeatureLevel */
&result_feature_level, /* pFeatureLevel */
&_sapp.d3d11.device_context); /* ppImmediateContext */
_SOKOL_UNUSED(hr);
#if defined(SOKOL_DEBUG)
@@ -6654,13 +6739,13 @@ _SOKOL_PRIVATE void _sapp_d3d11_create_device_and_swapchain(void) {
D3D_DRIVER_TYPE_HARDWARE, /* DriverType */
NULL, /* Software */
create_flags, /* Flags */
NULL, /* pFeatureLevels */
0, /* FeatureLevels */
requested_feature_levels, /* pFeatureLevels */
2, /* FeatureLevels */
D3D11_SDK_VERSION, /* SDKVersion */
sc_desc, /* pSwapChainDesc */
&_sapp.d3d11.swap_chain, /* ppSwapChain */
&_sapp.d3d11.device, /* ppDevice */
&feature_level, /* pFeatureLevel */
&result_feature_level, /* pFeatureLevel */
&_sapp.d3d11.device_context); /* ppImmediateContext */
}
#endif
@@ -7253,6 +7338,32 @@ _SOKOL_PRIVATE void _sapp_win32_lock_mouse(bool lock) {
_sapp.win32.mouse.requested_lock = lock;
}
_SOKOL_PRIVATE void _sapp_win32_free_raw_input_data(void) {
if (_sapp.win32.raw_input_data.ptr) {
_sapp_free(_sapp.win32.raw_input_data.ptr);
_sapp.win32.raw_input_data.ptr = 0;
_sapp.win32.raw_input_data.size = 0;
}
}
_SOKOL_PRIVATE void _sapp_win32_alloc_raw_input_data(size_t size) {
SOKOL_ASSERT(!_sapp.win32.raw_input_data.ptr);
SOKOL_ASSERT(size > 0);
_sapp.win32.raw_input_data.ptr = _sapp_malloc(size);
_sapp.win32.raw_input_data.size = size;
SOKOL_ASSERT(_sapp.win32.raw_input_data.ptr);
}
_SOKOL_PRIVATE void* _sapp_win32_ensure_raw_input_data(size_t required_size) {
if (required_size > _sapp.win32.raw_input_data.size) {
_sapp_win32_free_raw_input_data();
_sapp_win32_alloc_raw_input_data(required_size);
}
// we expect that malloc() returns at least 8-byte aligned memory
SOKOL_ASSERT((((uintptr_t)_sapp.win32.raw_input_data.ptr) & 7) == 0);
return _sapp.win32.raw_input_data.ptr;
}
_SOKOL_PRIVATE void _sapp_win32_do_lock_mouse(void) {
_sapp.mouse.locked = true;
@@ -7668,13 +7779,18 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM
/* raw mouse input during mouse-lock */
if (_sapp.mouse.locked) {
HRAWINPUT ri = (HRAWINPUT) lParam;
UINT size = sizeof(_sapp.win32.raw_input_data);
// see: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getrawinputdata
if ((UINT)-1 == GetRawInputData(ri, RID_INPUT, &_sapp.win32.raw_input_data, &size, sizeof(RAWINPUTHEADER))) {
// also see: https://github.com/glfw/glfw/blob/e7ea71be039836da3a98cea55ae5569cb5eb885c/src/win32_window.c#L912-L924
// first poll for required size to alloc/grow input buffer, then get the actual data
UINT size = 0;
GetRawInputData(ri, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
void* raw_input_data_ptr = _sapp_win32_ensure_raw_input_data(size);
if ((UINT)-1 == GetRawInputData(ri, RID_INPUT, raw_input_data_ptr, &size, sizeof(RAWINPUTHEADER))) {
_SAPP_ERROR(WIN32_GET_RAW_INPUT_DATA_FAILED);
break;
}
const RAWINPUT* raw_mouse_data = (const RAWINPUT*) &_sapp.win32.raw_input_data;
const RAWINPUT* raw_mouse_data = (const RAWINPUT*) raw_input_data_ptr;
if (raw_mouse_data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) {
/* mouse only reports absolute position
NOTE: This code is untested and will most likely behave wrong in Remote Desktop sessions.
@@ -8215,6 +8331,7 @@ _SOKOL_PRIVATE void _sapp_win32_run(const sapp_desc* desc) {
_sapp_win32_destroy_window();
_sapp_win32_destroy_icons();
_sapp_win32_restore_console();
_sapp_win32_free_raw_input_data();
_sapp_discard_state();
}
@@ -10794,27 +10911,18 @@ _SOKOL_PRIVATE void _sapp_x11_create_window(Visual* visual, int depth) {
int display_width = DisplayWidth(_sapp.x11.display, _sapp.x11.screen);
int display_height = DisplayHeight(_sapp.x11.display, _sapp.x11.screen);
int window_width = _sapp.window_width;
int window_height = _sapp.window_height;
int window_width = (int)(_sapp.window_width * _sapp.dpi_scale);
int window_height = (int)(_sapp.window_height * _sapp.dpi_scale);
if (0 == window_width) {
window_width = (display_width * 4) / 5;
}
if (0 == window_height) {
window_height = (display_height * 4) / 5;
}
int window_xpos = (display_width - window_width) / 2;
int window_ypos = (display_height - window_height) / 2;
if (window_xpos < 0) {
window_xpos = 0;
}
if (window_ypos < 0) {
window_ypos = 0;
}
_sapp_x11_grab_error_handler();
_sapp.x11.window = XCreateWindow(_sapp.x11.display,
_sapp.x11.root,
window_xpos,
window_ypos,
0, 0,
(uint32_t)window_width,
(uint32_t)window_height,
0, /* border width */
@@ -10832,17 +10940,14 @@ _SOKOL_PRIVATE void _sapp_x11_create_window(Visual* visual, int depth) {
};
XSetWMProtocols(_sapp.x11.display, _sapp.x11.window, protocols, 1);
// NOTE: PPosition and PSize are obsolete and ignored
XSizeHints* hints = XAllocSizeHints();
hints->flags = (PWinGravity | PPosition | PSize);
hints->win_gravity = StaticGravity;
hints->x = window_xpos;
hints->y = window_ypos;
hints->width = window_width;
hints->height = window_height;
hints->flags = PWinGravity;
hints->win_gravity = CenterGravity;
XSetWMNormalHints(_sapp.x11.display, _sapp.x11.window, hints);
XFree(hints);
/* announce support for drag'n'drop */
// announce support for drag'n'drop
if (_sapp.drop.enabled) {
const Atom version = _SAPP_X11_XDND_VERSION;
XChangeProperty(_sapp.x11.display, _sapp.x11.window, _sapp.x11.xdnd.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1);
@@ -11866,7 +11971,7 @@ SOKOL_API_IMPL float sapp_heightf(void) {
}
SOKOL_API_IMPL int sapp_color_format(void) {
#if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU)
#if defined(SOKOL_WGPU)
switch (_sapp.wgpu.render_format) {
case WGPUTextureFormat_RGBA8Unorm:
return _SAPP_PIXELFORMAT_RGBA8;
@@ -12324,7 +12429,7 @@ SOKOL_API_IMPL const void* sapp_win32_get_hwnd(void) {
SOKOL_API_IMPL const void* sapp_wgpu_get_device(void) {
SOKOL_ASSERT(_sapp.valid);
#if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU)
#if defined(SOKOL_WGPU)
return (const void*) _sapp.wgpu.device;
#else
return 0;
@@ -12333,7 +12438,7 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_device(void) {
SOKOL_API_IMPL const void* sapp_wgpu_get_render_view(void) {
SOKOL_ASSERT(_sapp.valid);
#if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU)
#if defined(SOKOL_WGPU)
if (_sapp.sample_count > 1) {
SOKOL_ASSERT(_sapp.wgpu.msaa_view);
return (const void*) _sapp.wgpu.msaa_view;
@@ -12348,7 +12453,7 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_render_view(void) {
SOKOL_API_IMPL const void* sapp_wgpu_get_resolve_view(void) {
SOKOL_ASSERT(_sapp.valid);
#if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU)
#if defined(SOKOL_WGPU)
if (_sapp.sample_count > 1) {
SOKOL_ASSERT(_sapp.wgpu.swapchain_view);
return (const void*) _sapp.wgpu.swapchain_view;
@@ -12362,7 +12467,7 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_resolve_view(void) {
SOKOL_API_IMPL const void* sapp_wgpu_get_depth_stencil_view(void) {
SOKOL_ASSERT(_sapp.valid);
#if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU)
#if defined(SOKOL_WGPU)
return (const void*) _sapp.wgpu.depth_stencil_view;
#else
return 0;

View File

@@ -1480,7 +1480,7 @@ error:
_saudio.backend.device = 0;
}
return false;
};
}
_SOKOL_PRIVATE void _saudio_alsa_backend_shutdown(void) {
SOKOL_ASSERT(_saudio.backend.device);
@@ -1489,7 +1489,7 @@ _SOKOL_PRIVATE void _saudio_alsa_backend_shutdown(void) {
snd_pcm_drain(_saudio.backend.device);
snd_pcm_close(_saudio.backend.device);
_saudio_free(_saudio.backend.buffer);
};
}
// ██ ██ █████ ███████ █████ ██████ ██
// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██

View File

@@ -4251,8 +4251,8 @@ static void _sdtx_init_context(sdtx_context ctx_id, const sdtx_context_desc_t* i
sg_buffer_desc vbuf_desc;
_sdtx_clear(&vbuf_desc, sizeof(vbuf_desc));
vbuf_desc.size = vbuf_size;
vbuf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
vbuf_desc.usage = SG_USAGE_STREAM;
vbuf_desc.usage.vertex_buffer = true;
vbuf_desc.usage.stream_update = true;
vbuf_desc.label = "sdtx-vbuf";
ctx->vbuf = sg_make_buffer(&vbuf_desc);
SOKOL_ASSERT(SG_INVALID_ID != ctx->vbuf.id);

File diff suppressed because it is too large Load Diff

View File

@@ -3321,8 +3321,8 @@ static void _sgl_init_context(sgl_context ctx_id, const sgl_context_desc_t* in_d
sg_buffer_desc vbuf_desc;
_sgl_clear(&vbuf_desc, sizeof(vbuf_desc));
vbuf_desc.size = (size_t)ctx->vertices.cap * sizeof(_sgl_vertex_t);
vbuf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
vbuf_desc.usage = SG_USAGE_STREAM;
vbuf_desc.usage.vertex_buffer = true;
vbuf_desc.usage.stream_update = true;
vbuf_desc.label = "sgl-vertex-buffer";
ctx->vbuf = sg_make_buffer(&vbuf_desc);
SOKOL_ASSERT(SG_INVALID_ID != ctx->vbuf.id);

View File

@@ -1355,8 +1355,8 @@ SOKOL_API_IMPL sg_buffer_desc sshape_vertex_buffer_desc(const sshape_buffer_t* b
SOKOL_ASSERT(buf && buf->valid);
sg_buffer_desc desc = { 0 };
if (buf->valid) {
desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
desc.usage = SG_USAGE_IMMUTABLE;
desc.usage.vertex_buffer = true;
desc.usage.immutable = true;
desc.data.ptr = buf->vertices.buffer.ptr;
desc.data.size = buf->vertices.data_size;
}
@@ -1367,8 +1367,8 @@ SOKOL_API_IMPL sg_buffer_desc sshape_index_buffer_desc(const sshape_buffer_t* bu
SOKOL_ASSERT(buf && buf->valid);
sg_buffer_desc desc = { 0 };
if (buf->valid) {
desc.type = SG_BUFFERTYPE_INDEXBUFFER;
desc.usage = SG_USAGE_IMMUTABLE;
desc.usage.index_buffer = true;
desc.usage.immutable = true;
desc.data.ptr = buf->indices.buffer.ptr;
desc.data.size = buf->indices.data_size;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -45,7 +45,7 @@ import "core:mem"
import "core:slice"
import "core:unicode"
//#region("Proc overload mappings")
//region Proc overload mappings
append :: proc {
append_elem,
@@ -146,4 +146,4 @@ vec2_64 :: proc {
vec2_64_from_vec2,
}
//#endregion("Proc overload mappings")
//endregion Proc overload mappings

View File

@@ -103,7 +103,7 @@ Context :: struct {
default_curve_quality : i32,
}
//#region("Init Params")
//region Init Params
Init_Atlas_Params :: struct {
size_multiplier : u32, // How much to scale the the atlas size to. (Affects everything, the base is 4096 x 2048 and everything follows from there)
@@ -169,9 +169,9 @@ Init_Shape_Cache_Params_Default :: Init_Shape_Cache_Params {
reserve = 128,
}
//#endregion("Init Params")
//endregion Init Params
//#region("lifetime")
//region lifetime
// ve_fontcache_init
startup :: proc( ctx : ^Context, parser_kind : Parser_Kind = .STB_TrueType, // Note(Ed): Only sbt_truetype supported for now.
@@ -618,9 +618,9 @@ clear_shape_cache :: proc (ctx : ^Context)
ctx.shape_cache.next_cache_id = 0
}
//#endregion("lifetime")
//endregion lifetime
//#region("shaping")
//region shaping
// For high performance, the user should track the shapes and use the draw list interface on shapes.
// Doing so avoids cache lookups.
@@ -674,9 +674,9 @@ shape_text_uncached :: #force_inline proc( ctx : ^Context, font : Font_ID, px_si
return
}
//#endregion("shaping")
//endregion shaping
//#region("draw_list generation")
//region draw_list generation
/* The most basic interface-level draw shape procedure.
Context's stack is not used. Only modifications for alpha sharpen and px_scalar are applied.
@@ -1135,9 +1135,9 @@ flush_draw_list_layer :: #force_inline proc( ctx : ^Context ) {
ctx.draw_layer.calls_offset = len(ctx.draw_list.calls)
}
//#endregion("draw_list generation")
//endregion draw_list generation
//#region("metrics")
//region metrics
// The metrics follow the convention for providing their values unscaled from ctx.px_scalar
// Where its assumed when utilizing the draw_list generators or shaping procedures that the shape will be affected by it so it must be handled.
@@ -1192,9 +1192,9 @@ get_font_vertical_metrics :: #force_inline proc ( ctx : Context, font : Font_ID,
return
}
//#endregion("metrics")
//endregion metrics
//#region("miscellaneous")
//region miscellaneous
get_font_entry :: #force_inline proc "contextless" ( ctx : ^Context, font : Font_ID ) -> Entry {
return ctx.entries[font]
@@ -1279,9 +1279,9 @@ set_snap_glyph_render_height :: #force_inline proc( ctx : ^Context, should_snap
ctx.glyph_buffer.snap_glyph_height = cast(f32) i32(should_snap)
}
//#endregion("miscellaneous")
//endregion miscellaneous
//#region("scope stack")
//region scope stack
/* Scope stacking ease of use interface.
@@ -1361,4 +1361,4 @@ auto_pop_vpz :: #force_inline proc( ctx : ^Context, camera : VPZ_Transform ) {
pop(& ctx.stack.zoom )
}
//#endregion("scope stack")
//endregion scope stack