fix accidental extra frame of input latency

This commit is contained in:
jacob 2025-05-15 08:09:34 -05:00
parent 12e5cbe7cc
commit 38f88e3cc7

View File

@ -2316,6 +2316,8 @@ INTERNAL SYS_THREAD_ENTRY_POINT_FUNC_DEF(user_local_sim_thread_entry_point, arg)
if (is_master) { if (is_master) {
/* Step master */ /* Step master */
u64 prev_tick = local_client->last_tick;
u64 next_tick = prev_tick + 1;
struct sim_step_ctx ctx = ZI; struct sim_step_ctx ctx = ZI;
ctx.is_master = is_master; ctx.is_master = is_master;
ctx.sim_dt_ns = step_dt_ns; ctx.sim_dt_ns = step_dt_ns;
@ -2323,9 +2325,9 @@ INTERNAL SYS_THREAD_ENTRY_POINT_FUNC_DEF(user_local_sim_thread_entry_point, arg)
ctx.user_input_client = user_input_client; ctx.user_input_client = user_input_client;
ctx.master_client = master_client; ctx.master_client = master_client;
ctx.publish_client = publish_client; ctx.publish_client = publish_client;
struct sim_snapshot *prev_world = sim_snapshot_from_tick(local_client, local_client->last_tick); struct sim_snapshot *prev_world = sim_snapshot_from_tick(local_client, prev_tick);
ctx.world = sim_snapshot_alloc(local_client, prev_world, local_client->last_tick + 1); ctx.world = sim_snapshot_alloc(local_client, prev_world, next_tick);
generate_user_input_cmds(user_input_client, local_client->last_tick + 1); generate_user_input_cmds(user_input_client, next_tick);
sim_step(&ctx); sim_step(&ctx);
} else if (master_client->valid) { } else if (master_client->valid) {
/* Step client */ /* Step client */