/* client */
vg_load();
+
+ vg_success( "Client loaded in %fs\n", vg.time_real );
}
static void _vg_process_events(void)
double dt = (double)udt / (double)SDL_GetPerformanceFrequency();
vg.time_frame_delta += dt;
+ vg_run_async_checked();
if( vg_framefilter( dt ) )
continue;
vg.time_delta = vg.time_frame_delta * vg.time_rate;
vg.time += vg.time_delta;
- vg_run_async_checked();
_vg_process_events();
if( vg.window_should_close )
/*
* Schedule something to be ran now, freed later. Checks in with engine status
*/
-static void vg_loader_step( void( *fn_load )(void), void( *fn_free )(void) )
-{
+static void _vg_loader_step( void( *fn_load )(void), void( *fn_free )(void),
+ const char *alias ){
+
+ u64 t0 = SDL_GetPerformanceCounter();
+ vg.time_hp_last = vg.time_hp;
+
if( fn_load )
fn_load();
+ u64 udt = SDL_GetPerformanceCounter() - t0;
+ double dt = (double)udt / (double)SDL_GetPerformanceFrequency();
+ vg_info( "ltime [%p] %s: %fs\n", fn_load, alias, dt );
+
if( fn_free ){
struct loader_free_step step;
step.fn_free = fn_free;
/* TODO: There was a quit checker here, re-add this? */
}
+#define vg_loader_step( FN, FN_FREE )\
+ _vg_loader_step( FN, FN_FREE, #FN )
+
#endif /* VG_LOADER_H */
const char *constr_name )
{
if( !data )
- return _vg_linear_alloc( buffer, extra, constr_name );
+ return _vg_linear_alloc( buffer, vg_align8(extra), constr_name );
vg_linear_allocator *alloc = vg_linear_header( buffer );
vg_fatal_error( "This block has been fixed!" );
u32 new_size = alloc->last_alloc_size + extra;
- return vg_linear_resize( buffer, data, new_size );
+ return vg_linear_resize( buffer, data, vg_align8(new_size) );
}
/* get the current usage of allocator */