accidentally made changes for an old odin-compiler...

This commit is contained in:
2025-04-14 15:08:28 -04:00
parent eaae5f32ca
commit 7e55703066
8 changed files with 36 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
//+build wasm32, wasm64p32
#+build wasm32, wasm64p32
package stb_truetype
@(require) import _ "vendor:libc"

View File

@@ -94,7 +94,7 @@ pool_list_clear :: proc( pool: ^Pool_List($V_Type) )
pool.size = 0
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
pool_list_push_front :: proc( pool : ^Pool_List($V_Type), value : V_Type ) #no_bounds_check
{
if pool.size >= pool.capacity do return
@@ -121,7 +121,7 @@ pool_list_push_front :: proc( pool : ^Pool_List($V_Type), value : V_Type ) #no_b
pool.size += 1
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
pool_list_erase :: proc( pool : ^Pool_List($V_Type), iter : Pool_ListIter ) #no_bounds_check
{
if pool.size <= 0 do return
@@ -150,7 +150,7 @@ pool_list_erase :: proc( pool : ^Pool_List($V_Type), iter : Pool_ListIter ) #no_
}
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
pool_list_move_to_front :: proc "contextless" ( pool : ^Pool_List($V_Type), iter : Pool_ListIter ) #no_bounds_check
{
if pool.front == iter do return
@@ -166,14 +166,14 @@ pool_list_move_to_front :: proc "contextless" ( pool : ^Pool_List($V_Type), iter
pool.front = iter
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
pool_list_peek_back :: #force_inline proc ( pool : Pool_List($V_Type) ) -> V_Type #no_bounds_check {
assert( pool.back != - 1 )
value := pool.items[ pool.back ].value
return value
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
pool_list_pop_back :: #force_inline proc( pool : ^Pool_List($V_Type) ) -> V_Type #no_bounds_check {
if pool.size <= 0 do return 0
assert( pool.back != -1 )
@@ -220,13 +220,13 @@ lru_clear :: proc ( cache : ^LRU_Cache($Key_Type) ) {
cache.num = 0
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
lru_find :: #force_inline proc "contextless" ( cache : LRU_Cache($Key_Type), key : Key_Type, must_find := false ) -> (LRU_Link, bool) #no_bounds_check {
link, success := cache.table[key]
return link, success
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
lru_get :: #force_inline proc ( cache: ^LRU_Cache($Key_Type), key : Key_Type ) -> i32 #no_bounds_check {
if link, ok := &cache.table[ key ]; ok {
pool_list_move_to_front(&cache.key_queue, link.ptr)
@@ -235,7 +235,7 @@ lru_get :: #force_inline proc ( cache: ^LRU_Cache($Key_Type), key : Key_Type ) -
return -1
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
lru_get_next_evicted :: #force_inline proc ( cache : LRU_Cache($Key_Type) ) -> Key_Type #no_bounds_check {
if cache.key_queue.size >= cache.capacity {
evict := pool_list_peek_back( cache.key_queue )
@@ -244,7 +244,7 @@ lru_get_next_evicted :: #force_inline proc ( cache : LRU_Cache($Key_Type) ) -> K
return ~Key_Type(0)
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
lru_peek :: #force_inline proc "contextless" ( cache : LRU_Cache($Key_Type), key : Key_Type, must_find := false ) -> i32 #no_bounds_check {
iter, success := lru_find( cache, key, must_find )
if success == false {
@@ -253,7 +253,7 @@ lru_peek :: #force_inline proc "contextless" ( cache : LRU_Cache($Key_Type), key
return iter.value
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
lru_put :: proc( cache : ^LRU_Cache($Key_Type), key : Key_Type, value : i32 ) -> Key_Type #no_bounds_check
{
// profile(#procedure)

View File

@@ -53,7 +53,7 @@ Atlas :: struct {
}
// Hahser for the atlas.
@(optimization_mode="size")
@(optimization_mode="favor_size")
atlas_glyph_lru_code :: #force_inline proc "contextless" ( font : Font_ID, px_size : f32, glyph_index : Glyph ) -> (lru_code : Atlas_Key) {
// lru_code = u32(glyph_index) + ( ( 0x10000 * u32(font) ) & 0xFFFF0000 )
font := font
@@ -65,7 +65,7 @@ atlas_glyph_lru_code :: #force_inline proc "contextless" ( font : Font_ID, px_si
return
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
atlas_region_bbox :: #force_inline proc( region : Atlas_Region, local_idx : i32 ) -> (position, size: Vec2)
{
size = vec2(region.slot_size)
@@ -78,7 +78,7 @@ atlas_region_bbox :: #force_inline proc( region : Atlas_Region, local_idx : i32
return
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
atlas_decide_region :: #force_inline proc "contextless" (atlas : Atlas, glyph_buffer_size : Vec2, bounds_size_scaled : Vec2 ) -> (region_kind : Atlas_Region_Kind)
{
// profile(#procedure)
@@ -99,7 +99,7 @@ atlas_decide_region :: #force_inline proc "contextless" (atlas : Atlas, glyph_bu
}
// Grab an atlas LRU cache slot.
@(optimization_mode="size")
@(optimization_mode="favor_size")
atlas_reserve_slot :: #force_inline proc ( region : ^Atlas_Region, lru_code : Atlas_Key ) -> (atlas_index : i32)
{
if region.next_idx < region.state.capacity

View File

@@ -100,7 +100,7 @@ Glyph_Draw_Buffer :: struct{
}
// Contructs a quad mesh for bliting a texture from source render target (src uv0 & 1) to the destination render target (p0, p1)
@(optimization_mode="size")
@(optimization_mode="favor_size")
blit_quad :: #force_inline proc ( draw_list : ^Draw_List,
p0 : Vec2 = {0, 0},
p1 : Vec2 = {1, 1},
@@ -140,7 +140,7 @@ blit_quad :: #force_inline proc ( draw_list : ^Draw_List,
}
// Constructs a triangle fan mesh to fill a shape using the provided path outside_point represents the center point of the fan.
@(optimization_mode="size")
@(optimization_mode="favor_size")
fill_path_via_fan_triangulation :: proc( draw_list : ^Draw_List,
outside_point : Vec2,
path : []Vertex,
@@ -178,7 +178,7 @@ fill_path_via_fan_triangulation :: proc( draw_list : ^Draw_List,
}
// Glyph triangulation generator
@(optimization_mode="size")
@(optimization_mode="favor_size")
generate_glyph_pass_draw_list :: proc(draw_list : ^Draw_List, path : ^[dynamic]Vertex,
glyph_shape : Parser_Glyph_Shape,
curve_quality : f32,
@@ -464,7 +464,7 @@ generate_shape_draw_list :: proc( draw_list : ^Draw_List, shape : Shaped_Text,
* Oversized will have a draw call setup to blit directly from the glyph buffer to the target.
* to_cache will blit the glyphs rendered from the buffer to the atlas.
*/
@(optimization_mode = "size")
@(optimization_mode="favor_size")
batch_generate_glyphs_draw_list :: proc ( draw_list : ^Draw_List,
shape : Shaped_Text,
glyph_pack : ^#soa[dynamic]Glyph_Pack_Entry,
@@ -641,7 +641,7 @@ batch_generate_glyphs_draw_list :: proc ( draw_list : ^Draw_List,
}
profile_end()
@(optimization_mode = "size")
@(optimization_mode="favor_size")
generate_blit_from_atlas_draw_list :: #force_inline proc (draw_list : ^Draw_List, glyph_pack : #soa[]Glyph_Pack_Entry, sub_pack : []i32, colour : RGBAN )
{
profile(#procedure)
@@ -781,7 +781,7 @@ flush_glyph_buffer_draw_list :: proc( #no_alias draw_list, glyph_buffer_draw_lis
(allocated_x ^) = 0
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
clear_draw_list :: #force_inline proc ( draw_list : ^Draw_List ) {
clear( & draw_list.calls )
clear( & draw_list.indices )
@@ -789,7 +789,7 @@ clear_draw_list :: #force_inline proc ( draw_list : ^Draw_List ) {
}
// Helper used by flush_glyph_buffer_draw_list. Used to append all the content from the src draw list o the destination.
@(optimization_mode="size")
@(optimization_mode="favor_size")
merge_draw_list :: proc ( #no_alias dst, src : ^Draw_List ) #no_bounds_check
{
profile(#procedure)

View File

@@ -30,7 +30,7 @@ reload_map :: #force_inline proc( self : ^map [$KeyType] $EntryType, allocator :
to_bytes :: #force_inline proc "contextless" ( typed_data : ^$Type ) -> []byte { return slice_ptr( transmute(^byte) typed_data, size_of(Type) ) }
@(optimization_mode="size")
@(optimization_mode="favor_size")
djb8_hash :: #force_inline proc "contextless" ( hash : ^$Type, bytes : []byte ) { for value in bytes do (hash^) = (( (hash^) << 8) + (hash^) ) + Type(value) }
RGBA8 :: [4]u8
@@ -79,7 +79,7 @@ logf :: proc( fmt : string, args : ..any, level := core_log.Level.Info, loc :=
core_log.logf( level, fmt, ..args, location = loc )
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
to_glyph_buffer_space :: #force_inline proc "contextless" ( #no_alias position, scale : ^Vec2, size : Vec2 )
{
pos := position^
@@ -93,7 +93,7 @@ to_glyph_buffer_space :: #force_inline proc "contextless" ( #no_alias position,
(scale^) = scale_32
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
to_target_space :: #force_inline proc "contextless" ( #no_alias position, scale : ^Vec2, size : Vec2 )
{
quotient : Vec2 = 1.0 / size
@@ -145,17 +145,17 @@ else
{
Vec2_SIMD :: simd.f32x4
@(optimization_mode="size")
@(optimization_mode="favor_size")
vec2_to_simd :: #force_inline proc "contextless" (v: Vec2) -> Vec2_SIMD {
return Vec2_SIMD{v.x, v.y, 0, 0}
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
simd_to_vec2 :: #force_inline proc "contextless" (v: Vec2_SIMD) -> Vec2 {
return Vec2{ simd.extract(v, 0), simd.extract(v, 1) }
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
eval_point_on_bezier3 :: #force_inline proc "contextless" (p0, p1, p2: Vec2, alpha: f32) -> Vec2
{
simd_p0 := vec2_to_simd(p0)
@@ -179,7 +179,7 @@ else
return simd_to_vec2(result)
}
@(optimization_mode="size")
@(optimization_mode="favor_size")
eval_point_on_bezier4 :: #force_inline proc "contextless" (p0, p1, p2, p3: Vec2, alpha: f32) -> Vec2
{
simd_p0 := vec2_to_simd(p0)

View File

@@ -105,6 +105,7 @@ make :: proc {
builtin.make_dynamic_array_len_cap,
builtin.make_slice,
builtin.make_map,
builtin.make_map_cap,
}
make_soa :: proc {

View File

@@ -109,7 +109,7 @@ shaper_unload_font :: #force_inline proc( info : ^Shaper_Info )
// TODO(Ed): Allow the user to override snap_glyph_position of the shaper context on a per-call basis (as a param)
// Recommended shaper. Very performant.
// TODO(Ed): Would be nice to properly support vertical shaping, right now its strictly just horizontal...
@(optimization_mode="size")
@(optimization_mode="favor_size")
shaper_shape_harfbuzz :: proc( ctx : ^Shaper_Context,
atlas : Atlas,
glyph_buffer_size : Vec2,
@@ -142,7 +142,7 @@ shaper_shape_harfbuzz :: proc( ctx : ^Shaper_Context,
position : Vec2
@(optimization_mode="size")
@(optimization_mode="favor_size")
shape_run :: proc( output : ^Shaped_Text,
entry : Entry,
buffer : harfbuzz.Buffer,
@@ -428,7 +428,7 @@ shaper_shape_text_latin :: proc( ctx : ^Shaper_Context,
// Thus this procedures cost will be proporitonal to how much text it has to sift through.
// djb8_hash is used as its been pretty good for thousands of hashed lines that around 6-250 charactes long
// (and its very fast).
@(optimization_mode="size")
@(optimization_mode="favor_size")
shaper_shape_text_cached :: proc( text_utf8 : string,
ctx : ^Shaper_Context,
shape_cache : ^Shaped_Text_Cache,

View File

@@ -701,7 +701,7 @@ shape_text_uncached :: #force_inline proc( ctx : ^Context, font : Font_ID, px_si
position: Anchor point in normalized space (where the bottom-right vertex of the first glyph quad will be positioned)
<-> scale : Scale the glyph beyond its default scaling from its px_size.
*/
@(optimization_mode="size")
@(optimization_mode="favor_size")
draw_shape_normalized_space :: #force_inline proc( ctx : ^Context,
colour : RGBAN,
position : Vec2,
@@ -757,7 +757,7 @@ draw_shape_normalized_space :: #force_inline proc( ctx : ^Context,
position: Anchor point in normalized space (where the bottom-right vertex of the first glyph quad will be positioned)
<-> scale : Scale the glyph beyond its default scaling from its px_size.
*/
@(optimization_mode = "size")
@(optimization_mode="favor_size")
draw_text_normalized_space :: proc( ctx : ^Context,
font : Font_ID,
px_size : f32,
@@ -1149,7 +1149,7 @@ measure_shape_size :: #force_inline proc( ctx : Context, shape : Shaped_Text ) -
}
// Don't use this if you already have the shape instead use measure_shape_size
@(optimization_mode="size")
@(optimization_mode="favor_size")
measure_text_size :: proc( ctx : ^Context, font : Font_ID, px_size : f32, text_utf8 : string,
shaper_proc : $Shaper_Shape_Text_Uncached_Proc = shaper_shape_harfbuzz
) -> (measured : Vec2)