code wiki / _hdl_build / nx_frame_budget.nx
nx_frame_budget.nx source
↩ module page · 11 lines · 968 B
1const K_MAGIC_1000000: i64 = 1000000
2// nx_frame_budget.nx -- P3 RESPONSIVENESS: the FLOOR-DEVICE frame-budget discipline. A target frame rate
3// gives a hard per-frame time budget; the frame's work (sim overhead + render work-units x per-unit cost)
4// must fit inside it on the weakest target device. This is how "low-end mobile plays well" becomes a
5// MEASURABLE gate, not a hope. Pairs with nx_cull_lod: culling is what brings the render work under budget.
6// Pure integer (microseconds). 100% sovereign. license_tier: ORIGINAL
7
8func fb_budget_us(fps: i64) -> i64 { return K_MAGIC_1000000 / fps } // per-frame time budget
9func fb_frame_cost_us(work_units: i64, per_unit_us: i64, overhead_us: i64) -> i64 { return work_units * per_unit_us + overhead_us }
10func fb_fits(cost_us: i64, budget_us: i64) -> i64 { if cost_us <= budget_us { return 1 } return 0 }
11func fb_headroom_us(cost_us: i64, budget_us: i64) -> i64 { return budget_us - cost_us }