Finally got a letter on the screen with the VEFontCache port

This commit is contained in:
Edward R. Gonzalez 2024-06-15 04:29:10 -04:00
parent 569ce5ce99
commit 5f09c22f11
9 changed files with 337 additions and 297 deletions

View File

@ -81,9 +81,8 @@ blit_quad :: proc( draw_list : ^DrawList, p0 : Vec2 = {0, 0}, p1 : Vec2 = {1, 1}
for index : i32 = 0; index < 6; index += 1 {
append( & draw_list.indices, v_offset + quad_indices[ index ] )
}
draw_list_vert_slice := array_to_slice(draw_list.vertices)
draw_list_index_slice := array_to_slice(draw_list.indices)
// draw_list_vert_slice := array_to_slice(draw_list.vertices)
// draw_list_index_slice := array_to_slice(draw_list.indices)
return
}
@ -100,7 +99,7 @@ directly_draw_massive_glyph :: proc( ctx : ^Context, entry : ^Entry, glyph : Gly
// Draw un-antialiased glyph to update FBO.
glyph_draw_scale := over_sample * entry.size_scale
glyph_draw_translate := - Vec2{ f32(bounds_0.x), f32(bounds_0.y)} * glyph_draw_scale + Vec2{ f32(ctx.atlas.glyph_padding), f32(ctx.atlas.glyph_padding) }
glyph_draw_translate := Vec2{ f32(-bounds_0.x), f32(-bounds_0.y)} * glyph_draw_scale + Vec2{ f32(ctx.atlas.glyph_padding), f32(ctx.atlas.glyph_padding) }
screenspace_x_form( & glyph_draw_translate, & glyph_draw_scale, f32(ctx.atlas.buffer_width), f32(ctx.atlas.buffer_height) )
cache_glyph( ctx, entry.id, glyph, glyph_draw_scale, glyph_draw_translate )
@ -126,6 +125,7 @@ directly_draw_massive_glyph :: proc( ctx : ^Context, entry : ^Entry, glyph : Gly
dst_height := scale.y * glyph_dst_height
dst.x -= scale.x * f32(ctx.atlas.glyph_padding)
dst.y -= scale.y * f32(ctx.atlas.glyph_padding)
dst_size := Vec2{ dst_width, dst_height }
glyph_size := Vec2 { glyph_width, glyph_height }
textspace_x_form( & glyph_position, & glyph_size, f32(ctx.atlas.buffer_width), f32(ctx.atlas.buffer_height) )
@ -137,7 +137,7 @@ directly_draw_massive_glyph :: proc( ctx : ^Context, entry : ^Entry, glyph : Gly
pass = .Target_Uncached
colour = ctx.colour
start_index = u32(ctx.draw_list.indices.num)
blit_quad( & ctx.draw_list, dst, dst + { dst_width, dst_height }, glyph_position, glyph_position + glyph_size )
blit_quad( & ctx.draw_list, dst, dst + dst_size, glyph_position, glyph_position + glyph_size )
end_index = u32(ctx.draw_list.indices.num)
append( & ctx.draw_list.calls, call )
}

View File

@ -81,7 +81,7 @@ render :: proc()
{
// text_test_str := str_fmt("frametime: %v", frametime_avg_ms)
// text_test_str := str_fmt("HELLO VE FONT CACHE!!!!!")
text_test_str := str_fmt("A")
text_test_str := str_fmt("AB")
// font_provider := & state.font_provider_data
fdef := hmap_chained_get( font_cache, default_font.key )
@ -92,7 +92,7 @@ render :: proc()
ve.set_colour( & ve_font_cache, { 1.0, 1.0, 1.0, 1.0 } )
ve.configure_snap( & ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) )
ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {0.5, 0.0}, Vec2{1 / width, 1 / height} )
ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {0.2, 0.4}, Vec2{1 / width, 1 / height} )
}
// Process the draw calls for drawing text
@ -161,8 +161,8 @@ render :: proc()
}
sokol_gfx.begin_pass( pass )
sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true )
sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true )
// sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true )
// sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true )
sokol_gfx.apply_pipeline( atlas_pipeline )
@ -205,17 +205,18 @@ render :: proc()
sokol_gfx.apply_pipeline( screen_pipeline )
src_rt := atlas_rt_color
src_rt := atlas_rt_color
src_sampler := atlas_rt_sampler
fs_target_uniform := Ve_Draw_Text_Fs_Params {
// down_sample = draw_call.pass == .Target_Uncached ? 1 : 0,
down_sample = 0,
colour = {1, 1, 1, 1},
}
if draw_call.pass == .Target_Uncached {
fs_target_uniform.down_sample = 1
src_rt = glyph_rt_color
src_rt = glyph_rt_color
src_sampler = glyph_rt_sampler
}
sokol_gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_draw_text_fs_params, Range { & fs_target_uniform, size_of(Ve_Draw_Text_Fs_Params) })
@ -230,7 +231,7 @@ render :: proc()
index_buffer_offset = 0,//i32(draw_call.start_index) * size_of(u32),
fs = {
images = { SLOT_ve_draw_text_src_texture = src_rt, },
samplers = { SLOT_ve_draw_text_src_sampler = glyph_rt_sampler, },
samplers = { SLOT_ve_draw_text_src_sampler = src_sampler, },
},
})
}

View File

@ -31,9 +31,6 @@ FontProviderData :: struct
ve_font_cache : ve.Context,
font_cache : HMapChained(FontDef),
gfx_sampler : sokol_gfx.Sampler,
glyph_rt_sampler : sokol_gfx.Sampler,
draw_list_vbuf : sokol_gfx.Buffer,
draw_list_ibuf : sokol_gfx.Buffer,
@ -45,11 +42,13 @@ FontProviderData :: struct
glyph_rt_color : sokol_gfx.Image,
glyph_rt_depth : sokol_gfx.Image,
// glyph_rt_resolve : sokol_gfx.Image,
glyph_rt_sampler : sokol_gfx.Sampler,
// 4k x 2k, R8
atlas_rt_color : sokol_gfx.Image,
atlas_rt_depth : sokol_gfx.Image,
// atlas_rt_resolve : sokol_gfx.Image,
atlas_rt_sampler : sokol_gfx.Sampler,
glyph_pipeline : sokol_gfx.Pipeline,
atlas_pipeline : sokol_gfx.Pipeline,
@ -127,36 +126,21 @@ font_provider_startup :: proc()
})
verify( sokol_gfx.query_buffer_state( draw_list_ibuf) < ResourceState.FAILED, "Failed to make draw_list_iubuf" )
gfx_sampler = sokol_gfx.make_sampler( SamplerDescription {
min_filter = Filter.NEAREST,
mag_filter = Filter.NEAREST,
mipmap_filter = Filter.NONE,
// wrap_u = Wrap.CLAMP_TO_EDGE,
// wrap_v = Wrap.CLAMP_TO_EDGE,
wrap_u = .REPEAT,
wrap_v = .REPEAT,
min_lod = -1000.0,
max_lod = 1000.0,
border_color = BorderColor.OPAQUE_BLACK,
compare = .NEVER
})
verify( sokol_gfx.query_sampler_state( gfx_sampler) < ResourceState.FAILED, "Failed to make gfx_sampler" )
// glyph_pipeline
{
vs_layout : VertexLayoutState
{
using vs_layout
attrs[ATTR_ve_render_glyph_vs_v_elem] = VertexAttributeState {
format = VertexFormat.FLOAT4,
attrs[ATTR_ve_render_glyph_vs_v_position] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = 0,
buffer_index = 0,
}
// attrs[ATTR_ve_render_glyph_vs_v_texture] = VertexAttributeState {
// format = VertexFormat.FLOAT2,
// offset = size_of(Vec2),
// buffer_index = 0,
// }
attrs[ATTR_ve_render_glyph_vs_v_texture] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = size_of(Vec2),
buffer_index = 0,
}
buffers[0] = VertexBufferLayoutState {
stride = size_of([4]f32),
step_func = VertexStep.PER_VERTEX
@ -226,6 +210,19 @@ font_provider_startup :: proc()
sample_count = 1,
})
glyph_rt_sampler = sokol_gfx.make_sampler( SamplerDescription {
min_filter = Filter.NEAREST,
mag_filter = Filter.NEAREST,
mipmap_filter = Filter.NONE,
wrap_u = .CLAMP_TO_EDGE,
wrap_v = .CLAMP_TO_EDGE,
min_lod = -1000.0,
max_lod = 1000.0,
border_color = BorderColor.OPAQUE_BLACK,
compare = .NEVER
})
verify( sokol_gfx.query_sampler_state( glyph_rt_sampler) < ResourceState.FAILED, "Failed to make atlas_rt_sampler" )
color_attach := AttachmentDesc {
image = glyph_rt_color,
// mip_level = 1,
@ -244,10 +241,10 @@ font_provider_startup :: proc()
glyph_action := PassAction {
colors = {
0 = {
load_action = .LOAD,
load_action = .CLEAR,
store_action = .STORE,
// clear_value = {0.01,0.01,0.01,1},
clear_value = {0.10, 0.10, 0.10, 1.00},
clear_value = {0.00, 0.00, 0.00, 1.00},
}
}
}
@ -264,16 +261,16 @@ font_provider_startup :: proc()
vs_layout : VertexLayoutState
{
using vs_layout
attrs[ATTR_ve_blit_atlas_vs_v_elem] = VertexAttributeState {
format = VertexFormat.FLOAT4,
attrs[ATTR_ve_blit_atlas_vs_v_position] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = 0,
buffer_index = 0,
}
// attrs[ATTR_ve_blit_atlas_vs_v_texture] = VertexAttributeState {
// format = VertexFormat.FLOAT2,
// offset = size_of(Vec2),
// buffer_index = 0,
// }
attrs[ATTR_ve_blit_atlas_vs_v_texture] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = size_of(Vec2),
buffer_index = 0,
}
buffers[0] = VertexBufferLayoutState {
stride = size_of([4]f32),
step_func = VertexStep.PER_VERTEX
@ -342,7 +339,7 @@ font_provider_startup :: proc()
})
verify( sokol_gfx.query_image_state(atlas_rt_depth) < ResourceState.FAILED, "Failed to make atlas_rt_depth")
glyph_rt_sampler = sokol_gfx.make_sampler( SamplerDescription {
atlas_rt_sampler = sokol_gfx.make_sampler( SamplerDescription {
min_filter = Filter.NEAREST,
mag_filter = Filter.NEAREST,
mipmap_filter = Filter.NONE,
@ -353,7 +350,7 @@ font_provider_startup :: proc()
border_color = BorderColor.OPAQUE_BLACK,
compare = .NEVER
})
verify( sokol_gfx.query_sampler_state( gfx_sampler) < ResourceState.FAILED, "Failed to make gfx_sampler" )
verify( sokol_gfx.query_sampler_state( atlas_rt_sampler) < ResourceState.FAILED, "Failed to make atlas_rt_sampler" )
color_attach := AttachmentDesc {
image = atlas_rt_color,
@ -373,9 +370,9 @@ font_provider_startup :: proc()
atlas_action := PassAction {
colors = {
0 = {
load_action = .DONTCARE,
load_action = .LOAD,
store_action = .STORE,
clear_value = {0.01, 0.01, 0.01, 1.0},
clear_value = {0.00, 0.00, 0.00, 1.0},
}
}
}
@ -392,16 +389,16 @@ font_provider_startup :: proc()
vs_layout : VertexLayoutState
{
using vs_layout
attrs[ATTR_ve_draw_text_vs_v_elem] = VertexAttributeState {
format = VertexFormat.FLOAT4,
attrs[ATTR_ve_draw_text_vs_v_position] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = 0,
buffer_index = 0,
}
// attrs[ATTR_ve_draw_text_vs_v_texture] = VertexAttributeState {
// format = VertexFormat.FLOAT2,
// offset = size_of(Vec2),
// buffer_index = 0,
// }
attrs[ATTR_ve_draw_text_vs_v_texture] = VertexAttributeState {
format = VertexFormat.FLOAT2,
offset = size_of(Vec2),
buffer_index = 0,
}
buffers[0] = VertexBufferLayoutState {
stride = size_of([4]f32),
step_func = VertexStep.PER_VERTEX
@ -433,10 +430,10 @@ font_provider_startup :: proc()
sample_count = 1,
depth = {
pixel_format = app_env.defaults.depth_format,
compare = .ALWAYS,
write_enabled = true,
// compare = .ALWAYS,
// write_enabled = true,
},
cull_mode = .NONE,
// cull_mode = .NONE,
})
verify( sokol_gfx.query_pipeline_state(screen_pipeline) < ResourceState.FAILED, "Failed to make screen_pipeline" )
}
@ -448,7 +445,7 @@ font_provider_startup :: proc()
0 = {
load_action = .CLEAR,
store_action = .STORE,
clear_value = {0.0,0.0,0.0,1.0},
clear_value = {0.0, 0.0, 0.0, 1.0},
}
}
}
@ -509,7 +506,7 @@ font_load :: proc(path_file : string,
def.path_file = path_file
// TODO(Ed): Load even sizes from 8px to upper bound.
def.ve_id = ve.load_font( & provider_data.ve_font_cache, desired_id, font_data, 72.0 )
def.ve_id = ve.load_font( & provider_data.ve_font_cache, desired_id, font_data, 200.0 )
fid := FontID { key, desired_id }
return fid

View File

@ -14,7 +14,8 @@ import sg "thirdparty:sokol/gfx"
Get shader desc: ve_blit_atlas_shader_desc(sg.query_backend())
Vertex shader: ve_blit_atlas_vs
Attributes:
ATTR_ve_blit_atlas_vs_v_elem => 0
ATTR_ve_blit_atlas_vs_v_position => 0
ATTR_ve_blit_atlas_vs_v_texture => 1
Fragment shader: ve_blit_atlas_fs
Uniform block 've_blit_atlas_fs_params':
Odin struct: Ve_Blit_Atlas_Fs_Params
@ -31,7 +32,8 @@ import sg "thirdparty:sokol/gfx"
Image: ve_blit_atlas_src_texture
Sampler: ve_blit_atlas_src_sampler
*/
ATTR_ve_blit_atlas_vs_v_elem :: 0
ATTR_ve_blit_atlas_vs_v_position :: 0
ATTR_ve_blit_atlas_vs_v_texture :: 1
SLOT_ve_blit_atlas_fs_params :: 0
SLOT_ve_blit_atlas_src_texture :: 0
SLOT_ve_blit_atlas_src_sampler :: 0
@ -44,11 +46,13 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
/*
static float4 gl_Position;
static float2 uv;
static float4 v_elem;
static float2 v_texture;
static float2 v_position;
struct SPIRV_Cross_Input
{
float4 v_elem : TEXCOORD0;
float2 v_position : TEXCOORD0;
float2 v_texture : TEXCOORD1;
};
struct SPIRV_Cross_Output
@ -59,13 +63,14 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
void vert_main()
{
uv = v_elem.zw;
gl_Position = float4(v_elem.xy, 0.0f, 1.0f);
uv = float2(v_texture.x, 1.0f - v_texture.y);
gl_Position = float4(v_position, 0.0f, 1.0f);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v_elem = stage_input.v_elem;
v_texture = stage_input.v_texture;
v_position = stage_input.v_position;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
@ -74,48 +79,57 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
}
*/
@(private)
ve_blit_atlas_vs_source_hlsl4 := [560]u8 {
ve_blit_atlas_vs_source_hlsl4 := [705]u8 {
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,
0x6d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,
0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,0x6d,
0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,
0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,
0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,
0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,
0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x28,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x2c,0x20,0x30,0x2e,
0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,
0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
0x75,0x72,0x65,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,
0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,
0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,
0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,
0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x76,0x5f,0x74,
0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,
0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,0x74,
0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,
0x74,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,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,0x76,0x5f,0x65,0x6c,0x65,
0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x76,0x5f,0x65,0x6c,0x65,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,
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,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,
0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,
0x75,0x76,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,
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,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,
0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,
0x20,0x75,0x76,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,
}
/*
cbuffer ve_blit_atlas_fs_params : register(b0)
{
int _84_region : packoffset(c0);
int _83_region : packoffset(c0);
};
Texture2D<float4> ve_blit_atlas_src_texture : register(t0);
@ -141,26 +155,26 @@ ve_blit_atlas_vs_source_hlsl4 := [560]u8 {
void frag_main()
{
bool _92 = _84_region == 0;
bool _100;
if (!_92)
bool _88 = _83_region == 0;
bool _96;
if (!_88)
{
_100 = _84_region == 1;
_96 = _83_region == 1;
}
else
{
_100 = _92;
_96 = _88;
}
bool _108;
if (!_100)
bool _104;
if (!_96)
{
_108 = _84_region == 2;
_104 = _83_region == 2;
}
else
{
_108 = _100;
_104 = _96;
}
if (_108)
if (_104)
{
float2 param = uv + float2(-0.00048828125f, -0.0029296875f);
float2 param_1 = float2(0.00048828125f, 0.001953125f);
@ -174,7 +188,7 @@ ve_blit_atlas_vs_source_hlsl4 := [560]u8 {
}
else
{
frag_color = float4(1.0f, 0.0f, 0.0f, 0.0500000007450580596923828125f);
frag_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
}
@ -188,11 +202,11 @@ ve_blit_atlas_vs_source_hlsl4 := [560]u8 {
}
*/
@(private)
ve_blit_atlas_fs_source_hlsl4 := [2167]u8 {
ve_blit_atlas_fs_source_hlsl4 := [2135]u8 {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,
0x61,0x74,0x6c,0x61,0x73,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,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,
0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,
0x69,0x6f,0x6e,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,
0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x54,0x65,0x78,0x74,0x75,0x72,
0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x3e,0x20,0x76,0x65,0x5f,0x62,
@ -242,75 +256,73 @@ ve_blit_atlas_fs_source_hlsl4 := [2167]u8 {
0x72,0x2c,0x20,0x75,0x76,0x5f,0x31,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
0x65,0x5f,0x73,0x69,0x7a,0x65,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,
0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x32,0x20,0x3d,
0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x30,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x32,0x29,0x0a,0x20,
0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,
0x30,0x20,0x3d,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,
0x3d,0x20,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,
0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x5f,0x31,0x30,0x30,0x20,0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,
0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30,0x30,
0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x5f,0x31,0x30,0x38,0x20,0x3d,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f,
0x6e,0x20,0x3d,0x3d,0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,
0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x38,0x20,0x3d,0x20,0x5f,0x31,0x30,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,
0x5f,0x31,0x30,0x38,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x38,0x38,0x20,0x3d,
0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,0x30,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x36,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x38,0x38,0x29,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x39,0x36,0x20,
0x3d,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,
0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,
0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x5f,0x39,0x36,0x20,0x3d,0x20,0x5f,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x36,0x29,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34,
0x20,0x3d,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,
0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,
0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x30,0x34,0x29,
0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x75,0x76,
0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,
0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,
0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,
0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,
0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,
0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,
0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,
0x36,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,
0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,
0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,
0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,
0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,
0x30,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,
0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,
0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,
0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,
0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
0x5f,0x36,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,
0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,
0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,
0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,
0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,
0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,
0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,
0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,
0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,
0x2e,0x32,0x35,0x66,0x20,0x2a,0x20,0x28,0x28,0x28,0x64,0x6f,0x77,0x6e,0x5f,0x73,
0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,
0x61,0x6d,0x5f,0x31,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,
0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,
0x61,0x6d,0x5f,0x33,0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,
0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,
0x72,0x61,0x6d,0x5f,0x35,0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,
0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20,0x70,
0x61,0x72,0x61,0x6d,0x5f,0x37,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x66,
0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,
0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30,
0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x37,0x33,0x32,0x34,
0x32,0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,
0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,
0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,
0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20,
0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,
0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,
0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,
0x6d,0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,
0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,
0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,
0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x32,0x35,0x66,0x20,
0x2a,0x20,0x28,0x28,0x28,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,
0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,
0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,
0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,
0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,
0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x37,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,
0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x7d,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,
@ -333,6 +345,8 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
case .D3D11:
desc.attrs[0].sem_name = "TEXCOORD"
desc.attrs[0].sem_index = 0
desc.attrs[1].sem_name = "TEXCOORD"
desc.attrs[1].sem_index = 1
desc.vs.source = transmute(cstring)&ve_blit_atlas_vs_source_hlsl4
desc.vs.d3d11_target = "vs_4_0"
desc.vs.entry = "main"

View File

@ -32,7 +32,6 @@ void main()
{
// TODO(Ed): The original author made these consts, I want to instead expose as uniforms...
const vec2 texture_size = 1.0f / vec2( 2048.0f, 512.0f ); // VEFontCache.Context.buffer_width/buffer_height
int something = region;
if ( region == 0 || region == 1 || region == 2 )
{
float alpha =
@ -44,7 +43,7 @@ void main()
}
else
{
frag_color = vec4( 1.0f, 0.0f, 0.0f, 0.05f );
frag_color = vec4( 0.0f, 0.0f, 0.0f, 1.0 );
}
}
@end

View File

@ -14,7 +14,8 @@ import sg "thirdparty:sokol/gfx"
Get shader desc: ve_draw_text_shader_desc(sg.query_backend())
Vertex shader: ve_draw_text_vs
Attributes:
ATTR_ve_draw_text_vs_v_elem => 0
ATTR_ve_draw_text_vs_v_position => 0
ATTR_ve_draw_text_vs_v_texture => 1
Fragment shader: ve_draw_text_fs
Uniform block 've_draw_text_fs_params':
Odin struct: Ve_Draw_Text_Fs_Params
@ -31,7 +32,8 @@ import sg "thirdparty:sokol/gfx"
Image: ve_draw_text_src_texture
Sampler: ve_draw_text_src_sampler
*/
ATTR_ve_draw_text_vs_v_elem :: 0
ATTR_ve_draw_text_vs_v_position :: 0
ATTR_ve_draw_text_vs_v_texture :: 1
SLOT_ve_draw_text_fs_params :: 0
SLOT_ve_draw_text_src_texture :: 0
SLOT_ve_draw_text_src_sampler :: 0
@ -45,11 +47,13 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) {
/*
static float4 gl_Position;
static float2 uv;
static float4 v_elem;
static float2 v_texture;
static float2 v_position;
struct SPIRV_Cross_Input
{
float4 v_elem : TEXCOORD0;
float2 v_position : TEXCOORD0;
float2 v_texture : TEXCOORD1;
};
struct SPIRV_Cross_Output
@ -60,13 +64,14 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) {
void vert_main()
{
uv = v_elem.zw;
gl_Position = float4((v_elem.xy * 2.0f) - 1.0f.xx, 0.0f, 1.0f);
uv = float2(v_texture.x, 1.0f - v_texture.y);
gl_Position = float4((v_position * 2.0f) - 1.0f.xx, 0.0f, 1.0f);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v_elem = stage_input.v_elem;
v_texture = stage_input.v_texture;
v_position = stage_input.v_position;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
@ -75,44 +80,53 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) {
}
*/
@(private)
ve_draw_text_vs_source_hlsl4 := [579]u8 {
ve_draw_text_vs_source_hlsl4 := [724]u8 {
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,
0x6d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,
0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,0x6d,
0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,
0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,
0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,
0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,
0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x28,0x28,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x20,0x2a,0x20,
0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,0x78,0x2c,
0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,
0x65,0x6c,0x65,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,
0x75,0x74,0x2e,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,
0x65,0x72,0x74,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,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,
0x20,0x3d,0x20,0x75,0x76,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,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,
0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
0x75,0x72,0x65,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,
0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,
0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,
0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,
0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x76,0x5f,0x74,
0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x28,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,
0x78,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,
0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,
0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,
0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x76,0x65,0x72,0x74,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,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,
0x76,0x20,0x3d,0x20,0x75,0x76,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,
}
/*
cbuffer ve_draw_text_fs_params : register(b0)
@ -144,7 +158,7 @@ ve_draw_text_vs_source_hlsl4 := [579]u8 {
{
alpha = 0.25f * (((ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(-0.000244140625f, -0.0009765625f)).x + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(-0.000244140625f, 0.0009765625f)).x) + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(0.000244140625f, -0.0009765625f)).x) + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(0.000244140625f, 0.0009765625f)).x);
}
frag_color = float4(_31_colour.xyz, mad(_31_colour.w, alpha, 0.0500000007450580596923828125f));
frag_color = float4(_31_colour.xyz, _31_colour.w * alpha);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
@ -157,7 +171,7 @@ ve_draw_text_vs_source_hlsl4 := [579]u8 {
}
*/
@(private)
ve_draw_text_fs_source_hlsl4 := [1333]u8 {
ve_draw_text_fs_source_hlsl4 := [1296]u8 {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,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,
@ -224,24 +238,22 @@ ve_draw_text_fs_source_hlsl4 := [1333]u8 {
0x32,0x35,0x66,0x29,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x33,0x31,0x5f,0x63,0x6f,0x6c,0x6f,
0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x6d,0x61,0x64,0x28,0x5f,0x33,0x31,0x5f,
0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x2c,0x20,0x61,0x6c,0x70,0x68,0x61,0x2c,
0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,
0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x66,
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,
0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x33,0x31,0x5f,0x63,0x6f,0x6c,0x6f,
0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,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,
}
ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc: sg.Shader_Desc
@ -250,6 +262,8 @@ ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
case .D3D11:
desc.attrs[0].sem_name = "TEXCOORD"
desc.attrs[0].sem_index = 0
desc.attrs[1].sem_name = "TEXCOORD"
desc.attrs[1].sem_index = 1
desc.vs.source = transmute(cstring)&ve_draw_text_vs_source_hlsl4
desc.vs.d3d11_target = "vs_4_0"
desc.vs.entry = "main"

View File

@ -4,15 +4,14 @@
@header import sg "thirdparty:sokol/gfx"
@vs ve_draw_text_vs
// in vec2 v_position;
// in vec2 v_texture;
in vec4 v_elem;
in vec2 v_position;
in vec2 v_texture;
out vec2 uv;
void main()
{
uv = v_elem.zw;
gl_Position = vec4( v_elem.xy * 2.0f - 1.0f, 0.0f, 1.0f );
uv = vec2( v_texture.x, 1 - v_texture.y );
gl_Position = vec4( v_position * 2.0f - 1.0f, 0.0f, 1.0f );
}
@end
@ -41,7 +40,7 @@ void main()
+ (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5f, -0.5f) * texture_size ).x * 0.25f)
+ (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5f, 0.5f) * texture_size ).x * 0.25f);
}
frag_color = vec4( colour.xyz, colour.a * alpha + 0.05f );
frag_color = vec4( colour.xyz, colour.a * alpha );
}
@end

View File

@ -14,18 +14,22 @@ import sg "thirdparty:sokol/gfx"
Get shader desc: ve_render_glyph_shader_desc(sg.query_backend())
Vertex shader: ve_render_glyph_vs
Attributes:
ATTR_ve_render_glyph_vs_v_elem => 0
ATTR_ve_render_glyph_vs_v_position => 0
ATTR_ve_render_glyph_vs_v_texture => 1
Fragment shader: ve_render_glyph_fs
*/
ATTR_ve_render_glyph_vs_v_elem :: 0
ATTR_ve_render_glyph_vs_v_position :: 0
ATTR_ve_render_glyph_vs_v_texture :: 1
/*
static float4 gl_Position;
static float2 uv;
static float4 v_elem;
static float2 v_texture;
static float2 v_position;
struct SPIRV_Cross_Input
{
float4 v_elem : TEXCOORD0;
float2 v_position : TEXCOORD0;
float2 v_texture : TEXCOORD1;
};
struct SPIRV_Cross_Output
@ -36,13 +40,14 @@ ATTR_ve_render_glyph_vs_v_elem :: 0
void vert_main()
{
uv = v_elem.zw;
gl_Position = float4(v_elem.xy, 0.0f, 1.0f);
uv = float2(v_texture.x, 1.0f - v_texture.y);
gl_Position = float4(v_position, 0.0f, 1.0f);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v_elem = stage_input.v_elem;
v_texture = stage_input.v_texture;
v_position = stage_input.v_position;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
@ -51,43 +56,52 @@ ATTR_ve_render_glyph_vs_v_elem :: 0
}
*/
@(private)
ve_render_glyph_vs_source_hlsl4 := [560]u8 {
ve_render_glyph_vs_source_hlsl4 := [705]u8 {
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,
0x6d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,
0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65,0x6d,
0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,
0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,
0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,
0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,
0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,
0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x34,0x28,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x2c,0x20,0x30,0x2e,
0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,
0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,
0x75,0x72,0x65,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,
0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,
0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,
0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,
0x72,0x65,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x76,0x5f,0x74,
0x65,0x78,0x74,0x75,0x72,0x65,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,
0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,0x74,
0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,
0x74,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,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,0x76,0x5f,0x65,0x6c,0x65,
0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
0x76,0x5f,0x65,0x6c,0x65,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,
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,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,
0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,
0x75,0x76,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,
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,
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,
0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,
0x20,0x75,0x76,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,
}
/*
static float4 frag_color;
@ -154,6 +168,8 @@ ve_render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
case .D3D11:
desc.attrs[0].sem_name = "TEXCOORD"
desc.attrs[0].sem_index = 0
desc.attrs[1].sem_name = "TEXCOORD"
desc.attrs[1].sem_index = 1
desc.vs.source = transmute(cstring)&ve_render_glyph_vs_source_hlsl4
desc.vs.d3d11_target = "vs_4_0"
desc.vs.entry = "main"

View File

@ -1,10 +1,10 @@
// in vec2 v_position;
// in vec2 v_texture;
in vec4 v_elem;
in vec2 v_position;
in vec2 v_texture;
// in vec4 v_elem;
out vec2 uv;
void main()
{
uv = v_elem.zw;
gl_Position = vec4( v_elem.xy, 0.0, 1.0 );
uv = vec2( v_texture.x, 1 - v_texture.y );
gl_Position = vec4( v_position, 0.0, 1.0 );
}