nx_enginelab.nx
buildroot/runtime/nx_enginelab.nx
about
nx_enginelab.nx -- THE DRIVER: attach the sovereign engine instrument to a REAL renderer.
WHAT WAS MISSING AND WHY IT MATTERED. nx_enginelab_lib (the spine), nx_enginelab_store (EL1
persistence), nx_enginelab_golden (the O3DE class) and nx_enginelab_analysis (replay, shader
binding, sampling, call tree) are roughly 69 KB of gate-proven library. The gate that proves them
says so in its own verdict: every tooth asserts an arithmetic property "on fixtures whose answers
are known by construction". That is a proof about the INSTRUMENT and it is worth having -- but
until this file existed NOTHING drove the instrument over a real frame, so the estate owned a
profiler that had never profiled anything. A measurement capability with no driver is
BUILT-AND-UNWIRED, and a green gate makes that invisible: the gate passes exactly as well with
zero real subjects as with a thousand.
THE SUBJECT, AND WHY THIS ONE. nx_wasm_craft is the estate real renderer -- a per-pixel integer
DDA raycast over a voxel world plus a skinned-mesh character composite -- and it is the ONE render
path reachable natively with no browser (nx_world_snap already drives it that way, which is the
standing evidence that init_impl_v / tick_impl / render_impl compose outside a page). Attaching
here therefore needs no GUI, no capture harness and no second copy of the engine.
WHAT THIS DRIVER MEASURES, AND WHAT IT REFUSES TO. It owns the call sites it wraps: the arena
allocation, init, and per frame a tick zone and a render zone. Everything derived from those is a
real observation of a real frame. It does NOT own the inside of render_impl, so:
- THE DRAW CLASS IS UNMEASURABLE HERE AND SAYS SO BY NAME. The engine emits no draw stream --
there is no el_draw call anywhere in nx_wasm_craft -- so draws, redundant binds, pipeline
state hashes, capture diff and replay divergence have NO SUBJECT. This driver reports draws=0
with the reason attached and the exact emission site the engine lane owes. It does NOT
reconstruct the engine visibility test from outside: mob_draw culls on 200 < vz < 40*256, and
copying that predicate here would be a duplicate ruler that drifts silently the day the engine
changes it. A NAMED ABSENCE IS A BUILD CONTRACT; A RECONSTRUCTED NUMBER IS A LIE WITH A
DENOMINATOR.
- THE BOUND VERDICT ABSTAINS. This renderer is a CPU integer raycaster; nothing is submitted to
a GPU queue, so el_bound_verdict correctly returns UNKNOWN. Manufacturing a GPU signal to make
the verdict decide would be the acquit-on-no-evidence defect the spine exists to prevent.
What it CAN answer, and nothing else in this estate could before: how long a real frame costs,
how that cost splits between simulation and rasterisation, what the cost per RAY is, whether the
pacing stutters, and whether two independent runs of the same seed produce the same pixels.
RAYS ARE THE UNIT OF WORK, AND THE COUNT IS ENGINE-OWNED. wc_rw/wc_rh are the engine own single
owner of the written extent (its source says so), so rays-per-frame is READ from the engine rather
than recomputed here. ns-per-ray is the figure that survives a resolution change; a bare frame
time does not.
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_enginelab_lib.nxnx_enginelab_store.nxnx_enginelab_golden.nxnx_wasm_craft.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 51 | const ELD_ARENA_PAD: i64 = 4096 // the same head-room nx_world_snap allocates beside CRAFT_TOTAL |
| 52 | const ELD_TID_MAIN: i64 = 1 // one thread: this driver is single-threaded by construction |
| 53 | const ELD_N_ARENA: i64 = 1 // interned zone/alloc name ids -- ids, never strings, in a hot loop |
| 54 | const ELD_N_INIT: i64 = 2 |
| 55 | const ELD_N_TICK: i64 = 3 |
| 56 | const ELD_N_RENDER: i64 = 4 |
| 61 | const ELD_REC_PER_FRAME: i64 = 3 |
| 62 | const ELD_REC_PROLOGUE: i64 = 8 |
| 63 | const ELD_FRAMES_DEFAULT: i64 = 4 |
| 64 | const ELD_TICK_MS: i64 = 16 // one 60Hz step, the same dt nx_world_snap ticks with |
| 65 | const ELD_TARGET_FPS_DEFAULT: i64 = 60 |
| 66 | const ELD_SEED_DEFAULT: i64 = 20260728 // the beach seed the acceptance corpus already uses |
| 67 | const ELD_Q_DEFAULT: i64 = 1 // native resolution: a capture reduced by a load-sensitive |
| 69 | const ELD_Q_GOVERNOR_ARG: i64 = 0 // q=0 asks for the engine own adaptive controller instead |
| 70 | const ELD_MIN_CLOSED_FRAMES: i64 = 2 // fewer than two boundaries is not a pacing measurement |
| 71 | const ELD_GRID_DEFAULT: i64 = 16 // golden grid, cells per axis |
| 72 | const ELD_THRESH_DEFAULT: i64 = 4 // per-cell mean tolerance |
| 73 | const ELD_DEC: i64 = 10 |
| 74 | const ELD_ASCII_0: i64 = 48 |
| 75 | const ELD_DIGIT_TOP: i64 = 9 |
| 76 | const ELD_NUMBUF: i64 = 32 |
| 77 | const ELD_RGB_CH: i64 = 3 |
| 78 | const ELD_BYTE_MASK: i64 = 255 |
| 79 | const ELD_G_SHIFT: i64 = 8 |
| 80 | const ELD_B_SHIFT: i64 = 16 |
| 81 | const ELD_NS_PER_US: i64 = 1000 |
| 82 | const ELD_PERMIL: i64 = 1000 |
| 83 | const ELD_SCRATCH_SLOTS: i64 = 32 |
| 84 | const ELD_ARGV_VERB: i64 = 1 |
| 85 | const ELD_EXIT_OK: i64 = 0 |
| 86 | const ELD_EXIT_FAIL: i64 = 1 |
| 87 | const ELD_EXIT_USAGE: i64 = 2 |
| 88 | const ELD_EXIT_UNMEASURABLE: i64 = 3 |
| 152 | const ELD_FRAME_A_Q: i64 = 5 // == EL_F_A, restated at its meaning |
| 153 | const ELD_FRAME_B_RAYS: i64 = 6 // == EL_F_B |
functions
| 91 | func eld_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: eld_puts |
| 92 | func eld_puts(s: *u8) -> i64 { sys_write(1, s, eld_slen(s)); return 0 } |
| 93 | func eld_pn(v: i64) -> i64 |
| 108 | func eld_kv(label: *u8, v: i64) -> i64 { eld_puts(label); eld_pn(v); eld_puts(" " as *u8); return 0 } |
| 109 | func eld_nl() -> i64 { eld_puts("\n" as *u8); return 0 } |
| 110 | func eld_int(s: *u8) -> i64 called by 1: main |
| 120 | func eld_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 129 | func eld_scratch() -> *i64 { return sys_mmap(ELD_SCRATCH_SLOTS * EL_I64) as *i64 } |
| 132 | func eld_name(id: i64) -> i64 |
| 142 | func eld_arena_bytes() -> i64 { return CRAFT_TOTAL + ELD_ARENA_PAD } called by 1: eld_run |
| 143 | func eld_store_cap(frames: i64) -> i64 { return ELD_REC_PROLOGUE + frames * ELD_REC_PER_FRAME } called by 1: main |
| 146 | func eld_native_pixels() -> i64 { return W * H } called by 1: eld_report |
| 156 | func eld_run(st: *i64, v: i64, seed: i64, q: i64, frames: i64) -> i64 |
| 198 | func eld_zone_line(st: *i64, name: i64) -> i64 |
| 210 | func eld_report(st: *i64, base: i64, v: i64, seed: i64, q_arg: i64, frames: i64, target_fps: i64) -> i64 |
| 357 | func eld_img(base: i64) -> *VdImg |
| 379 | func eld_usage() -> i64 |
| 387 | func main(argc: i64, argv: *i64) -> i64 |