code wiki / _hdl_build / nx_graphics_sota_rollup.nx

nx_graphics_sota_rollup.nx source

↩ module page · 152 lines · 11255 B

1// nx_graphics_sota_rollup.nx -- Gx-0: the UNIFIED sovereign graphics/game SOTA ruler (domain rollup). 2// Composes the gate-proven render OUTPUTS of our sovereign stack into ONE domain census and emits the 3// /compare/graphics interchange JSON (the MCP + atlas + compare-plane data). LIAR-KILL: every credited 4// axis cites a REAL rendered artifact on disk (pixels/bytes), never source-exists. no-wave: RED if all-HAVE. 5// Sovereign steer 2026-07-18: our own pipeline into NishiOS + Nishi-Browser + mobile; NEVER host WebGPU. 6// license_tier: ORIGINAL expect_exit: 0 7import "nx_syscalls.nx" 8const K_MAGIC_262144: i64 = 262144 9 10func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 11func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } 12func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 13func fexists(path: *u8) -> i64 { 14 let szp: *i64 = sys_mmap(16) as *i64 15 let b: *u8 = sys_read_file(path, szp) 16 if (b as i64) == 0 { return 0 } 17 if szp[0] < 64 { return 0 } 18 return 1 19} 20func ocat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a } 21func ocatn(o: *u8, at: i64, v: i64) -> i64 { 22 let b: *u8 = sys_mmap(32) as *u8 23 var x: i64 = v 24 var i: i64 = 31 25 if x == 0 { b[i]=48 as u8; i=i-1 } 26 while x > 0 { b[i]=(48+x%10) as u8; x=x/10; i=i-1 } 27 var a: i64 = at 28 var j: i64 = i+1 29 while j < 32 { o[a]=b[j]; a=a+1; j=j+1 } 30 return a 31} 32// one domain axis: cite a real artifact; liar-kill downgrades a HAVE/PARTIAL with no artifact to GAP. 33func ax(rep: *u8, ro: *i64, jbuf: *u8, jo: *i64, sums: *i64, first: *i64, name: *u8, art: *u8, vin: i64, note: *u8) -> i64 { 34 var v: i64 = vin 35 var af: i64 = 0 36 if (art as i64) != 0 { if slen(art) > 0 { af = fexists(art) } } 37 if v > 0 { if af == 0 { v = 0 } } 38 var o: i64 = ro[0] 39 o = ocat(rep, o, " AXIS " as *u8); o = ocat(rep, o, name); o = ocat(rep, o, " " as *u8) 40 if v == 2 { o = ocat(rep, o, "HAVE " as *u8) } 41 if v == 1 { o = ocat(rep, o, "PARTIAL " as *u8) } 42 if v == 0 { o = ocat(rep, o, "GAP " as *u8) } 43 if vin > 0 { if af == 0 { o = ocat(rep, o, "[LIAR-KILL artifact missing] " as *u8) } } 44 o = ocat(rep, o, note); o = ocat(rep, o, "\n" as *u8) 45 ro[0] = o 46 var j: i64 = jo[0] 47 if first[0] == 0 { j = ocat(jbuf, j, "," as *u8) } 48 first[0] = 0 49 j = ocat(jbuf, j, "{\x22name\x22:\x22" as *u8); j = ocat(jbuf, j, name) 50 j = ocat(jbuf, j, "\x22,\x22verdict\x22:\x22" as *u8) 51 if v == 2 { j = ocat(jbuf, j, "HAVE" as *u8) } 52 if v == 1 { j = ocat(jbuf, j, "PARTIAL" as *u8) } 53 if v == 0 { j = ocat(jbuf, j, "GAP" as *u8) } 54 j = ocat(jbuf, j, "\x22,\x22artifact\x22:\x22" as *u8) 55 if (art as i64) != 0 { j = ocat(jbuf, j, art) } 56 j = ocat(jbuf, j, "\x22}" as *u8) 57 jo[0] = j 58 sums[0] = sums[0] + 1 59 if v == 2 { sums[1] = sums[1] + 1 } 60 if v == 1 { sums[2] = sums[2] + 1 } 61 return v 62} 63 64func main() -> i64 { 65 hw("=== nx_graphics_sota_rollup -- Gx-0: unified sovereign graphics/game SOTA ruler ===\n" as *u8) 66 var fails: i64 = 0 67 let rep: *u8 = sys_mmap(K_MAGIC_262144) 68 let ro: *i64 = sys_mmap(16) as *i64 69 let jb: *u8 = sys_mmap(K_MAGIC_262144) 70 let jo: *i64 = sys_mmap(16) as *i64 71 let sums: *i64 = sys_mmap(64) as *i64 72 let first: *i64 = sys_mmap(16) as *i64 73 first[0] = 1 74 var o: i64 = 0 75 o = ocat(rep, o, "SOVEREIGN GRAPHICS & GAME RENDER -- domain rollup (OS + Browser, sovereign, no host-WebGPU)\n" as *u8) 76 o = ocat(rep, o, "Composes gate-proven render OUTPUTS; each credited axis cites a real artifact (pixels/bytes).\n\n== PIPELINE ==\n" as *u8) 77 ro[0] = o 78 var j: i64 = 0 79 j = ocat(jb, j, "{\x22v\x22:1,\x22domain\x22:\x22graphics\x22,\x22title\x22:\x22Sovereign Graphics & Game Render (OS+Browser)\x22,\x22axes\x22:[" as *u8) 80 jo[0] = j 81 82 ax(rep,ro,jb,jo,sums,first,"software-raster-core" as *u8,"knowledge/nx_swgpu.png" as *u8,2,"tiled 512x384 per-pixel-lit sovereign SW GPU (nx_swgpu), zero libs" as *u8) 83 ax(rep,ro,jb,jo,sums,first,"sdf-raymarch" as *u8,"knowledge/nx_sdfbody.png" as *u8,2,"threaded SDF raymarcher x13.15 (nx_sdfrender_mt)" as *u8) 84 ax(rep,ro,jb,jo,sums,first,"trimesh-zbuffer" as *u8,"knowledge/nx_trimesh.png" as *u8,2,"barycentric raster + exact z-buffer (nx_trimesh)" as *u8) 85 ax(rep,ro,jb,jo,sums,first,"smooth-shading" as *u8,"knowledge/nx_phong.png" as *u8,2,"Gouraud + Blinn-Phong specular" as *u8) 86 ax(rep,ro,jb,jo,sums,first,"pbr-material" as *u8,"knowledge/nishi_being_full.glb" as *u8,1,"per-material metallic-roughness in glTF; renderer still Blinn-Phong (residual energy-conserving BRDF + IBL)" as *u8) 87 ax(rep,ro,jb,jo,sums,first,"texture-mapping" as *u8,"knowledge/nx_boxtex.png" as *u8,2,"per-fragment UV on Khronos BoxTextured (nx_boxtex)" as *u8) 88 ax(rep,ro,jb,jo,sums,first,"anti-aliasing" as *u8,"knowledge/nx_aa.png" as *u8,2,"SSAA 2x supersample (edge 146->44)" as *u8) 89 ax(rep,ro,jb,jo,sums,first,"global-illumination" as *u8,"knowledge/nx_cornell.png" as *u8,1,"Cornell radiosity colour-bleed (residual spectral + photo compare)" as *u8) 90 ax(rep,ro,jb,jo,sums,first,"skinning-animation" as *u8,"knowledge/nishi_being_walk.glb" as *u8,2,"9-joint FK skin + walk-cycle glTF" as *u8) 91 ax(rep,ro,jb,jo,sums,first,"asset-io" as *u8,"knowledge/nx_bunny.png" as *u8,2,"glTF/OBJ IO + Khronos/Stanford corpus (Stanford bunny 35947v)" as *u8) 92 ax(rep,ro,jb,jo,sums,first,"scene-graph" as *u8,"knowledge/nx_scene_graph.txt" as *u8,2,"transform hierarchy world=parent*local (nx_scenegraph)" as *u8) 93 ax(rep,ro,jb,jo,sums,first,"parametric-subdiv" as *u8,"knowledge/nx_bezier_patch.stl" as *u8,1,"Bezier patch + Loop subdivision (residual rational-NURBS)" as *u8) 94 95 o = ro[0]; o = ocat(rep, o, "\n== SOVEREIGN SURFACES (2026-07-18 steer: no host-WebGPU) ==\n" as *u8); ro[0] = o 96 ax(rep,ro,jb,jo,sums,first,"nishios-native-surface" as *u8,"knowledge/nx_swgpu.png" as *u8,2,"renders on our CPU/NishiOS software GPU, integer/deterministic" as *u8) 97 ax(rep,ro,jb,jo,sums,first,"nishi-browser-3d-surface" as *u8,0 as *u8,0,"GAP (Gx-1): wire nx_swgpu into the Nishi-Browser framebuffer; browser paints sovereignly today but no 3D pipeline yet" as *u8) 98 ax(rep,ro,jb,jo,sums,first,"mobile-portability" as *u8,0 as *u8,0,"GAP (Gx-2): hardware-agnostic ~25-op IR + aarch64 backend" as *u8) 99 ax(rep,ro,jb,jo,sums,first,"real-silicon-gpu-exec" as *u8,0 as *u8,0,"GAP (Gx-3): sovereign submit built vs spec models; blocked on native-Linux GPU key" as *u8) 100 101 o = ro[0]; o = ocat(rep, o, "\n== COMPAT / CONVERGENCE ==\n" as *u8); ro[0] = o 102 ax(rep,ro,jb,jo,sums,first,"directx-compat-d3d11" as *u8,"knowledge/warp_shaded.ppm" as *u8,1,"sovereign d3d11.dll pixel-exact vs Microsoft WARP thru real API (geometry+shader+texture); residual present-to-window + silicon" as *u8) 103 ax(rep,ro,jb,jo,sums,first,"tensor-core-neural-render" as *u8,0 as *u8,0,"GAP: HMMA/IMMA/QMMA ISA bit-exact vs NVIDIA (compute-proven); neural-render-on-silicon pending key" as *u8) 104 105 let grounded: i64 = sums[0]; let have: i64 = sums[1]; let part: i64 = sums[2]; let gap: i64 = grounded-have-part 106 let score: i64 = (have*1000 + part*400) / grounded 107 hw("\n grounded="); pn(grounded); hw(" HAVE="); pn(have); hw(" PARTIAL="); pn(part); hw(" GAP="); pn(gap); hw(" COVERAGE="); pn(score); hw("/1000\n" as *u8) 108 109 j = jo[0] 110 j = ocat(jb, j, "],\x22coverage_permil\x22:" as *u8); j = ocatn(jb, j, score) 111 j = ocat(jb, j, ",\x22have\x22:" as *u8); j = ocatn(jb, j, have) 112 j = ocat(jb, j, ",\x22partial\x22:" as *u8); j = ocatn(jb, j, part) 113 j = ocat(jb, j, ",\x22gap\x22:" as *u8); j = ocatn(jb, j, gap) 114 j = ocat(jb, j, ",\x22grounded\x22:" as *u8); j = ocatn(jb, j, grounded) 115 j = ocat(jb, j, ",\x22sub_censuses\x22:{\x22foundation\x22:688,\x22swgpu\x22:583,\x22sovgpu\x22:343}" as *u8) 116 j = ocat(jb, j, ",\x22sovereign_exceeds\x22:[\x22bit-exact deterministic render (pixel-exact vs Microsoft WARP)\x22,\x22one-owner stack lang-compiler-IR-raster-VM-OS-driver, zero libs\x22,\x22cross-surface by construction: NishiOS + Nishi-Browser, no host WebGPU/WebGL\x22,\x22never-brick by construction\x22]" as *u8) 117 j = ocat(jb, j, ",\x22sota_bar\x22:{\x22incumbents\x22:[\x22Unreal Engine 5\x22,\x22Unity\x22,\x22Godot\x22,\x22Bevy\x22,\x22three.js\x22,\x22WebGPU/wgpu\x22],\x22honest\x22:\x22presence measured; depth behind on GPU-accel real-time (Nanite/Lumen-class) pending Gx-1/2/3\x22}" as *u8) 118 j = ocat(jb, j, ",\x22keystone_gaps\x22:[\x22nishi-browser-3d Gx-1\x22,\x22mobile agnostic-IR+aarch64 Gx-2\x22,\x22real-silicon exec Gx-3 (operator key)\x22]}" as *u8) 119 jb[j] = 0 as u8 120 121 let fd: i64 = sys_openat_wr("knowledge/graphics_sota.json\x00" as *u8, 0x1a4) 122 sys_write(fd, jb, j); sys_close(fd) 123 hw(" JSON -> knowledge/graphics_sota.json ("); pn(j); hw(" bytes)\n" as *u8) 124 125 o = ro[0] 126 o = ocat(rep, o, "\nCOVERAGE " as *u8); o = ocatn(rep, o, score); o = ocat(rep, o, "/1000 (HAVE " as *u8); o = ocatn(rep, o, have); o = ocat(rep, o, " / PARTIAL " as *u8); o = ocatn(rep, o, part); o = ocat(rep, o, " / GAP " as *u8); o = ocatn(rep, o, gap); o = ocat(rep, o, ")\n" as *u8) 127 o = ocat(rep, o, "SUB-CENSUSES (gate-proven): foundation 688 / swgpu 583 / sovgpu 343\n" as *u8) 128 o = ocat(rep, o, "EXCEED (measured): bit-exact deterministic render (pixel-exact vs WARP) . one-owner stack . cross-surface no-host-WebGPU . never-brick\n" as *u8) 129 o = ocat(rep, o, "KEYSTONE GAPS: Nishi-Browser 3D (Gx-1) . mobile agnostic-IR+aarch64 (Gx-2) . real-silicon exec (Gx-3, operator key)\n" as *u8) 130 rep[o] = 0 as u8 131 let fd2: i64 = sys_openat_wr("knowledge/graphics_sota_rollup.txt\x00" as *u8, 0x1a4) 132 sys_write(fd2, rep, o); sys_close(fd2) 133 hw(" report -> knowledge/graphics_sota_rollup.txt ("); pn(o); hw(" bytes)\n" as *u8) 134 135 var t1: i64 = 0 136 if grounded >= 15 { t1 = 1 } 137 if t1 == 1 { hw("T1 PASS grounded>=15 axes\n" as *u8) } else { fails=fails+1; hw("T1 FAIL too few axes\n" as *u8) } 138 var t2: i64 = 0 139 if gap >= 1 { if have < grounded { t2 = 1 } } 140 if t2 == 1 { hw("T2 PASS no-wave: honest gaps named (not all-HAVE)\n" as *u8) } else { fails=fails+1; hw("T2 FAIL no-wave: all-HAVE = dishonest\n" as *u8) } 141 var t3: i64 = 0 142 if fexists("knowledge/graphics_sota.json" as *u8) == 1 { t3 = 1 } 143 if t3 == 1 { hw("T3 PASS /compare/graphics JSON interchange emitted + re-readable\n" as *u8) } else { fails=fails+1; hw("T3 FAIL json missing\n" as *u8) } 144 var t4: i64 = 0 145 if gap >= 3 { t4 = 1 } 146 if t4 == 1 { hw("T4 PASS sovereign-surface gaps tracked (Gx-1/2/3 honest)\n" as *u8) } else { fails=fails+1; hw("T4 FAIL surfaces over-claimed\n" as *u8) } 147 148 if fails == 0 { hw("GRAPHICS-SOTA-ROLLUP GREEN -- coverage "); pn(score); hw("/1000; /compare/graphics JSON staged\n" as *u8); sys_exit(0); return 0 } 149 hw("GRAPHICS-SOTA-ROLLUP RED fails="); pn(fails); hw("\n" as *u8) 150 sys_exit(1) 151 return 1 152}