mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-06 06:52:44 -07:00
sokol demo works
Just need to port over the original implementation now
This commit is contained in:
@@ -130,7 +130,6 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
|||||||
},
|
},
|
||||||
cull_mode = .NONE,
|
cull_mode = .NONE,
|
||||||
sample_count = 1,
|
sample_count = 1,
|
||||||
// label =
|
|
||||||
})
|
})
|
||||||
assert( gfx.query_pipeline_state(glyph_pipeline) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
assert( gfx.query_pipeline_state(glyph_pipeline) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||||
}
|
}
|
||||||
@@ -147,8 +146,6 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
|||||||
usage = .IMMUTABLE,
|
usage = .IMMUTABLE,
|
||||||
pixel_format = .R8,
|
pixel_format = .R8,
|
||||||
sample_count = 1,
|
sample_count = 1,
|
||||||
// TODO(Ed): Setup labels for debug tracing/logging
|
|
||||||
// label =
|
|
||||||
})
|
})
|
||||||
assert( gfx.query_image_state(glyph_rt_color) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
assert( gfx.query_image_state(glyph_rt_color) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||||
|
|
||||||
@@ -318,7 +315,6 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
|||||||
|
|
||||||
color_attach := Attachment_Desc {
|
color_attach := Attachment_Desc {
|
||||||
image = atlas_rt_color,
|
image = atlas_rt_color,
|
||||||
// mip_level = 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
atlas_attachments := gfx.make_attachments({
|
atlas_attachments := gfx.make_attachments({
|
||||||
@@ -354,7 +350,6 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
|||||||
atlas_pass = gfx.Pass {
|
atlas_pass = gfx.Pass {
|
||||||
action = atlas_action,
|
action = atlas_action,
|
||||||
attachments = atlas_attachments,
|
attachments = atlas_attachments,
|
||||||
// label =
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +441,6 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
|||||||
|
|
||||||
screen_pass = gfx.Pass {
|
screen_pass = gfx.Pass {
|
||||||
action = screen_action,
|
action = screen_action,
|
||||||
// label =
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,7 +452,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
|||||||
|
|
||||||
Bindings :: gfx.Bindings
|
Bindings :: gfx.Bindings
|
||||||
Range :: gfx.Range
|
Range :: gfx.Range
|
||||||
ShaderStage :: gfx.Shader_Stage
|
Shader_Stage :: gfx.Shader_Stage
|
||||||
|
|
||||||
vbuf_layer_slice, ibuf_layer_slice, calls_layer_slice := ve.get_draw_list_layer( ve_ctx )
|
vbuf_layer_slice, ibuf_layer_slice, calls_layer_slice := ve.get_draw_list_layer( ve_ctx )
|
||||||
|
|
||||||
@@ -542,7 +536,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
|||||||
gfx.apply_pipeline( atlas_pipeline )
|
gfx.apply_pipeline( atlas_pipeline )
|
||||||
|
|
||||||
fs_uniform := Blit_Atlas_Fs_Params { region = cast(i32) draw_call.region }
|
fs_uniform := Blit_Atlas_Fs_Params { region = cast(i32) draw_call.region }
|
||||||
gfx.apply_uniforms( ShaderStage.FS, SLOT_blit_atlas_fs_params, Range { & fs_uniform, size_of(Blit_Atlas_Fs_Params) })
|
gfx.apply_uniforms( Shader_Stage.FS, SLOT_blit_atlas_fs_params, Range { & fs_uniform, size_of(Blit_Atlas_Fs_Params) })
|
||||||
|
|
||||||
gfx.apply_bindings(Bindings {
|
gfx.apply_bindings(Bindings {
|
||||||
vertex_buffers = {
|
vertex_buffers = {
|
||||||
@@ -589,7 +583,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
|||||||
src_rt = glyph_rt_color
|
src_rt = glyph_rt_color
|
||||||
src_sampler = glyph_rt_sampler
|
src_sampler = glyph_rt_sampler
|
||||||
}
|
}
|
||||||
gfx.apply_uniforms( ShaderStage.FS, SLOT_draw_text_fs_params, Range { & fs_target_uniform, size_of(Draw_Text_Fs_Params) })
|
gfx.apply_uniforms( Shader_Stage.FS, SLOT_draw_text_fs_params, Range { & fs_target_uniform, size_of(Draw_Text_Fs_Params) })
|
||||||
|
|
||||||
gfx.apply_bindings(Bindings {
|
gfx.apply_bindings(Bindings {
|
||||||
vertex_buffers = {
|
vertex_buffers = {
|
||||||
|
@@ -219,7 +219,7 @@ init :: proc "c" ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator )
|
ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator )
|
||||||
ve_sokol.setup_gfx_objects( & demo_ctx.render_ctx, & demo_ctx.ve_ctx, vert_cap = 128 * 1024, index_cap = 64 * 1024 )
|
ve_sokol.setup_gfx_objects( & demo_ctx.render_ctx, & demo_ctx.ve_ctx, vert_cap = 1024 * 1024, index_cap = 1024 * 1024 )
|
||||||
|
|
||||||
error : mem.Allocator_Error
|
error : mem.Allocator_Error
|
||||||
demo_ctx.font_ids, error = make( map[string]FontDef, 256 )
|
demo_ctx.font_ids, error = make( map[string]FontDef, 256 )
|
||||||
@@ -240,9 +240,21 @@ frame :: proc "c" ()
|
|||||||
{
|
{
|
||||||
ve.configure_snap( & demo_ctx.ve_ctx, u32(Screen_Size.x), u32(Screen_Size.y) )
|
ve.configure_snap( & demo_ctx.ve_ctx, u32(Screen_Size.x), u32(Screen_Size.y) )
|
||||||
|
|
||||||
draw_text_string_pos_extent( "Hello VEFontCache!", demo_ctx.font_firacode, 24, {0, 0}, Color_White )
|
ve.set_colour( & demo_ctx.ve_ctx, ve.Colour { 1.0, 1.0, 1.0, 1.0 })
|
||||||
|
|
||||||
ve_sokol.render_text_layer( Screen_Size, & demo_ctx.ve_ctx, demo_ctx.render_ctx )
|
ve_id, size := font_provider_resolve_draw_id( demo_ctx.font_firacode, 100 )
|
||||||
|
ve.draw_text(
|
||||||
|
& demo_ctx.ve_ctx,
|
||||||
|
ve_id,
|
||||||
|
"Hello VE FONT CACHE???",
|
||||||
|
Vec2{0.1, 0.1},
|
||||||
|
Vec2{1 / Screen_Size.x, 1 / Screen_Size.y }
|
||||||
|
)
|
||||||
|
|
||||||
|
draw_text_string_pos_extent( "Hello VEFontCache!", demo_ctx.font_firacode, 48, {0, 0}, Color_White )
|
||||||
|
draw_text_string_pos_norm( "Hello VEFontCache!", demo_ctx.font_firacode, 24, {0, 0}, Color_White )
|
||||||
|
|
||||||
|
ve_sokol.render_text_layer( Screen_Size * 0.5, & demo_ctx.ve_ctx, demo_ctx.render_ctx )
|
||||||
}
|
}
|
||||||
gfx.commit()
|
gfx.commit()
|
||||||
ve.flush_draw_list( & demo_ctx.ve_ctx )
|
ve.flush_draw_list( & demo_ctx.ve_ctx )
|
||||||
|
@@ -94,10 +94,10 @@ function build-SokolBackendDemo
|
|||||||
# $build_args += $flag_micro_architecture_native
|
# $build_args += $flag_micro_architecture_native
|
||||||
$build_args += $flag_use_separate_modules
|
$build_args += $flag_use_separate_modules
|
||||||
$build_args += $flag_thread_count + $CoreCount_Physical
|
$build_args += $flag_thread_count + $CoreCount_Physical
|
||||||
# $build_args += $flag_optimize_none
|
$build_args += $flag_optimize_none
|
||||||
# $build_args += $flag_optimize_minimal
|
# $build_args += $flag_optimize_minimal
|
||||||
# $build_args += $flag_optimize_speed
|
# $build_args += $flag_optimize_speed
|
||||||
$build_args += $falg_optimize_aggressive
|
# $build_args += $falg_optimize_aggressive
|
||||||
$build_args += $flag_debug
|
$build_args += $flag_debug
|
||||||
$build_args += $flag_pdb_name + $pdb
|
$build_args += $flag_pdb_name + $pdb
|
||||||
$build_args += $flag_subsystem + 'windows'
|
$build_args += $flag_subsystem + 'windows'
|
||||||
|
Reference in New Issue
Block a user