mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-18 23:21:32 -07:00
expand access scope touches to automatically record update clock idx touch time, + timestamp; move texture cache to new async wavefront
This commit is contained in:
@@ -206,6 +206,9 @@ async_thread_entry_point(void *params)
|
||||
#endif
|
||||
#if defined(DASM_CACHE_H)
|
||||
dasm_tick();
|
||||
#endif
|
||||
#if defined(TEXTURE_CACHE_H)
|
||||
tex_tick();
|
||||
#endif
|
||||
cond_var_broadcast(async_tick_stop_cond_var);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ access_close(Access *access)
|
||||
for(Touch *touch = access->top_touch, *next = 0; touch != 0; touch = next)
|
||||
{
|
||||
next = touch->next;
|
||||
ins_atomic_u64_dec_eval(touch->touch_count);
|
||||
ins_atomic_u64_dec_eval(&touch->pt->access_refcount);
|
||||
if(touch->cv.u64[0] != 0) { cond_var_broadcast(touch->cv); }
|
||||
SLLStackPush(tctx_thread_local->free_touch, touch);
|
||||
}
|
||||
@@ -168,9 +168,11 @@ access_close(Access *access)
|
||||
}
|
||||
|
||||
internal void
|
||||
access_touch(Access *access, U64 *touch_count, CondVar cv)
|
||||
access_touch(Access *access, AccessPt *pt, CondVar cv)
|
||||
{
|
||||
ins_atomic_u64_inc_eval(touch_count);
|
||||
ins_atomic_u64_inc_eval(&pt->access_refcount);
|
||||
ins_atomic_u64_eval_assign(&pt->last_time_touched_us, os_now_microseconds());
|
||||
ins_atomic_u64_eval_assign(&pt->last_update_idx_touched, update_tick_idx());
|
||||
Touch *touch = tctx_thread_local->free_touch;
|
||||
if(touch != 0)
|
||||
{
|
||||
@@ -183,5 +185,19 @@ access_touch(Access *access, U64 *touch_count, CondVar cv)
|
||||
MemoryZeroStruct(touch);
|
||||
SLLStackPush(access->top_touch, touch);
|
||||
touch->cv = cv;
|
||||
touch->touch_count = touch_count;
|
||||
touch->pt = pt;
|
||||
}
|
||||
|
||||
//- rjf: access points
|
||||
|
||||
internal B32
|
||||
access_pt_is_expired(AccessPt *pt)
|
||||
{
|
||||
U64 access_refcount = ins_atomic_u64_eval(&pt->access_refcount);
|
||||
U64 last_time_touched_us = ins_atomic_u64_eval(&pt->last_time_touched_us);
|
||||
U64 last_update_idx_touched = ins_atomic_u64_eval(&pt->last_update_idx_touched);
|
||||
B32 result = (access_refcount == 0 &&
|
||||
last_time_touched_us + 2000000 < os_now_microseconds() &&
|
||||
last_update_idx_touched + 10 < update_tick_idx());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,19 @@ struct LaneCtx
|
||||
////////////////////////////////
|
||||
//~ rjf: Access Scopes
|
||||
|
||||
typedef struct AccessPt AccessPt;
|
||||
struct AccessPt
|
||||
{
|
||||
U64 access_refcount;
|
||||
U64 last_time_touched_us;
|
||||
U64 last_update_idx_touched;
|
||||
};
|
||||
|
||||
typedef struct Touch Touch;
|
||||
struct Touch
|
||||
{
|
||||
Touch *next;
|
||||
U64 *touch_count;
|
||||
AccessPt *pt;
|
||||
CondVar cv;
|
||||
};
|
||||
|
||||
@@ -95,6 +103,9 @@ internal void tctx_read_srcloc(char **file_name, U64 *line_number);
|
||||
//- rjf: access scopes
|
||||
internal Access *access_open(void);
|
||||
internal void access_close(Access *access);
|
||||
internal void access_touch(Access *access, U64 *touch_count, CondVar cv);
|
||||
internal void access_touch(Access *access, AccessPt *pt, CondVar cv);
|
||||
|
||||
//- rjf: access points
|
||||
internal B32 access_pt_is_expired(AccessPt *pt);
|
||||
|
||||
#endif // BASE_THREAD_CONTEXT_H
|
||||
|
||||
Reference in New Issue
Block a user