diff --git a/src/dbgi/dbgi.c b/src/dbgi/dbgi.c index 392f1cd4..57d36643 100644 --- a/src/dbgi/dbgi.c +++ b/src/dbgi/dbgi.c @@ -189,6 +189,12 @@ dbgi_scope_touch_binary__stripe_mutex_r_guarded(DBGI_Scope *scope, DBGI_Binary * SLLQueuePush(scope->first_tb, scope->last_tb, tb); } +internal void +dbgi_scope_touch_fuzzy_search__stripe_mutex_r_guarded(DBGI_Scope *scope, DBGI_FuzzySearchNode *node) +{ + +} + //////////////////////////////// //~ rjf: Binary Cache Functions @@ -339,10 +345,11 @@ dbgi_parse_from_exe_path(DBGI_Scope *scope, String8 exe_path, U64 endt_us) //////////////////////////////// //~ rjf: Fuzzy Search Cache Functions -internal DBGI_FuzzySearchResult * -dbgi_fuzzy_search_result_from_key_exe_query(U128 key, String8 exe_path, String8 query, U64 endt_us) +internal DBGI_FuzzySearchItemArray +dbgi_fuzzy_search_items_from_key_exe_query(DBGI_Scope *scope, U128 key, String8 exe_path, String8 query, U64 endt_us) { - DBGI_FuzzySearchResult *result = &dbgi_fuzzy_search_result_nil; + DBGI_FuzzySearchItemArray items = {0}; +#if 0 { U64 slot_idx = key.u64[1]%dbgi_shared->fuzzy_search_slots_count; U64 stripe_idx = slot_idx%dbgi_shared->fuzzy_search_stripes_count; @@ -363,10 +370,31 @@ dbgi_fuzzy_search_result_from_key_exe_query(U128 key, String8 exe_path, String8 { node = push_array(stripe->arena, DBGI_FuzzySearchNode, 1); DLLPushBack(slot->first, slot->last, node); + node->key = key; } + B32 stale = 1; + if(node->gen > 0) + { + U64 v_idx = (node->gen-1)%ArrayCount(node->v); + if(str8_match(exe_path, node->v[v_idx].exe_path, 0)) + { + items = node->v[v_idx].items; + stale = str8_match(query, node->v[v_idx].query, 0); + } + } + if(stale && node->submitted != 0) OS_MutexScopeRWPromote(stripe->rw_mutex) + { + node->submitted = (U64)!!dbgi_u2f_enqueue_req(key, exe_path, query, endt_us); + } + if(!stale || os_now_microseconds() >= endt_us) + { + break; + } + os_condition_variable_wait_rw_r(stripe->cv, stripe->rw_mutex, endt_us); } } - return result; +#endif + return items; } //////////////////////////////// @@ -930,3 +958,24 @@ dbgi_parse_thread_entry_point(void *p) scratch_end(scratch); } } + +//////////////////////////////// +//~ rjf: Fuzzy Searching Threads + +internal B32 +dbgi_u2f_enqueue_req(U128 key, String8 exe_path, String8 query, U64 endt_us) +{ + return 0; +} + +internal void +dbgi_u2f_dequeue_req(Arena *arena, U128 *key_out, String8 *exe_path_out, String8 *query_out) +{ + +} + +internal void +dbgi_fuzzy_thread__entry_point(void *p) +{ + +} diff --git a/src/dbgi/dbgi.h b/src/dbgi/dbgi.h index 78a45844..272cab46 100644 --- a/src/dbgi/dbgi.h +++ b/src/dbgi/dbgi.h @@ -97,67 +97,6 @@ struct DBGI_BinaryStripe OS_Handle cv; }; -//////////////////////////////// -//~ rjf: Weak Access Scope Types - -typedef struct DBGI_TouchedBinary DBGI_TouchedBinary; -struct DBGI_TouchedBinary -{ - DBGI_TouchedBinary *next; - DBGI_Binary *binary; -}; - -typedef struct DBGI_Scope DBGI_Scope; -struct DBGI_Scope -{ - DBGI_Scope *next; - DBGI_TouchedBinary *first_tb; - DBGI_TouchedBinary *last_tb; -}; - -typedef struct DBGI_ThreadCtx DBGI_ThreadCtx; -struct DBGI_ThreadCtx -{ - Arena *arena; - DBGI_Scope *free_scope; - DBGI_TouchedBinary *free_tb; -}; - -//////////////////////////////// -//~ rjf: Event Types - -typedef enum DBGI_EventKind -{ - DBGI_EventKind_Null, - DBGI_EventKind_ConversionStarted, - DBGI_EventKind_ConversionEnded, - DBGI_EventKind_ConversionFailureUnsupportedFormat, - DBGI_EventKind_COUNT -} -DBGI_EventKind; - -typedef struct DBGI_Event DBGI_Event; -struct DBGI_Event -{ - DBGI_EventKind kind; - String8 string; -}; - -typedef struct DBGI_EventNode DBGI_EventNode; -struct DBGI_EventNode -{ - DBGI_EventNode *next; - DBGI_Event v; -}; - -typedef struct DBGI_EventList DBGI_EventList; -struct DBGI_EventList -{ - DBGI_EventNode *first; - DBGI_EventNode *last; - U64 count; -}; - //////////////////////////////// //~ rjf: Fuzzy Search Cache Types @@ -195,6 +134,9 @@ struct DBGI_FuzzySearchItemArray typedef struct DBGI_FuzzySearchResult DBGI_FuzzySearchResult; struct DBGI_FuzzySearchResult { + Arena *arena; + String8 exe_path; + String8 query; DBGI_FuzzySearchItemArray items; }; @@ -203,8 +145,9 @@ struct DBGI_FuzzySearchNode { DBGI_FuzzySearchNode *next; DBGI_FuzzySearchNode *prev; - Arena *arena; U128 key; + U64 submitted; + U64 scope_touch_count; U64 gen; DBGI_FuzzySearchResult v[2]; }; @@ -224,6 +167,77 @@ struct DBGI_FuzzySearchStripe OS_Handle cv; }; +//////////////////////////////// +//~ rjf: Weak Access Scope Types + +typedef struct DBGI_TouchedBinary DBGI_TouchedBinary; +struct DBGI_TouchedBinary +{ + DBGI_TouchedBinary *next; + DBGI_Binary *binary; +}; + +typedef struct DBGI_TouchedFuzzySearch DBGI_TouchedFuzzySearch; +struct DBGI_TouchedFuzzySearch +{ + DBGI_TouchedFuzzySearch *next; + DBGI_FuzzySearchNode *node; +}; + +typedef struct DBGI_Scope DBGI_Scope; +struct DBGI_Scope +{ + DBGI_Scope *next; + DBGI_TouchedBinary *first_tb; + DBGI_TouchedBinary *last_tb; + DBGI_TouchedFuzzySearch *first_tfs; + DBGI_TouchedFuzzySearch *last_tfs; +}; + +typedef struct DBGI_ThreadCtx DBGI_ThreadCtx; +struct DBGI_ThreadCtx +{ + Arena *arena; + DBGI_Scope *free_scope; + DBGI_TouchedBinary *free_tb; + DBGI_TouchedFuzzySearch *free_tfs; +}; + +//////////////////////////////// +//~ rjf: Event Types + +typedef enum DBGI_EventKind +{ + DBGI_EventKind_Null, + DBGI_EventKind_ConversionStarted, + DBGI_EventKind_ConversionEnded, + DBGI_EventKind_ConversionFailureUnsupportedFormat, + DBGI_EventKind_COUNT +} +DBGI_EventKind; + +typedef struct DBGI_Event DBGI_Event; +struct DBGI_Event +{ + DBGI_EventKind kind; + String8 string; +}; + +typedef struct DBGI_EventNode DBGI_EventNode; +struct DBGI_EventNode +{ + DBGI_EventNode *next; + DBGI_Event v; +}; + +typedef struct DBGI_EventList DBGI_EventList; +struct DBGI_EventList +{ + DBGI_EventNode *first; + DBGI_EventNode *last; + U64 count; +}; + //////////////////////////////// //~ rjf: Cross-Thread Shared State @@ -288,7 +302,6 @@ struct DBGI_Shared global DBGI_Shared *dbgi_shared = 0; thread_static DBGI_ThreadCtx *dbgi_tctx = 0; global DBGI_Parse dbgi_parse_nil = {0}; -global DBGI_FuzzySearchResult dbgi_fuzzy_search_result_nil = {0}; //////////////////////////////// //~ rjf: Main Layer Initialization @@ -317,6 +330,7 @@ internal String8 dbgi_forced_dbg_path_from_exe_path(Arena *arena, String8 exe_pa internal DBGI_Scope *dbgi_scope_open(void); internal void dbgi_scope_close(DBGI_Scope *scope); internal void dbgi_scope_touch_binary__stripe_mutex_r_guarded(DBGI_Scope *scope, DBGI_Binary *binary); +internal void dbgi_scope_touch_fuzzy_search__stripe_mutex_r_guarded(DBGI_Scope *scope, DBGI_FuzzySearchNode *node); //////////////////////////////// //~ rjf: Binary Cache Functions @@ -328,7 +342,7 @@ internal DBGI_Parse *dbgi_parse_from_exe_path(DBGI_Scope *scope, String8 exe_pat //////////////////////////////// //~ rjf: Fuzzy Search Cache Functions -internal DBGI_FuzzySearchResult *dbgi_fuzzy_search_result_from_key_exe_query(U128 key, String8 exe_path, String8 query, U64 endt_us); +internal DBGI_FuzzySearchItemArray dbgi_fuzzy_search_items_from_key_exe_query(DBGI_Scope *scope, U128 key, String8 exe_path, String8 query, U64 endt_us); //////////////////////////////// //~ rjf: Parse Threads @@ -344,7 +358,7 @@ internal void dbgi_parse_thread_entry_point(void *p); //////////////////////////////// //~ rjf: Fuzzy Searching Threads -internal void dbgi_u2f_enqueue_req(U128 key, String8 exe_path, String8 query); +internal B32 dbgi_u2f_enqueue_req(U128 key, String8 exe_path, String8 query, U64 endt_us); internal void dbgi_u2f_dequeue_req(Arena *arena, U128 *key_out, String8 *exe_path_out, String8 *query_out); internal void dbgi_fuzzy_thread__entry_point(void *p); diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index 55b6923b..41c422a0 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -5572,11 +5572,15 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D // rjf: build UI_CornerRadius(0) { - UI_Rect(tab_bar_rect) tab_bar_box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_ViewClampX|UI_BoxFlag_ViewScroll|UI_BoxFlag_Clickable, "tab_bar_%p", panel); + UI_Rect(tab_bar_rect) tab_bar_box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_ViewClampX|UI_BoxFlag_ViewScrollX|UI_BoxFlag_Clickable, "tab_bar_%p", panel); if(panel->tab_side == Side_Max) { tab_bar_box->view_off.y = tab_bar_box->view_off_target.y = (tab_bar_rheight - tab_bar_vheight); } + else + { + tab_bar_box->view_off.y = tab_bar_box->view_off_target.y = 0; + } } UI_Parent(tab_bar_box) UI_PrefHeight(ui_pct(1, 0)) { diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 9c93ec6d..8bef651a 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -2546,6 +2546,14 @@ ui_signal_from_box(UI_Box *box) { Swap(F32, delta.x, delta.y); } + if(!(box->flags & UI_BoxFlag_ViewScrollX)) + { + delta.x = 0; + } + if(!(box->flags & UI_BoxFlag_ViewScrollY)) + { + delta.y = 0; + } os_eat_event(events, event); box->view_off_target.x += delta.x; box->view_off_target.y += delta.y; diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index d4090a32..4f15e72e 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -188,53 +188,54 @@ typedef U64 UI_BoxFlags; # define UI_BoxFlag_KeyboardClickable (UI_BoxFlags)(1ull<<1) # define UI_BoxFlag_ClickToFocus (UI_BoxFlags)(1ull<<2) # define UI_BoxFlag_Scroll (UI_BoxFlags)(1ull<<3) -# define UI_BoxFlag_ViewScroll (UI_BoxFlags)(1ull<<4) -# define UI_BoxFlag_ViewClampX (UI_BoxFlags)(1ull<<5) -# define UI_BoxFlag_ViewClampY (UI_BoxFlags)(1ull<<6) -# define UI_BoxFlag_FocusHot (UI_BoxFlags)(1ull<<7) -# define UI_BoxFlag_FocusActive (UI_BoxFlags)(1ull<<8) -# define UI_BoxFlag_FocusHotDisabled (UI_BoxFlags)(1ull<<9) -# define UI_BoxFlag_FocusActiveDisabled (UI_BoxFlags)(1ull<<10) -# define UI_BoxFlag_DefaultFocusNavX (UI_BoxFlags)(1ull<<11) -# define UI_BoxFlag_DefaultFocusNavY (UI_BoxFlags)(1ull<<12) -# define UI_BoxFlag_DefaultFocusEdit (UI_BoxFlags)(1ull<<13) -# define UI_BoxFlag_FocusNavSkip (UI_BoxFlags)(1ull<<14) -# define UI_BoxFlag_Disabled (UI_BoxFlags)(1ull<<15) +# define UI_BoxFlag_ViewScrollX (UI_BoxFlags)(1ull<<4) +# define UI_BoxFlag_ViewScrollY (UI_BoxFlags)(1ull<<5) +# define UI_BoxFlag_ViewClampX (UI_BoxFlags)(1ull<<6) +# define UI_BoxFlag_ViewClampY (UI_BoxFlags)(1ull<<7) +# define UI_BoxFlag_FocusHot (UI_BoxFlags)(1ull<<8) +# define UI_BoxFlag_FocusActive (UI_BoxFlags)(1ull<<9) +# define UI_BoxFlag_FocusHotDisabled (UI_BoxFlags)(1ull<<10) +# define UI_BoxFlag_FocusActiveDisabled (UI_BoxFlags)(1ull<<11) +# define UI_BoxFlag_DefaultFocusNavX (UI_BoxFlags)(1ull<<12) +# define UI_BoxFlag_DefaultFocusNavY (UI_BoxFlags)(1ull<<13) +# define UI_BoxFlag_DefaultFocusEdit (UI_BoxFlags)(1ull<<14) +# define UI_BoxFlag_FocusNavSkip (UI_BoxFlags)(1ull<<15) +# define UI_BoxFlag_Disabled (UI_BoxFlags)(1ull<<16) //- rjf: layout -# define UI_BoxFlag_FloatingX (UI_BoxFlags)(1ull<<16) -# define UI_BoxFlag_FloatingY (UI_BoxFlags)(1ull<<17) -# define UI_BoxFlag_FixedWidth (UI_BoxFlags)(1ull<<18) -# define UI_BoxFlag_FixedHeight (UI_BoxFlags)(1ull<<19) -# define UI_BoxFlag_AllowOverflowX (UI_BoxFlags)(1ull<<20) -# define UI_BoxFlag_AllowOverflowY (UI_BoxFlags)(1ull<<21) -# define UI_BoxFlag_SkipViewOffX (UI_BoxFlags)(1ull<<22) -# define UI_BoxFlag_SkipViewOffY (UI_BoxFlags)(1ull<<23) +# define UI_BoxFlag_FloatingX (UI_BoxFlags)(1ull<<17) +# define UI_BoxFlag_FloatingY (UI_BoxFlags)(1ull<<18) +# define UI_BoxFlag_FixedWidth (UI_BoxFlags)(1ull<<19) +# define UI_BoxFlag_FixedHeight (UI_BoxFlags)(1ull<<20) +# define UI_BoxFlag_AllowOverflowX (UI_BoxFlags)(1ull<<21) +# define UI_BoxFlag_AllowOverflowY (UI_BoxFlags)(1ull<<22) +# define UI_BoxFlag_SkipViewOffX (UI_BoxFlags)(1ull<<23) +# define UI_BoxFlag_SkipViewOffY (UI_BoxFlags)(1ull<<24) //- rjf: appearance / animation -# define UI_BoxFlag_DrawDropShadow (UI_BoxFlags)(1ull<<24) -# define UI_BoxFlag_DrawBackgroundBlur (UI_BoxFlags)(1ull<<25) -# define UI_BoxFlag_DrawBackground (UI_BoxFlags)(1ull<<26) -# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<27) -# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<28) -# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<29) -# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<30) -# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<31) -# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<32) -# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<33) -# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<34) -# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<35) -# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<36) -# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<37) -# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<38) -# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<39) -# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<40) -# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<41) -# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<42) -# define UI_BoxFlag_DisableFocusViz (UI_BoxFlags)(1ull<<43) -# define UI_BoxFlag_RequireFocusBackground (UI_BoxFlags)(1ull<<44) -# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<45) -# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<46) +# define UI_BoxFlag_DrawDropShadow (UI_BoxFlags)(1ull<<25) +# define UI_BoxFlag_DrawBackgroundBlur (UI_BoxFlags)(1ull<<26) +# define UI_BoxFlag_DrawBackground (UI_BoxFlags)(1ull<<27) +# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<28) +# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<29) +# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<30) +# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<31) +# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<32) +# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<33) +# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<34) +# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<35) +# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<36) +# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<37) +# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<38) +# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<39) +# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<40) +# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<41) +# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<42) +# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<43) +# define UI_BoxFlag_DisableFocusViz (UI_BoxFlags)(1ull<<44) +# define UI_BoxFlag_RequireFocusBackground (UI_BoxFlags)(1ull<<45) +# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<46) +# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<47) //- rjf: bundles # define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable) @@ -243,6 +244,7 @@ typedef U64 UI_BoxFlags; # define UI_BoxFlag_FixedSize (UI_BoxFlag_FixedWidth|UI_BoxFlag_FixedHeight) # define UI_BoxFlag_AllowOverflow (UI_BoxFlag_AllowOverflowX|UI_BoxFlag_AllowOverflowY) # define UI_BoxFlag_AnimatePos (UI_BoxFlag_AnimatePosX|UI_BoxFlag_AnimatePosY) +# define UI_BoxFlag_ViewScroll (UI_BoxFlag_ViewScrollX|UI_BoxFlag_ViewScrollY) # define UI_BoxFlag_ViewClamp (UI_BoxFlag_ViewClampX|UI_BoxFlag_ViewClampY) //}