nx_rigfloor.nx
buildroot/runtime/nx_rigfloor.nx
about
nx_rigfloor.nx -- DERIVE THE ASSET FLOOR FROM THE REFERENCE CORPUS INSTEAD OF DECLARING IT.
WHY THIS EXISTS. nx_asset_floor_gate is THE ruler for "is this character game-ready", and it
carried five HAND-PICKED bounds: AF_VERT_MIN 4000, AF_TRI_MIN 8000, AF_TRI_MAX 120000,
AF_JOINT_MIN 40, AF_MIDLINE 3000. A picked bound structurally cannot answer the question the
operator actually asks -- can we emit something that MATCHES THE MODELS WE HAVE -- because it
is not a function of the models we have. This organ makes the bound a MEASUREMENT of the
reference population, so the gate stops ASSERTING a floor and starts REPORTING one.
THIS IS NOT A SECOND RULER. nx_asset_floor_gate remains the one ruler; this is the PRODUCER
that derives its bounds into a conf the gate reads. Producer and consumer cannot disagree
because there is exactly one of each. nx_spendgate ranked nx_asset_floor_gate as the top
incumbent for this intent -- extending it is the entire point, and a rival floor organ would
be the duplicate-ruler defect.
ROSTER-DRIVEN, NOT DIRECTORY-WALKING, ON PURPOSE. sys_getdents64 exists and a bounded walker
is proven in nx_wiki_content_loader. It is still the wrong primitive HERE: the corpus IS the
thing under measurement, so a silently-truncated listing would not merely lose a file, it would
corrupt the derived bound itself and then publish that bound as a fact. A roster is complete by
construction and its coverage is DECIDABLE -- rows declared vs rows read, both printed, and if
they do not sum then no floor is written at all.
METHOD: OBSERVED RANGE OVER THE FULL POPULATION. No percentile index is chosen, because
choosing one would reintroduce exactly the picked constant this organ exists to remove. The
band is [min, max] of what the reference assets actually are.
WHY n>=2 IS NOT A MAGIC NUMBER. A range needs two observations to HAVE WIDTH. At n=1 the band
is a point and would refuse every asset except that one file -- a bar that is not a bar. So the
organ abstains at n<2. That is the arity of the operation, not a threshold anyone selected.
EXITS: 0 OK | 1 OUT-OF-BAND | 2 usage | 3 UNOBSERVABLE (no corpus / degenerate / partial read)
A partial roster read NEVER degrades to a floor: it abstains, because a floor derived from an
unknown fraction of the corpus is worse than no floor -- it looks authoritative and is not.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 39 | const RF_EXIT_OK: i64 = 0 |
| 40 | const RF_EXIT_OUT_OF_BAND: i64 = 1 |
| 41 | const RF_EXIT_USAGE: i64 = 2 |
| 42 | const RF_EXIT_UNOBSERVABLE: i64 = 3 |
| 45 | const RF_HDR_BYTES: i64 = 32 |
| 46 | const RF_SECHDR_BYTES: i64 = 32 |
| 47 | const RF_SEC_OFF_FIELD: i64 = 8 |
| 48 | const RF_NSEC_FIELD: i64 = 16 |
| 49 | const RF_MAGIC_BYTES: i64 = 8 |
| 50 | const RF_TAG_BYTES: i64 = 4 |
| 51 | const RF_WORD_BYTES: i64 = 8 |
| 52 | const RF_PERMIL: i64 = 1000 |
| 53 | const RF_BYTE_RADIX: i64 = 256 |
| 54 | const RF_BYTE_MASK: i64 = 255 |
| 57 | const RF_ASCII_ZERO: i64 = 48 |
| 58 | const RF_ASCII_NINE: i64 = 57 |
| 59 | const RF_ASCII_MINUS: i64 = 45 |
| 60 | const RF_ASCII_EQ: i64 = 61 |
| 61 | const RF_ASCII_NL: i64 = 10 |
| 62 | const RF_ASCII_CR: i64 = 13 |
| 63 | const RF_ASCII_HASH: i64 = 35 |
| 64 | const RF_VERB_DERIVE: i64 = 100 |
| 65 | const RF_VERB_SCORE: i64 = 115 |
| 66 | const RF_DECIMAL: i64 = 10 |
| 69 | const RF_CONF_CAP: i64 = 65536 |
| 70 | const RF_SCRATCH_CAP: i64 = 64 |
| 71 | const RF_PATH_CAP: i64 = 4096 |
| 72 | const RF_MAX_ROWS: i64 = 4096 |
| 73 | const RF_STDOUT: i64 = 1 |
| 74 | const RF_PAIR: i64 = 2 |
| 80 | const RF_CONTAINER_UNKNOWN: i64 = 0 |
| 81 | const RF_CONTAINER_NXA: i64 = 1 // NXANIM01 -- our shipped rigged asset |
| 82 | const RF_CONTAINER_MSH: i64 = 2 // NXMSH2 -- what nx_gltf2mesh emits from a glTF donor |
| 86 | const RF_MSH_MAGIC_BYTE: i64 = 78 // 'N' at offset 0 |
| 87 | const RF_MSH_VER_OFF: i64 = 5 |
| 88 | const RF_MSH_VER_BYTE: i64 = 50 // '2' at offset 5 -- the version discriminator |
| 89 | const RF_MSH_NLAYER_FIELD: i64 = 8 // u32 LE layer count |
| 90 | const RF_MSH_NTRI_FIELD: i64 = 12 // u32 LE triangle count |
| 91 | const RF_MSH_HDR_BYTES: i64 = 16 // FIXED header; the FULL header is 16 + nlay*24 |
| 92 | const RF_MSH_LAYROW_BYTES: i64 = 24 |
| 93 | const RF_U32_BYTES: i64 = 4 |
| 97 | const RF_MSH_TRIREC_BYTES: i64 = 84 |
| 104 | const RF_AXES: i64 = 7 |
| 105 | const RF_AX_VERTS: i64 = 0 |
| 106 | const RF_AX_TRIS: i64 = 1 |
| 107 | const RF_AX_JOINTS: i64 = 2 |
| 108 | const RF_AX_TPV_PERMIL: i64 = 3 |
| 109 | const RF_AX_VPJ: i64 = 4 |
| 110 | const RF_AX_PARTS: i64 = 5 |
| 111 | const RF_AX_TPP: i64 = 6 // triangles per named part -- the NXMSH2 shape signal |
functions
| 113 | func rf_out(s: *u8) -> i64 |
| 120 | func rf_rd64(b: *u8, off: i64) -> i64 |
| 126 | func rf_tag_eq(b: *u8, off: i64, t: *u8) -> i64 called by 1: rf_find |
| 133 | func rf_find(b: *u8, nsec: i64, t: *u8) -> i64 |
| 144 | func rf_bputs(buf: *u8, off: i64, s: *u8) -> i64 |
| 151 | func rf_bputnum(buf: *u8, off: i64, v: i64, scratch: *u8) -> i64 |
| 166 | func rf_kv(buf: *u8, off: i64, key: *u8, v: i64, scratch: *u8) -> i64 |
| 177 | func rf_emit_band(cb: *u8, off: i64, kmin: *u8, kmax: *u8, idx: i64, |
| 184 | func rf_say(label: *u8, v: i64, scratch: *u8, line: *u8) -> i64 |
| 195 | func rf_conf_i64(buf: *u8, n: i64, key: *u8, miss: i64) -> i64 called by 1: rf_score |
| 243 | func rf_rd32(b: *u8, off: i64) -> i64 called by 1: rf_measure |
| 255 | func rf_measure(path: *u8, out: *i64, avail: *i64) -> i64 |
| 337 | func rf_usage() -> i64 |
| 345 | func rf_derive(roster: *u8, outconf: *u8) -> i64 |
| 549 | func rf_band(name: *u8, v: i64, lo: i64, hi: i64, scratch: *u8, line: *u8, bad: *i64) -> i64 |
| 575 | func rf_score(asset: *u8, conf: *u8) -> i64 |
| 659 | func main(argc: i64, argv: *i64) -> i64 |