code wiki / (root) / nx_tier_ladder_lib.nx

nx_tier_ladder_lib.nx

buildroot/runtime/nx_tier_ladder_lib.nx

42140 B783 linesdepth 2pulls 2 transitivereach 197 importersview sourcekind librarytopic tier
docsdependenciesstructsconstsfunctions

about

nx_tier_ladder_lib.nx -- THE RENDER-DOOR LADDER RULER (LIB, no main). gpu GP3 rk_tier_ladder / gameengine GE45. THE DEFECT THIS EXISTS TO MAKE REFUSABLE. Every world page chose its renderer by a chain of ifs buried in emitted JS (WebGPU only under ?gpu=1, WebGL2 by default, the sovereign rasteriser on ?gl=0 or on refusal), announced the winner as a free-text badge, and said NOTHING about why the higher doors were not taken. A headless capture of nishifamily.com/world/beach?gpu=1 on 2026-09-02 read `kernel unrun` on the WebGL2 tier with no word about WebGPU: levered off? adapter absent? device limits? a wedged requestAdapter? Four causes, one silence -- and the operator's question "which door drew this frame and why" had no mechanical answer. ONE TABLE, TWO SURFACES (the nx_glprobe_lib law). The ladder is DATA in knowledge/tier_ladder.conf: one door| row per renderer with its order, its state (default / levered / fallback), the URL lever that asks for it, the capability it requires and the badge it announces, plus limit| rows naming the GPUSupportedLimits minima the GE43 kernel needs. This lib parses those rows, walks them natively (tl_pick, tl_reason) and EMITS the same rows plus the JS that walks them in the page (tl_js). nx_tier_ladder_gate pins the native walk with a truth table and pins the emitted JS to the same ids and the same reason vocabulary, so the page and the ruler cannot disagree. The ORDER lives in the conf and nowhere in code: flipping WebGPU to the default (gameengine GE1) is an edit to that file under the operator's order, never a code change. REFUSE, NEVER GUESS. A conf whose fallback is not the last row, whose orders regress, whose door carries a double quote or a backslash (it is emitted into a JS string literal verbatim) or whose limit is not a positive integer is REFUSED with a numbered verdict and the offending line, and tl_emit then emits a NAMED absence (window.__nx_ladder=null plus window.__nx_ladder_absent) and announces it on stderr, so a page built from a broken conf says so on its HUD instead of drawing an unexplained frame. WHAT THE DOOR DRAWS IS DATA TOO (S0, 2026-09-04). Each door row carries a draws word -- world / world+cast / world+markers -- parsed here (tl_door_draws), carried into window.__nx_ladder, read back for the active door by nxDoorDraws() and appended to the tier badge by the page emitter, so a gate, the HUD, page-verify and the referee can STATE that a WebGPU frame carries no character instead of inferring it from prose (the fact lived only in the webgpu row's announce field and the token cast occurred 0 times in this lib). An unknown draws word REFUSES (TL_E_DRAWS) and a door row without the field REFUSES BY NAME (TL_E_DRAWS_ABSENT) -- never a default to the permissive value: pr_mode silently defaulting an unrecognised route mode to the open value is the measured defect this must not repeat, and a row written before the field existed must be re-declared by a reader of the emitter, not guessed at by the parser. PLAIN-IF ONLY (no else) and NO BITWISE OPERATORS -- the imported-else parser landmine, debt 1784673261; per-door lever flags travel as an i64 array, never as bits. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 63 importers

nx_syscalls.nx nx_tier_ladder_lib.nx nx_game_page_affine_candidate_t361 nx_game_page_authored_material_t54 nx_game_page_body_t138.nx nx_game_page_canonical_t135.nx nx_game_page_catwalk_lighting_cand nx_game_page_emit.nx nx_game_page_emit_sand_review.nx nx_game_page_eye_t138.nx nx_game_page_gait_candidate_t139.n nx_game_page_garment_t132.nx

diagram shows first 10 each side; +0 more imports, +53 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_game_page_affine_candidate_t361.nxnx_game_page_authored_material_t54.nxnx_game_page_body_t138.nxnx_game_page_canonical_t135.nxnx_game_page_catwalk_lighting_candidate_t316.nxnx_game_page_emit.nxnx_game_page_emit_sand_review.nxnx_game_page_eye_t138.nxnx_game_page_gait_candidate_t139.nxnx_game_page_garment_t132.nxnx_game_page_gpu_timing_current_candidate.nxnx_game_page_gpu_timing_pool_candidate.nxnx_game_page_hair_attachment_candidate_t263.nxnx_game_page_hair_attachment_t283.nxnx_game_page_hair_guides_candidate_t263.nxnx_game_page_hair_t138.nxnx_game_page_host_candidate_t341.nxnx_game_page_identity_candidate.nxnx_game_page_imported_body_t45.nxnx_game_page_imported_t262.nxnx_game_page_inspection_distance_t235.nxnx_game_page_inspection_t142.nxnx_game_page_integrated_t73.nxnx_game_page_knight_bind_t25.nxnx_game_page_knight_feedback_t28.nxnx_game_page_knight_feedback_t29.nxnx_game_page_knight_support_t31.nxnx_game_page_knight_support_t31_before_t44.nxnx_game_page_length_diag_t140.nxnx_game_page_lit_candidate_t181.nxnx_game_page_material_body_t61.nxnx_game_page_material_candidate_t181.nxnx_game_page_material_compose_t55.nxnx_game_page_material_schema_candidate_t181.nxnx_game_page_metadata_candidate_t220.nxnx_game_page_mip_candidate_t241.nxnx_game_page_motion_candidate_t328.nxnx_game_page_motion_inventory_candidate_t330.nxnx_game_page_move_t72.nxnx_game_page_owned_candidate_t181.nxnx_game_page_pipeline_t64.nxnx_game_page_pre_inspection_t142.nxnx_game_page_pre_toon_region_t143.nxnx_game_page_procedural_review_candidate_t333.nxnx_game_page_recovery_feedback_t28.nxnx_game_page_recovery_t23.nxnx_game_page_rig_comparison_t332.nxnx_game_page_rig_inspection_t230.nxnx_game_page_rig_observation_candidate_t331.nxnx_game_page_scene_light_candidate_t364.nxnx_game_page_search_t53.nxnx_game_page_shared_candidate_t340.nxnx_game_page_skin_t138.nxnx_game_page_static_candidate_t338.nxnx_game_page_toon_region_candidate_t143.nxnx_game_page_visitors_inspection_t142.nxnx_game_page_visitors_t140.nxnx_game_page_workbench_candidate_t342.nxnx_game_page_workspace_body_t49.nxnx_game_page_workspace_body_t59.nxnx_game_page_workspace_t48.nxnx_movement_base_page_t139.nxnx_tier_ladder_gate.nx

structs

none

consts

40const TL_CONF: *u8 = "../knowledge/tier_ladder.conf"
44const TL_TBL_CELLS: i64 = 112
45const TL_TBL_BYTES: i64 = 896
46const TL_MAXD: i64 = 8
47const TL_MAXL: i64 = 8
48const TL_H_ND: i64 = 0
49const TL_H_NL: i64 = 1
50const TL_H_ERR: i64 = 2
51const TL_H_BUF: i64 = 3
52const TL_H_N: i64 = 4
53const TL_H_LINE: i64 = 5
54const TL_DOOR0: i64 = 8
55const TL_DW: i64 = 8
56const TL_D_ID: i64 = 0
57const TL_D_ORDER: i64 = 1
58const TL_D_STATE: i64 = 2
59const TL_D_LEVER: i64 = 3
60const TL_D_REQ: i64 = 4
61const TL_D_ANN: i64 = 5
62const TL_D_DRAWS: i64 = 6 // S0: cell 6 of the TL_DW=8 door record (cells 0..5 were in use; 7 stays spare)
63const TL_LIM0: i64 = 72
64const TL_LW: i64 = 4
65const TL_L_KEY: i64 = 0
66const TL_L_MIN: i64 = 1
67const TL_L_WHY: i64 = 2
72const TL_H_NB: i64 = 6
73const TL_BOOT0: i64 = 104
74const TL_B_MS: i64 = 0
75const TL_B_LEVER: i64 = 1
76const TL_B_MAX: i64 = 2
77const TL_BOOT_KEYS: i64 = 3
78const TL_K_BOOT: *u8 = "boot"
79const TL_BK_MS: *u8 = "gpu_boot_ms"
80const TL_BK_LEVER: *u8 = "gpu_boot_lever"
81const TL_BK_MAX: *u8 = "gpu_boot_max_ms"
82const TL_BOOT_FIELDS: i64 = 4
93const TL_H_NT: i64 = 7
94const TL_THREAD0: i64 = 108
95const TL_T_FLOOR: i64 = 0
96const TL_T_CEIL: i64 = 1
97const TL_T_LEVER: i64 = 2
98const TL_THREAD_KEYS: i64 = 3
99const TL_K_THREAD: *u8 = "thread"
100const TL_TK_FLOOR: *u8 = "thread_floor"
101const TL_TK_CEIL: *u8 = "thread_ceiling"
102const TL_TK_LEVER: *u8 = "thread_lever"
103const TL_THREAD_FIELDS: i64 = 4
104const TL_BOOT_DEFAULT_MS: i64 = 4000 // only the ABSENT twin carries it: the page still boots when the conf is gone
107const TL_ST_DEFAULT: i64 = 0
108const TL_ST_LEVERED: i64 = 1
109const TL_ST_FALLBACK: i64 = 2
110const TL_S_DEFAULT: *u8 = "default"
111const TL_S_LEVERED: *u8 = "levered"
112const TL_S_FALLBACK: *u8 = "fallback"
113const TL_RQ_WEBGPU: i64 = 0
114const TL_RQ_WEBGL2: i64 = 1
115const TL_RQ_ALWAYS: i64 = 2
116const TL_Q_WEBGPU: *u8 = "webgpu"
117const TL_Q_WEBGL2: *u8 = "webgl2"
118const TL_Q_ALWAYS: *u8 = "always"
119const TL_K_DOOR: *u8 = "door"
120const TL_K_LIMIT: *u8 = "limit"
127const TL_DR_WORLD: i64 = 0
128const TL_DR_WORLD_CAST: i64 = 1
129const TL_DR_WORLD_MARKERS: i64 = 2
130const TL_W_WORLD: *u8 = "world"
131const TL_W_WORLD_CAST: *u8 = "world+cast"
132const TL_W_WORLD_MARKERS: *u8 = "world+markers"
135const TL_OK: i64 = 0
136const TL_E_UNREADABLE: i64 = 1
137const TL_E_FIELDS: i64 = 2
138const TL_E_STATE: i64 = 3
139const TL_E_REQ: i64 = 4
140const TL_E_FALLBACK: i64 = 6
141const TL_E_ORDER: i64 = 7
142const TL_E_NO_DOORS: i64 = 8
143const TL_E_QUOTE: i64 = 9
144const TL_E_TOO_MANY: i64 = 10
145const TL_E_LIMIT: i64 = 11
146const TL_E_KIND: i64 = 12
147const TL_E_BOOT: i64 = 13
148const TL_E_THREAD: i64 = 14
149const TL_E_DRAWS: i64 = 15 // S0: a door's draws word is outside the vocabulary -- REFUSED, never defaulted
150const TL_E_DRAWS_ABSENT: i64 = 16 // S0: a door row carries no draws field (the pre-S0 seven-field shape) -- REFUSED BY NAME
154const TL_R_TAKEN: *u8 = "taken"
155const TL_R_BELOW: *u8 = "below-taken"
156const TL_R_LEVER_OFF: *u8 = "levered-off"
157const TL_R_NOCAP: *u8 = "capability-absent"
158const TL_R_FAILED: *u8 = "failed"
159const TL_R_UNEXPLAINED: *u8 = "not-taken:unexplained"
160const TL_R_UNDECIDED: *u8 = "undecided"
161const TL_R_ABSENT: *u8 = "ladder-absent"
162const TL_R_UNMAPPED: *u8 = "unmapped:" // nxDoorId / nxDoorDraws prefix for a requirement or door the ladder does not carry
166const TL_T_R_ABSENT: *u8 = "thread-rows-absent"
167const TL_T_R_NOSHARE: *u8 = "no-shared-memory"
168const TL_T_R_LEVER: *u8 = "lever"
169const TL_T_R_CEIL: *u8 = "clamped-to-ceiling"
170const TL_T_R_FLOOR: *u8 = "clamped-to-floor"
171const TL_T_R_MEASURED: *u8 = "measured-cores"
173const TL_A_NL: i64 = 10
174const TL_A_CR: i64 = 13
175const TL_A_HASH: i64 = 35
176const TL_A_PIPE: i64 = 124
177const TL_A_QUOTE: i64 = 34
178const TL_A_BSLASH: i64 = 92
179const TL_A_0: i64 = 48
180const TL_A_9: i64 = 57
181const TL_B10: i64 = 10
182const TL_JS_CAP: i64 = 32768 // raised with the GE30 thread block; the door twin alone used ~6 KB
183const TL_NUM_SCRATCH: i64 = 32
184const TL_LP_BYTES: i64 = 16
185const TL_FIELD_SLOTS: i64 = 8
186const TL_FIELD_BYTES: i64 = 64
187const TL_DOOR_FIELDS: i64 = 8 // S0: door|id|order|state|lever|requires|draws|announce
188const TL_DOOR_FIELDS_LEGACY: i64 = 7 // the pre-S0 row shape: refused as TL_E_DRAWS_ABSENT so the verdict names the missing field, not a bare count
189const TL_LIMIT_FIELDS: i64 = 4
190const TL_STDERR: i64 = 2
191const TL_COMPOSE_MARK: *u8 = "tl_emit()"

functions

193func tl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: maintl_find
194func tl_seq(a: *u8, b: *u8) -> i64
200func tl_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
201func tl_catn(d: *u8, o: i64, v: i64) -> i64
213func tl_num(s: *u8) -> i64
called by 1: tl_parse
227func tl_find(buf: *u8, n: i64, from: i64, needle: *u8) -> i64
called by 2: maintl_composes calls 1: tl_slen
240func tl_has_quote_or_bslash(s: *u8) -> i64
called by 1: tl_parse
252func tl_str(tbl: *i64, off: i64) -> *u8 { return (tbl[TL_H_BUF] + off) as *u8 }
253func tl_doors(tbl: *i64) -> i64 { return tbl[TL_H_ND] }
called by 2: tg_door_by_reqmain
254func tl_limits(tbl: *i64) -> i64 { return tbl[TL_H_NL] }
called by 1: main
255func tl_dcell(tbl: *i64, i: i64, f: i64) -> i64 { return tbl[TL_DOOR0 + i * TL_DW + f] }
256func tl_lcell(tbl: *i64, i: i64, f: i64) -> i64 { return tbl[TL_LIM0 + i * TL_LW + f] }
257func tl_door_id(tbl: *i64, i: i64) -> *u8 { return tl_str(tbl, tl_dcell(tbl, i, TL_D_ID)) }
called by 2: maintl_js calls 2: tl_strtl_dcell
258func tl_door_order(tbl: *i64, i: i64) -> i64 { return tl_dcell(tbl, i, TL_D_ORDER) }
called by 2: maintl_js calls 1: tl_dcell
259func tl_door_state(tbl: *i64, i: i64) -> i64 { return tl_dcell(tbl, i, TL_D_STATE) }
called by 4: maintl_picktl_reasontl_js calls 1: tl_dcell
260func tl_door_lever(tbl: *i64, i: i64) -> *u8 { return tl_str(tbl, tl_dcell(tbl, i, TL_D_LEVER)) }
called by 1: tl_js calls 2: tl_strtl_dcell
261func tl_door_req(tbl: *i64, i: i64) -> i64 { return tl_dcell(tbl, i, TL_D_REQ) }
262func tl_door_announce(tbl: *i64, i: i64) -> *u8 { return tl_str(tbl, tl_dcell(tbl, i, TL_D_ANN)) }
called by 1: tl_js calls 2: tl_strtl_dcell
263func tl_door_draws(tbl: *i64, i: i64) -> i64 { return tl_dcell(tbl, i, TL_D_DRAWS) }
called by 2: maintl_js calls 1: tl_dcell
264func tl_limit_key(tbl: *i64, i: i64) -> *u8 { return tl_str(tbl, tl_lcell(tbl, i, TL_L_KEY)) }
called by 2: maintl_js calls 2: tl_strtl_lcell
265func tl_limit_min(tbl: *i64, i: i64) -> i64 { return tl_lcell(tbl, i, TL_L_MIN) }
called by 2: maintl_js calls 1: tl_lcell
266func tl_limit_why(tbl: *i64, i: i64) -> *u8 { return tl_str(tbl, tl_lcell(tbl, i, TL_L_WHY)) }
calls 2: tl_strtl_lcell
267func tl_boot_ms(tbl: *i64) -> i64 { return tbl[TL_BOOT0 + TL_B_MS] }
called by 2: maintl_js
268func tl_boot_lever(tbl: *i64) -> *u8 { return tl_str(tbl, tbl[TL_BOOT0 + TL_B_LEVER]) }
called by 2: maintl_js calls 1: tl_str
269func tl_boot_max(tbl: *i64) -> i64 { return tbl[TL_BOOT0 + TL_B_MAX] }
called by 2: maintl_js
270func tl_state_name(st: i64) -> *u8
called by 1: tl_js
275func tl_req_name(rq: i64) -> *u8
called by 1: tl_js
280func tl_state_of(s: *u8) -> i64
called by 1: tl_parse calls 1: tl_seq
286func tl_req_of(s: *u8) -> i64
called by 1: tl_parse calls 1: tl_seq
292func tl_draws_name(dr: i64) -> *u8
called by 2: maintl_js
298func tl_draws_of(s: *u8) -> i64
called by 1: tl_parse calls 1: tl_seq
309func tl_parse(b: *u8, n: i64, tbl: *i64) -> i64
507func tl_load(tbl: *i64) -> i64
532func tl_cap_ok(rq: i64, cap_webgpu: i64, cap_webgl2: i64) -> i64
called by 2: tl_picktl_reason
537func tl_pick(tbl: *i64, cap_webgpu: i64, cap_webgl2: i64, levers: *i64) -> i64
556func tl_reason(tbl: *i64, i: i64, picked: i64, cap_webgpu: i64, cap_webgl2: i64, levers: *i64) -> *u8
571func tl_threads_declared(tbl: *i64) -> i64 { if tbl[TL_H_NT] == TL_THREAD_KEYS { return 1 } return 0 }
572func tl_thread_floor(tbl: *i64) -> i64 { return tbl[TL_THREAD0 + TL_T_FLOOR] }
573func tl_thread_ceiling(tbl: *i64) -> i64 { return tbl[TL_THREAD0 + TL_T_CEIL] }
574func tl_thread_lever(tbl: *i64) -> *u8 { return tl_str(tbl, tbl[TL_THREAD0 + TL_T_LEVER]) }
called by 2: maintl_js_threads calls 1: tl_str
579func tl_thread_pick(tbl: *i64, measured: i64, lever: i64, shared: i64) -> i64
589func tl_thread_why(tbl: *i64, measured: i64, lever: i64, shared: i64) -> *u8
601func tl_js_threads(d: *u8, p0: i64, tbl: *i64) -> i64
639func tl_js(tbl: *i64) -> *u8
720func tl_js_absent(rc: i64, line: i64) -> *u8
762func tl_emit() -> *u8
780func tl_composes(buf: *u8, n: i64) -> i64