misc changes
This commit is contained in:
parent
db1701a5d7
commit
8c7b3e2058
5
code/grime/hashing.odin
Normal file
5
code/grime/hashing.odin
Normal file
@ -0,0 +1,5 @@
|
||||
package grime
|
||||
|
||||
djb8_hash :: #force_inline proc "contextless" ( hash : ^u64, bytes : []byte ) {
|
||||
for value in bytes do (hash^) = (( (hash^) << 8) + (hash^) ) + u64(value)
|
||||
}
|
@ -94,4 +94,8 @@ memory_aign_forward :: #force_inline proc( address, alignment : uintptr) -> uint
|
||||
|
||||
//endregion Memory Math
|
||||
|
||||
swap :: #force_inline proc( a, b : ^ $Type ) -> ( ^ Type, ^ Type ) { return b, a }
|
||||
swap :: #force_inline proc "contextless" ( a, b : ^ $Type ) -> ( ^ Type, ^ Type ) { return b, a }
|
||||
|
||||
to_bytes :: #force_inline proc "contextless" ( typed_block : ^$Type ) -> []byte {
|
||||
return slice_ptr( transmute(^byte) typed_block, size_of(Type) )
|
||||
}
|
||||
|
@ -169,14 +169,14 @@ font_provider_setup_sokol_gfx_objects :: proc( ctx : ^VE_RenderData, ve_ctx : ve
|
||||
glyph_rt_sampler = sokol_gfx.make_sampler( SamplerDescription {
|
||||
min_filter = Image_Filter,
|
||||
mag_filter = Image_Filter,
|
||||
mipmap_filter = Filter.LINEAR,
|
||||
mipmap_filter = Filter.NEAREST,
|
||||
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,
|
||||
max_anisotropy = 16,
|
||||
max_anisotropy = 1,
|
||||
})
|
||||
verify( sokol_gfx.query_sampler_state( glyph_rt_sampler) < ResourceState.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
|
||||
|
@ -4,7 +4,8 @@ package sectr
|
||||
#region("base")
|
||||
|
||||
import "base:builtin"
|
||||
copy :: builtin.copy
|
||||
copy :: builtin.copy
|
||||
// byte_slice :: builtin.byte_slice
|
||||
|
||||
import "base:intrinsics"
|
||||
mem_zero :: intrinsics.mem_zero
|
||||
@ -51,6 +52,26 @@ import fmt_io "core:fmt"
|
||||
str_tmp_from_any :: fmt_io.tprint
|
||||
|
||||
import "core:math"
|
||||
ceil_f16 :: math.ceil_f16
|
||||
ceil_f16le :: math.ceil_f16le
|
||||
ceil_f16be :: math.ceil_f16be
|
||||
ceil_f32 :: math.ceil_f32
|
||||
ceil_f32le :: math.ceil_f32le
|
||||
ceil_f32be :: math.ceil_f32be
|
||||
ceil_f64 :: math.ceil_f64
|
||||
ceil_f64le :: math.ceil_f64le
|
||||
ceil_f64be :: math.ceil_f64be
|
||||
|
||||
floor_f16 :: math.floor_f16
|
||||
floor_f16le :: math.floor_f16le
|
||||
floor_f16be :: math.floor_f16be
|
||||
floor_f32 :: math.floor_f32
|
||||
floor_f32le :: math.floor_f32le
|
||||
floor_f32be :: math.floor_f32be
|
||||
floor_f64 :: math.floor_f64
|
||||
floor_f64le :: math.floor_f64le
|
||||
floor_f64be :: math.floor_f64be
|
||||
|
||||
lerp :: math.lerp
|
||||
|
||||
import "core:math/bits"
|
||||
@ -239,6 +260,9 @@ import "codebase:grime"
|
||||
file_exists :: grime.file_exists
|
||||
file_rewind :: grime.file_rewind
|
||||
|
||||
// hashing
|
||||
djb8_hash :: grime.djb8_hash
|
||||
|
||||
// linked lists
|
||||
LL_Node :: grime.LL_Node
|
||||
|
||||
@ -278,6 +302,7 @@ import "codebase:grime"
|
||||
memory_after_header :: grime.memory_after_header
|
||||
memory_after :: grime.memory_after
|
||||
swap :: grime.swap
|
||||
to_bytes :: grime.to_bytes
|
||||
|
||||
// strings
|
||||
StrRunesPair :: grime.StrRunesPair
|
||||
@ -346,6 +371,20 @@ bivec3 :: proc {
|
||||
vec3_to_bivec3,
|
||||
}
|
||||
|
||||
ceil :: proc {
|
||||
math.ceil_f16,
|
||||
math.ceil_f16le,
|
||||
math.ceil_f16be,
|
||||
math.ceil_f32,
|
||||
math.ceil_f32le,
|
||||
math.ceil_f32be,
|
||||
math.ceil_f64,
|
||||
math.ceil_f64le,
|
||||
math.ceil_f64be,
|
||||
|
||||
// ceil_vec2,
|
||||
}
|
||||
|
||||
clear :: proc{
|
||||
grime.array_clear,
|
||||
}
|
||||
|
@ -274,6 +274,13 @@ ui_graph_build_end :: proc( ui : ^UI_State )
|
||||
for current := ui.root.first; current != nil;
|
||||
current = ui_box_tranverse_next_depth_first( current, bypass_intersection_test = true, ctx = ui )
|
||||
{
|
||||
// prev_box := ui_prev_cached_box( current )
|
||||
// prev_hash : u64
|
||||
// curr_hash : u64
|
||||
// djb8_hash( & prev_hash, to_bytes(& prev_box.layout) )
|
||||
// djb8_hash( & curr_hash, to_bytes(& current.layout) )
|
||||
// current.computed.fresh = prev_hash == curr_hash && (current.parent != nil && current.parent.computed.fresh)
|
||||
|
||||
if ! current.computed.fresh
|
||||
{
|
||||
if len(current.text.str) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user