code wiki / (root) / nx_game_page_gpu_timing_current_candidate.nx

nx_game_page_gpu_timing_current_candidate.nx

buildroot/runtime/nx_game_page_gpu_timing_current_candidate.nx

262144 B1770 linesdepth 9pulls 39 transitivereach 0 importersview sourcekind orphan librarytopic game
docsdependenciesstructsconstsfunctions

about

nx_game_page_emit.nx -- the SOVEREIGN game-page emitter. Until now the browser page for a wasm game was assembled by printf blocks in _ops/nx_emit_game.sh -- real emission logic living in SHELL, against the doctrine (shell only LAUNCHES sovereign ELFs). This organ owns it: reads the .wasm, base64-encodes it (composes nx_base64 -- one encoder, not a coreutils dependency), and emits the complete self-contained page (marker, shim, input forwarding, persistence bytes-mover). usage: nx_game_page_emit <wasm> <out.html> <title> <native-client-name> <controls-html> RECOVERED 2026-08-02 from buildroot/_build/nx_craft_emit.s (the 14:07 build's data section) after a failed in-place rewrite TRUNCATED this file to 0 bytes and the damage was copied to both trees. Every emitted chunk below is the exact byte sequence that build shipped, so the recovered emitter is byte-equivalent to the last one that passed both gates. license_tier: ORIGINAL

dependencies 12 imports · 0 importers

nx_syscalls.nx nx_base64.nx nx_game_page_artifact_lib.nx nx_wasmfit.nx nx_hairdyn_lib.nx nx_audio_osc.nx nx_atmosphere.nx nx_glprobe_lib.nx nx_tool_run.nx nx_genp_allow_lib.nx nx_game_page_gpu_timing_curren

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

imports: nx_syscalls.nxnx_base64.nxnx_game_page_artifact_lib.nxnx_wasmfit.nxnx_hairdyn_lib.nxnx_audio_osc.nxnx_atmosphere.nxnx_glprobe_lib.nxnx_tool_run.nxnx_genp_allow_lib.nxnx_release_delta_lib.nxnx_tier_ladder_lib.nx

imported by: nobody (leaf or entry point)

structs

none

consts

46const GPE_MT_WSRC: *u8 = "const NXMT_WSRC=\"let ex=null;onmessage=async(e)=>{const d=e.data;try{if(d.t==='init'){const i=await WebAssembly.instantiate(d.mod,{env:{memory:d.mem}});ex=i.exports;postMessage({t:'ready'});}else if(d.t==='band'){ex.render_band(BigInt(d.y0),BigInt(d.y1),BigInt(d.wid));postMessage({t:'band'});}}catch(err){postMessage({t:'err',m:String(err)});}};\";\n"
92const GPE_MAGIC_20260728: i64 = 20260728
138const GPE_EMIT_WEBGL: i64 = 1
139const GPE_WASM_CAP: i64 = 4194304
145const GPE_ALPHA_BEND_SOFT_Q12: i64 = 40960 // the gate-proven XG_ALPHA_BEND_SOFT_Q12 compliance
146const GPE_UNITS_PER_178CM: i64 = 171530 // the page's own 1.78m-to-world-unit pairing
147const GPE_G_DEN_60HZ: i64 = 640800 // that pairing carried to a per-tick accel at 60Hz
148const GPE_OUT_CAP: i64 = 16777216
176const RK_WGSL_CAP: i64 = 65536
177const RK_WGSL_TMO_MS: i64 = 8000
178const RK_WGSL_ELF: *u8 = "./nx_wgsl.elf"
179const RK_WGSL_ELF_ABS: *u8 = "/volume1/homes/elderwesto/nishihost/nx_wgsl.elf" // the emitter's CWD is not always the serving root
180const RK_WGSL_BEGIN: *u8 = "--- WGSL ---\n"
181const RK_WGSL_END: *u8 = "\nwgsl_bytes="
182const RK_KERNEL_N: i64 = 65536 // u32 lanes per probe (1024 workgroups at the backend's width of 64)
245const RK_LAYOUT_BEGIN: *u8 = "struct U{"
246const RK_LAYOUT_END: *u8 = "var<uniform> u:U;\n"
247const RK_LAYOUT_SIZE_KEY: *u8 = "layoutraw_rc="
248const RK_LAYOUT_NAMES: i64 = 18
249const RK_FLOAT_BYTES: i64 = 4
339const RK_WORLD_FS_BEGIN: *u8 = "--- world_wgsl WGSL ---\n"
340const RK_WORLD_FS_END: *u8 = "\nworld_wgsl_rc="
341const RK_WORLD_VS_BEGIN: *u8 = "--- worldvs_wgsl WGSL ---\n"
342const RK_WORLD_VS_END: *u8 = "\nworldvs_wgsl_rc="
409const RK_CAST_VS_BEGIN: *u8 = "--- cast_wgsl WGSL ---\n"
410const RK_CAST_VS_END: *u8 = "\ncast_wgsl_rc="
411const RK_CAST_FS_BEGIN: *u8 = "--- castfs_wgsl WGSL ---\n"
412const RK_CAST_FS_END: *u8 = "\ncastfs_wgsl_rc="
894const GPE_HSTR_WORDS_PER_STRAND: i64 = 24
895const GPE_AXES: i64 = 3
901const GPE_HAIR_GUIDES: i64 = 900
941const GPE_HAIR_CYC_FIRST: i64 = 1
942const GPE_HAIR_CYC_LAST: i64 = 3
945const GPE_HAIR_CYC_SKIP: i64 = 0
946const GPE_HAIR_CYC_LEN: i64 = 1
947const GPE_HAIR_CYC_SLOTS: i64 = 2
1004const GPE_HAIR_DRIVE_FRAMES: i64 = 24
1011const GPE_HAIR_DRIVE_AMP_Q8: i64 = 32
1014const GPE_HAIR_SETTLE_PERIODS_MAX: i64 = 40
1213const GPE_HAIR_AMP_CAP: i64 = 3400
1239const span=(ztop-zbot)||1;
1377const GPE_RD_HTML_CAP: i64 = 262144
1378const GPE_RD_LAND_CAP: i64 = 131072
1379const GPE_RD_PLANS: i64 = 3
1380const GPE_RD_PLAN_GE: *u8 = "buildroot/knowledge/compare/gameengine.plan"
1381const GPE_RD_PLAN_GR: *u8 = "buildroot/knowledge/compare/graphics.plan"
1382const GPE_RD_PLAN_CS: *u8 = "buildroot/knowledge/compare/charsim.plan"
1766const H8=[[.09,.07,.07],[.24,.15,.10],[.38,.24,.14],[.48,.28,.15],[.55,.25,.14],[.70,.32,.14],[.62,.47,.28],[.82,.66,.40]];\n// E-2 EYEBALL GEOMETRY. Painted eyes top out at 'alive'; a real eye is a SPHERE, which is why\n// it catches light and why the iris shifts with parallax as the head turns -- a flat disc never\n// will at any resolution. This transforms the bind-space eye centre through the HEAD joint's own\n// dual quaternion (the same composition the vertex shader uses), so the eyeball rides her skull\n// exactly. Falls back to paint if anything failed at load (uEyeG stays 0).\nfunction eyeWorld(N,v,bp,ihx,ihy,scl,px,py,pz){\nconst nj=N.nj,jf=N.jf,hj=N.hj;\nconst o0=(2*v)*nj*4,o1=(2*v+1)*nj*4;\nconst rx=jf[o0+hj*4],ry=jf[o0+hj*4+1],rz=jf[o0+hj*4+2],rw=jf[o0+hj*4+3];\nconst dx=jf[o1+hj*4],dy=jf[o1+hj*4+1],dz=jf[o1+hj*4+2],dw=jf[o1+hj*4+3];\nconst bx=bp[0],by=bp[1],bz=bp[2];\nconst cx=ry*bz-rz*by+rw*bx,cy=rz*bx-rx*bz+rw*by,cz=rx*by-ry*bx+rw*bz;\nconst sx=bx+2*(ry*cz-rz*cy),sy=by+2*(rz*cx-rx*cz),sz=bz+2*(rx*cy-ry*cx);\nconst tx=2*(rw*dx-dw*rx+(ry*dz-rz*dy));\nconst ty=2*(rw*dy-dw*ry+(rz*dx-rx*dz));\nconst tz=2*(rw*dz-dw*rz+(rx*dy-ry*dx));\nconst mx=sx+tx,my=sy+ty,mz=sz+tz;\nconst yx=mx,yy=mz,yz=-my;\nconst S=1.78/171530*scl;\nreturn [px+(yx*ihy-yz*ihx)*S,py+yy*S,pz+(yx*ihx+yz*ihy)*S];\n}\nfunction drawEyes(g){const N=GL.npc;if(!N||!N.eye)return;const E=N.eye;\nconst k=window.__npcvis|0;if(!k)return;\nconst ya=Number(ex.yaw())/4096,pi4=Number(ex.pitch())/4096;\ng.useProgram(E.pr);g.bindVertexArray(E.vao);\ng.uniform3fv(E.l.uEC,E.ec);g.uniform4fv(E.l.uEG,E.eg);g.uniform3fv(E.l.uECol,E.ecol);g.uniform1f(E.l.uETm,Number(ex.tnow())/60);\ng.uniform3f(E.l.uEcam,Number(ex.camx())/256,Number(ex.camy())/256,Number(ex.camz())/256);\ng.uniform4f(E.l.uEyp,Math.sin(ya),Math.cos(ya),Math.sin(pi4),Math.cos(pi4));\ng.uniform2f(E.l.uEres,cv.width,cv.height);if(E.l.uESk&&N.__skt)g.uniform3fv(E.l.uESk,N.__skt);\ng.enable(g.DEPTH_TEST);\ng.drawElementsInstanced(g.TRIANGLES,E.ni,g.UNSIGNED_SHORT,0,Math.min(24,k*2));\ng.bindVertexArray(null);}\nconst NXSKYF=[.095,.112,.138];\nfunction castFrame(N,nm){\nconst cam0=Number(ex.camx())/256,cam1=Number(ex.camy())/256,cam2=Number(ex.camz())/256;\nconst ya=Number(ex.yaw())/4096,pi3=Number(ex.pitch())/4096;\nconst fw0=Math.sin(ya)*Math.cos(pi3),fw1=Math.sin(pi3),fw2=Math.cos(ya)*Math.cos(pi3);\nconst nw2=performance.now();let dtf=(nw2-(N.pt||nw2))/1000;N.pt=nw2;\nif(dtf<0.001)dtf=0.001;if(dtf>0.1)dtf=0.1;\nlet nv=0;window.__npcidle=0;\nfor(let m=0;m<nm&&m<12;m++){\nconst px=Number(ex.mobx(BigInt(m)))/256,py=Number(ex.moby(BigInt(m)))/256,pz=Number(ex.mobz(BigInt(m)))/256;\nconst st=N.st[m];\n// ORGAN MOTION DOORS (seq1287 EATEN): heading, speed AND climb all read the organ's own\n// applied step (mobdx/mobdz/mobdy) -- the JS position-derivative and its absent-door\n// fallback are RETIRED (page+wasm are ONE emitted artifact, the doors are always present;\n// a fallback here is a workaround, and workarounds are bugs). Teleports never enter the\n// doors, so the dm<3 guard is gone too. Heading target still NEGATED (left-handed basis\n// vs atan2). Vertical step counts toward cadence: she strides while climbing.\nconst vx9=Number(ex.mobdx(BigInt(m)))/256,vz9=Number(ex.mobdz(BigInt(m)))/256,vy9=Number(ex.mobdy(BigInt(m)))/256;\nconst stp=Math.hypot(vx9,vz9)+Math.abs(vy9)*.7;\nconst raw=stp/dtf;st.spd+=(raw-st.spd)*.2;\n// heading gated on REAL speed: a single wander nudge used to swing st.A .18*angle -- a\n// visible twitch on a girl who is otherwise standing (part of the \"interrupted walk\" read)\nif((vx9!==0||vz9!==0)&&st.spd>0.1){let ta=-Math.atan2(vx9,vz9);let dd=ta-st.A;\nwhile(dd>Math.PI)dd-=2*Math.PI;while(dd<-Math.PI)dd+=2*Math.PI;st.A+=dd*.18;}\n// GE23 rung one: the clip clock is the ENGINE's (her path length x the cadence it derived); nothing here advances it.\n// IDLE HYSTERESIS (operator: \"the body still bounces as if the idle is an interrupted walk\").\n// The pose-hold blend was CORRECT and the single 0.03 threshold was the defect: girls micro-\n// step every few hundred ms (wander, curiosity), each nudge kicked spd over one shared\n// threshold and she churned walk<->pose forever, never settling. Easy in, hard out: enter\n// idle at <=0.03, LEAVE only above 0.15 (a real stride), and release over ~400ms not 200 --\n// a standing girl now absorbs nudges inside the held pose instead of flinching out of it.\n// S1 facing leg: a girl standing inside conversation distance turns to face the player --
1768const pdx9=cam0-px,pdz9=cam2-pz;const pdd9=Math.hypot(pdx9,pdz9);

functions

31func rk_tier_ladder() -> *u8 { return tl_emit() }
called by 1: gpe_frame_hud calls 1: tl_emit
48func gpe_mt_boot(out: *u8, p0: i64) -> i64
called by 1: gpe_frame_hud calls 2: gpe_apgpe_num
78func gpe_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
79func gpe_pn(v: i64) -> i64
150func gpe_slen(s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { k = k + 1 } return k }
151func gpe_ap(out: *u8, pos: i64, s: *u8) -> i64
157func gpe_ap_n(out: *u8, pos: i64, s: *u8, n: i64) -> i64
183func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
184func rk_err(s: *u8) -> i64 { sys_write(2, s, rk_slen(s)); return 0 }
185func rk_num(out: *u8, pos: i64, v: i64) -> i64
196func rk_find(buf: *u8, n: i64, from: i64, needle: *u8) -> i64
209func rk_js_str(out: *u8, pos: i64, src: *u8, n: i64) -> i64
225func rk_capture_wgsl(buf: *u8, ol: *i64) -> i64
250func rk_capture_layout(buf: *u8, ol: *i64) -> i64
263func rk_int_after(buf: *u8, n: i64, needle: *u8) -> i64
280func rk_uniform_offset(buf: *u8, n: i64, name: *u8) -> i64
299func rk_uniform_block(out: *u8, pos: i64) -> i64
343func rk_capture_world(buf: *u8, ol: *i64) -> i64
356func rk_world_span(buf: *u8, n: i64, begin: *u8, end: *u8, bo: *i64) -> i64
368func rk_world_block(out: *u8, pos: i64) -> i64
413func rk_capture_cast(buf: *u8, ol: *i64) -> i64
430func rk_layout_obj(out: *u8, pos: i64, buf: *u8, n: i64, rowskey: *u8, sizekey: *u8, name: *u8) -> i64
467func rk_cast_block(out: *u8, pos: i64) -> i64
508func rk_webgpu_door(out: *u8, pos: i64) -> i64
555func gpe_emit_webgpu(out: *u8, pos: i64) -> i64
587func gpe_verify(out: *u8, n: i64) -> i64
759func gpe_num(out: *u8, pos: i64, v: i64) -> i64
781func gpe_sunt(out: *u8, pos: i64) -> i64
801func gpe_npcs_emit(out: *u8, pos: i64, vnum: i64) -> i64
861func gpe_build(wasm: *u8, wn: i64, title: *u8, native: *u8, ctrl: *u8, vnum: i64, out: *u8) -> i64
902func gpe_hstr_pts() -> i64 { return GPE_HSTR_WORDS_PER_STRAND/GPE_AXES }
903func gpe_hair_nseg() -> i64 { return gpe_hstr_pts() - 1 }
904func gpe_hair_seglen() -> i64 { return SD_Q8 }
912func gpe_hair_seed(st: *i64, n: i64, rigid: i64) -> i64
953func gpe_hair_cycle(out: *i64) -> i64
986func gpe_hair_cycle_at(slot: i64) -> i64
1018func gpe_hair_drive(t: i64) -> i64
1023func gpe_hair_frames() -> i64 { return GPE_HAIR_DRIVE_FRAMES }
1031func gpe_hair_chain_bake(tbl: *i64, rigid: i64) -> i64
1117func gpe_dress_runtime(out: *u8, pos: i64) -> i64
1144func gpe_hair_runtime(out: *u8, pos: i64) -> i64
1202func gpe_hair_npc_doors(out: *u8, pos: i64) -> i64
1218func gpe_hair_geometry(out: *u8, pos: i64) -> i64
1270func gpe_garment_draw(out: *u8, pos: i64) -> i64
1279func gpe_vb_find(b: *u8, n: i64, pat: *u8, from: i64) -> i64
1303func gpe_version_badge(out: *u8, pos: i64) -> i64
1383func gpe_rd_board(path: *u8, dom: *u8, since: *u8, land: *u8, lo: i64, counts: *i64, read: *i64) -> i64
1390func gpe_release_block(out: *u8, pos: i64) -> i64
1448func gpe_frame_hud(out: *u8, pos: i64) -> i64
1470func gpe_sky_atmos(out: *u8, p: i64, src: *u8) -> i64
1474func gpe_build_s(wasm: *u8, wn: i64, title: *u8, native: *u8, ctrl: *u8, vnum: i64, seed: i64, spec: *u8, out: *u8) -> i64