code wiki / _hdl_build / nx_d3d_readiness_census.nx

nx_d3d_readiness_census.nx source

↩ module page · 111 lines · 12060 B

1// nx_d3d_readiness_census.nx -- the DRIVING INSTRUMENT for the REAL DirectX goal (operator 2026-07-12: "successful 2// when I can play my Steam games on our native directx-type library, NishiOS + Windows, superior perf, + a SOTA plan"). 3// Pointed at the ACTUAL pipeline to run a D3D game (the DXVK/vkd3d-proton model), not the rendering-foundation proxy: 4// API surface -> shader bytecode -> translation -> command/state -> backend exec -> presentation -> process host -> 5// a game renders. CRITIC = liar-kill (a claimed layer must cite a real organ file). ADVERSARY = the PROXY TRAP: the 6// graphics-foundation census reads high (688) but GAME-READINESS is far lower -- do NOT mistake the backend proxy for 7// the target. Emits the foundation-first ladder + the RACI gap (no d3d-runtime owner). license_tier: ORIGINAL expect_exit: 0 8import "nx_syscalls.nx" 9const K_MAGIC_65536: i64 = 65536 10 11func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 12func 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 } 13func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 14func fexists(path: *u8) -> i64 { 15 let szp: *i64 = sys_mmap(16) as *i64 16 let b: *u8 = sys_read_file(path, szp) 17 if (b as i64) == 0 { return 0 } 18 if szp[0] < 64 { return 0 } 19 return 1 20} 21func 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 } 22 23// one pipeline layer. status: 2=HAVE 1=PARTIAL 0=GAP. CRITIC liar-kill: status>0 requires solf to EXIST. 24func layer(rep: *u8, ro: *i64, name: *u8, solf: *u8, status: i64, note: *u8, sums: *i64) -> i64 { 25 var af: i64 = 0 26 if slen(solf) > 0 { af = fexists(solf) } 27 var verdict: i64 = 0 28 if status > 0 { if af == 1 { verdict = status } } 29 var liar: i64 = 0 30 if status > 0 { if af == 0 { liar = 1 } } 31 var o: i64 = ro[0] 32 o = ocat(rep, o, "LAYER " as *u8); o = ocat(rep, o, name) 33 if verdict == 2 { o = ocat(rep, o, " HAVE " as *u8) } 34 if verdict == 1 { o = ocat(rep, o, " PARTIAL " as *u8) } 35 if verdict == 0 { if liar == 1 { o = ocat(rep, o, " LIAR-KILL->GAP " as *u8) } } 36 if verdict == 0 { if liar == 0 { o = ocat(rep, o, " GAP " as *u8) } } 37 o = ocat(rep, o, note); o = ocat(rep, o, "\n" as *u8) 38 ro[0] = o 39 sums[0] = sums[0] + 1 40 if verdict == 2 { sums[1] = sums[1] + 1 } 41 if verdict == 1 { sums[2] = sums[2] + 1 } 42 if liar == 1 { sums[3] = sums[3] + 1 } 43 return verdict 44} 45 46func main() -> i64 { 47 hw("=== nx_d3d_readiness_census -- can we run a Steam D3D game on a native directx-type library? (the REAL goal) ===\n" as *u8) 48 var fails: i64 = 0 49 let rep: *u8 = sys_mmap(K_MAGIC_65536) 50 let ro: *i64 = sys_mmap(16) as *i64 51 let sums: *i64 = sys_mmap(64) as *i64 52 var o: i64 = 0 53 o = ocat(rep, o, "D3D GAME-READINESS CENSUS -- re-measured 2026-07-13 after loadability+COM+shader-exec proofs. The DXVK/vkd3d pipeline to run a Windows D3D game, measured against OUR organs (liar-killed).\n\n" as *u8) 54 ro[0] = o 55 56 layer(rep, ro, "D3D device/context COM API " as *u8, "runtime/nx_pe_dll_com_device.nx" as *u8, 1, "PARTIAL: a REAL COM DEVICE with COMPILED method bodies behind a vtable (nx_pe_dll_com_device): foreign Win process create()'d a device from our sovereign DLL + dispatched dev->lpVtbl->GetInfo/Render(dev,..) -> nx_cc-compiled nx_dev_get_info/nx_dev_render -> state readback + coverage-512 pixels (self-state colored). Mechanism+compiled-backend DONE; the ~100 ID3D11* methods = API BREADTH." as *u8, sums) 57 layer(rep, ro, "d3d*.dll shim (interception)" as *u8, "runtime/nx_pe_dll_d3d11.nx" as *u8, 1, "PARTIAL: a sovereign d3d11.dll exporting the REAL D3D11CreateDeviceAndSwapChain (nx_pe_dll_d3d11), called via Microsoft's OWN PFN_ typedef (12 args, stack-arg access) -> returns a conformant ID3D11Device (hr=S_OK, fl=0xb000, sc/ctx zeroed, then AddRef/GetFeatureLevel dispatch). Full game-BINDING sequence works; needs real method BODIES + install-as-d3d11.dll. Mechanism+entry DONE." as *u8, sums) 58 layer(rep, ro, "DXBC/DXIL bytecode decoder " as *u8, "runtime/nx_dxbc.nx" as *u8, 2, "HAVE (DXBC): nx_dxbc decodes real fxc-compiled DXBC (container+SM4/5 tokens), EXTERNALLY VALIDATED vs Microsoft fxc. DXIL (D3D12/LLVM-based) still pending -- but DXBC covers D3D9-11 = most Steam games." as *u8, sums) 59 layer(rep, ro, "DXBC/DXIL -> backend xlate " as *u8, "runtime/nx_dxbc_exec.nx" as *u8, 2, "HAVE (execute): nx_dxbc_exec is a register machine that EXECUTES DXBC (fxc-validated), producing shading PIXEL-EXACT vs WARP (shade/interp/persp gates 4096/4096). We INTERPRET not translate-to-SPIR-V -- a valid correctness-first backend; JIT-translate = the perf lever later." as *u8, sums) 60 layer(rep, ro, "D3D cmd/state translation " as *u8, "runtime/_hdl_build/nx_d3d_shade_gate.nx" as *u8, 1, "PARTIAL: a real draw slice (input verts -> raster -> execute shader -> shaded frame) is proven pixel-exact vs WARP; a GENERAL command/state tracker (many draws, PSOs, bind state) remains." as *u8, sums) 61 layer(rep, ro, "resource+descriptor model " as *u8, "runtime/nx_pe_dll_d3d11tex.nx" as *u8, 1, "PARTIAL: real CreateBuffer (verts) + CreateTexture2D + CreateRenderTargetView + CreateShaderResourceView + binds (OMSetRT/IASetVB/PSSetShaderResources) drive geometry/shader/TEXTURED draws PIXEL-EXACT vs WARP (nx_pe_dll_d3d11tex/draw/shade). A real resource+view set; Map/upload-readback (dynamic/staging) + descriptor-heaps (D3D12) remain." as *u8, sums) 62 layer(rep, ro, "DXGI swapchain + present " as *u8, "runtime/nx_d3d11_min.nx" as *u8, 1, "PARTIAL: nx_d3d11_min = device + swapchain + ClearRenderTargetView + Present (D0 spine) over nx_swgpu; not yet a DXGI IDXGISwapChain bound to a real HWND/display." as *u8, sums) 63 layer(rep, ro, "software raster backend " as *u8, "runtime/nx_swgpu.nx" as *u8, 2, "HAVE: nx_swgpu CPU rasterizer, now proven 4096/4096 PIXEL-EXACT vs Microsoft WARP across raster + shade + affine + perspective-correct interpolation. Correctness = SOTA-matched." as *u8, sums) 64 layer(rep, ro, "real-GPU execution (PERF) " as *u8, "" as *u8, 0, "GAP: THE PERF KEYSTONE. WARP=CPU + ours=CPU; playable modern-game FPS needs GPU accel (sovereign nx_nv/nx_kfd submit on real silicon, native-Linux/cloud). Correctness is matched; PERF is the open frontier." as *u8, sums) 65 layer(rep, ro, "Win PE game-process host " as *u8, "runtime/nx_pe_container_win.nx" as *u8, 1, "PARTIAL: Win-PE emit + container host runs OUR Win PEs; now also emits loadable DLLs + COM objects a foreign process binds. A commercial game (full Win32 subsystem + DLL import graph) is still far beyond." as *u8, sums) 66 let accept_v: i64 = layer(rep, ro, "ACCEPTANCE: a real game frame" as *u8, "runtime/nx_pe_dll_d3d11shade.nx" as *u8, 1, "PARTIAL: a real D3D11 sample renders correct frames -- geometry Draw (nx_pe_dll_d3d11draw) AND a real fxc DXBC PIXEL SHADER created via CreatePixelShader[slot15,5-arg]+PSSetShader+Draw, EXECUTED per-draw (sh_execute_scratch), triangle PIXEL-EXACT vs WARP 4096/4096 (nx_pe_dll_d3d11shade vs warp_shaded.ppm). Shader color COMPUTED from bytecode, not hand-picked. A full GAME (textures + present-to-window + perf) = the HAVE bar, remains." as *u8, sums) 67 // NEG-CONTROL (liar-kill teeth): a phantom 'stack complete' claim with no file -> must be forced to GAP. 68 layer(rep, ro, "NEG-CONTROL phantom d3d done" as *u8, "runtime/nx_d3d_phantom_absent.nx" as *u8, 2, "claims HAVE but has NO file -> the census must LIAR-KILL it to GAP (teeth check)." as *u8, sums) 69 70 let total: i64 = sums[0]; let have: i64 = sums[1]; let part: i64 = sums[2]; let liar: i64 = sums[3] 71 let score: i64 = (have*1000 + part*400) / total 72 hw("\n layers="); pn(total); hw(" HAVE="); pn(have); hw(" PARTIAL="); pn(part); hw(" GAP="); pn(total-have-part); hw(" liar-killed="); pn(liar); hw(" GAME-READINESS="); pn(score); hw("/1000\n" as *u8) 73 74 // T1 grounded 75 var t1: i64 = 0 76 if total >= 8 { t1 = 1 } 77 if t1 == 1 { hw("T1 PASS census grounded (>=8 pipeline layers)\n" as *u8) } else { fails=fails+1; hw("T1 FAIL\n" as *u8) } 78 // T2 CRITIC liar-kill teeth 79 var t2: i64 = 0 80 if liar >= 1 { t2 = 1 } 81 if t2 == 1 { hw("T2 PASS liar-kill BITES: a claimed layer with no organ file -> GAP (cannot fake the stack)\n" as *u8) } else { fails=fails+1; hw("T2 FAIL\n" as *u8) } 82 // T3 ADVERSARY -- the PROXY TRAP keyed off the REAL bar (not an arbitrary threshold): while ACCEPTANCE is still GAP 83 // (no real game frame yet) AND readiness < the graphics-foundation 688, the foundation number OVERSTATES readiness. 84 var t3: i64 = 0 85 if accept_v < 2 { if score < 688 { t3 = 1 } } 86 if t3 == 1 { hw("T3 PASS adversary PROXY-TRAP holds: readiness "); pn(score); hw("/1000 < foundation 688 AND acceptance < HAVE (real D3D11 geometry+shader+textured samples render PIXEL-EXACT vs WARP, but NOT a full game: present-to-window + full method breadth + real-GPU perf remain). Climbing, but the BAR is unmet -- do not mistake the proxy for the target.\n" as *u8) } else { fails=fails+1; hw("T3 FAIL proxy-trap not flagged (acceptance=HAVE, or readiness>=688 -- re-baseline)\n" as *u8) } 87 88 // report + ladder + RACI gap 89 o = ro[0] 90 o = ocat(rep, o, "\nGAME-READINESS " as *u8); let bb: *u8 = sys_mmap(32) as *u8; var bx: i64 = score; var bi: i64 = 31; if bx==0 { bb[bi]=48 as u8; bi=bi-1 } while bx>0 { bb[bi]=(48+bx%10) as u8; bx=bx/10; bi=bi-1 } var bj: i64 = bi+1; while bj<32 { rep[o]=bb[bj]; o=o+1; bj=bj+1 } 91 o = ocat(rep, o, "/1000. THE HONEST REFRAME: the graphics FOUNDATION (688) is the render BACKEND (1 layer here); running a Steam game needs the whole D3D STACK on top -- API surface, shader bytecode, translation, dll shim, presentation, process host -- almost all GAP.\n" as *u8) 92 o = ocat(rep, o, "\nRACI GAP: no crew role OWNS d3d-runtime. GROW THE TEAM -> assign a d3d-runtime owner (Accountable) so the arc drives without Claude hand-authoring every organ = the positive feedback loop.\n" as *u8) 93 o = ocat(rep, o, "\nFOUNDATION-FIRST LADDER to a game frame (correctness before perf; each rung a gate):\n" as *u8) 94 o = ocat(rep, o, " D0 END-TO-END SPINE: a minimal ID3D11Device + IDXGISwapChain that CLEARS a frame via nx_swgpu -> present. Proves API-surface -> backend -> present in one thin slice.\n" as *u8) 95 o = ocat(rep, o, " D1 DXBC decoder (parse a real compiled vertex+pixel shader header + instructions).\n" as *u8) 96 o = ocat(rep, o, " D2 DXBC -> our-ISA/SPIR-V translator; run the shader on nx_swgpu.\n" as *u8) 97 o = ocat(rep, o, " D3 draw-call + pipeline-state + input-assembly translation (a textured triangle from a real D3D call).\n" as *u8) 98 o = ocat(rep, o, " D4 resources: textures/buffers/descriptor heaps + upload/readback.\n" as *u8) 99 o = ocat(rep, o, " D5 ACCEPTANCE: a SIMPLE real D3D sample/game renders a correct frame (software backend = correct-but-slow).\n" as *u8) 100 o = ocat(rep, o, " D6 real-GPU backend (nx_nv/nx_kfd on native-Linux/cloud) = the SUPERIOR-PERF keystone.\n" as *u8) 101 o = ocat(rep, o, " D7 perf tuning to BEAT native D3D on our locked workloads (determinism + no-driver-overhead levers) -> SOTA.\n" as *u8) 102 rep[o] = 0 as u8 103 let fd: i64 = sys_openat_wr("knowledge/d3d_readiness_census.txt\x00" as *u8, 0x1a4) 104 sys_write(fd, rep, o); sys_close(fd) 105 hw("T4 report + ladder + RACI gap -> knowledge/d3d_readiness_census.txt ("); pn(o); hw(" bytes)\n" as *u8) 106 107 if fails == 0 { hw("D3D-READINESS-CENSUS GREEN -- REAL goal measured: game-readiness "); pn(score); hw("/1000; ladder D0-D7 + RACI gap named; proxy-trap + liar-kill bite\n" as *u8); sys_exit(0); return 0 } 108 hw("D3D-READINESS-CENSUS RED fails="); pn(fails); hw("\n" as *u8) 109 sys_exit(1) 110 return 1 111}