persist struct region
This commit is contained in:
parent
a8bc77fab3
commit
fc9aff7f06
@ -424,15 +424,17 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
|
||||
#define IsArray(a) (IsIndexable(a) && (((void *)&a) == ((void *)a)))
|
||||
|
||||
//- offsetof
|
||||
#if 0
|
||||
#if !CompilerIsMsvc
|
||||
# if !defined _CRT_USE_BUILTIN_OFFSETOF
|
||||
# define offsetof(type, field) ((u64)&(((type *)0)->field))
|
||||
# else
|
||||
# ifdef _CRT_USE_BUILTIN_OFFSETOF
|
||||
# define offsetof(type, field) __builtin_offsetof(type, field)
|
||||
# else
|
||||
# define offsetof(type, field) ((u64)&(((type *)0)->field))
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//- struct region
|
||||
#define StructRegion(name) i8 name
|
||||
#define CopyStructRegion(dst, src, r0, r1) CopyBytes(&dst->r0, &src->r0, (u8 *)&dst->r1 - (u8 *)&dst->r0)
|
||||
|
||||
//- Packed
|
||||
#if CompilerIsMsvc
|
||||
|
||||
20
src/pp/pp.c
20
src/pp/pp.c
@ -30,9 +30,10 @@ void StartupUser(void)
|
||||
g->local_to_user_client_store = AcquireClientStore();
|
||||
g->local_to_user_client = AcquireClient(g->local_to_user_client_store);
|
||||
|
||||
/* Init from swap */
|
||||
g->world_to_ui_xf = XformIdentity;
|
||||
g->world_to_render_xf = XformIdentity;
|
||||
|
||||
/* Init from swap */
|
||||
if (IsSwappingIn());
|
||||
{
|
||||
TempArena scratch = BeginScratchNoConflict();
|
||||
@ -41,22 +42,7 @@ void StartupUser(void)
|
||||
{
|
||||
SwappedUserState *swap = (SwappedUserState *)swap_str.text;
|
||||
SharedUserState *old = &swap->s;
|
||||
g->debug_following = old->debug_following;
|
||||
g->debug_camera = old->debug_camera;
|
||||
g->debug_camera_panning = old->debug_camera_panning;
|
||||
g->debug_camera_pan_start = old->debug_camera_pan_start;
|
||||
g->debug_draw = old->debug_draw;
|
||||
g->screen_size = old->screen_size;
|
||||
g->screen_cursor = old->screen_cursor;
|
||||
g->ui_to_screen_xf = old->ui_to_screen_xf;
|
||||
g->ui_size = old->ui_size;
|
||||
g->ui_cursor = old->ui_cursor;
|
||||
g->render_to_ui_xf = old->render_to_ui_xf;
|
||||
g->render_size = old->render_size;
|
||||
g->world_to_render_xf = old->world_to_render_xf;
|
||||
g->world_to_ui_xf = old->world_to_ui_xf;
|
||||
g->world_cursor = old->world_cursor;
|
||||
g->focus_send = old->focus_send;
|
||||
CopyStructRegion(g, old, PERSIST_START, PERSIST_END);
|
||||
}
|
||||
EndScratch(scratch);
|
||||
}
|
||||
|
||||
24
src/pp/pp.h
24
src/pp/pp.h
@ -194,13 +194,6 @@ Struct(SharedUserState)
|
||||
//- Bind state
|
||||
BindState bind_states[BindKind_Count];
|
||||
|
||||
//- Debug camera
|
||||
EntityId debug_following;
|
||||
b32 debug_camera;
|
||||
b32 debug_camera_panning;
|
||||
Vec2 debug_camera_pan_start;
|
||||
b32 debug_draw;
|
||||
|
||||
//- Debug console
|
||||
Mutex console_logs_mutex;
|
||||
Arena *console_logs_arena;
|
||||
@ -245,6 +238,18 @@ Struct(SharedUserState)
|
||||
i64 real_dt_ns;
|
||||
i64 real_time_ns;
|
||||
|
||||
//////////////////////////////
|
||||
//- Persist start
|
||||
StructRegion(PERSIST_START);
|
||||
|
||||
//- Debug camera
|
||||
|
||||
EntityId debug_following;
|
||||
b32 debug_camera;
|
||||
b32 debug_camera_panning;
|
||||
Vec2 debug_camera_pan_start;
|
||||
b32 debug_draw;
|
||||
|
||||
//- Per frame
|
||||
|
||||
Vec2I32 screen_size;
|
||||
@ -262,6 +267,11 @@ Struct(SharedUserState)
|
||||
Vec2 world_cursor;
|
||||
|
||||
Vec2 focus_send;
|
||||
|
||||
StructRegion(PERSIST_END);
|
||||
//- Persist end
|
||||
//////////////////////////////
|
||||
|
||||
} extern shared_user_state;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user