nx_gpu_graphics_gate.nx
buildroot/runtime/nx_gpu_graphics_gate.nx
about
nx_gpu_graphics_gate.nx -- GOAL-GPU-NATIVE rung-2: a GRAPHICS engine on the sovereign GPFIFO pipeline.
Synthesis the operator asked for -- hardware rung up + game ecosystem + consume/produce, all sovereign.
Builds on the RESEARCHED NVIDIA command model embodied in the BM-GPU organs (GF100 method-header decode +
NVC56F class-binding via SET_OBJECT@0x0, spec-faithful). Adds a GRAPHICS class: a game/driver PRODUCES a
draw-command pushbuffer (SET_OBJECT graphics, SET_FB/W/H, CLEAR, per-triangle state, DRAW), the modeled
GPU host/FIFO CONSUMES the ring, and the GRAPHICS engine (our rung-1 rasterizer) PRODUCES pixels into GPU
VRAM with a Z-buffer. This is the same submit->execute loop as compute, now driving the screen.
produce (draw cmds) -> GPFIFO ring -> consume (FIFO decode) -> graphics engine -> produce (pixels in VRAM)
KAT: the scene renders THROUGH the command stream; the Z-buffer is correct through the pipeline (a far
triangle submitted LAST does not overwrite the near one); a TAMPER pushbuffer with NO SET_OBJECT renders
NOTHING (dispatch gated on class-bind, faithful to the FIFO spec); the produced frame exports to BMP.
HONEST SCOPE: spec-faithful FIFO decode + class-bind LOGIC; method offsets for the graphics class are
representative; real silicon exec = the bare-metal PCIe/doorbell last mile (BM-GPU-6/7). No hw writes (Rule 26).
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_fb.nxnx_gate_verdict.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
| 18 | const GRAPHICS_CLASS: i64 = 0xC397 // representative Ampere 3D class id |
functions
| 20 | func gg_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 21 | func gg_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } called by 1: main |
| 22 | func gg_rd32(b: *u8, o: i64) -> i64 { return (b[o] as i64)|((b[o+1] as i64)<<8)|((b[o+2] as i64)<<16)|((b[o+3] as i64)<<24) } called by 1: gpfifo_run_graphics |
| 23 | func gg_wr32(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v&0xff) as u8; b[o+1]=((v>>8)&0xff) as u8; b[o+2]=((v>>16)&0xff) as u8; b[o+3]=((v>>24)&0xff) as u8; return 0 } called by 1: gg_emit1 |
| 24 | func gg_edge(ax: i64, ay: i64, bx: i64, by: i64, px: i64, py: i64) -> i64 { return (bx-ax)*(py-ay) - (by-ay)*(px-ax) } called by 1: gg_rast |
| 25 | func gg_min3(a: i64, b: i64, c: i64) -> i64 { var m: i64=a; if b<m {m=b} if c<m {m=c} return m } called by 1: gg_rast |
| 26 | func gg_max3(a: i64, b: i64, c: i64) -> i64 { var m: i64=a; if b>m {m=b} if c>m {m=c} return m } called by 1: gg_rast |
| 27 | func gg_clamp(v: i64, lo: i64, hi: i64) -> i64 { if v<lo {return lo} if v>hi {return hi} return v } called by 1: gg_rast |
| 30 | func gg_rast(gmem: *u8, zbuf: *i64, gs: *i64) -> i64 |
| 53 | func gg_clear(gmem: *u8, zbuf: *i64, gs: *i64, color: i64) -> i64 called by 1: gpfifo_run_graphics |
| 61 | func gpfifo_run_graphics(gmem: *u8, pb_off: i64, pb_dwords: i64, gs: *i64, zbuf: *i64) -> i64 |
| 84 | func gg_emit1(gmem: *u8, off: i64, method: i64, data: i64) -> i64 { gg_wr32(gmem, off, (1<<29)|(1<<16)|((method>>2)&0xfff)); gg_wr32(gmem, off+4, data); return off+8 } |
| 85 | func gg_emit_tri(gmem: *u8, off: i64, x0: i64, y0: i64, x1: i64, y1: i64, x2: i64, y2: i64, z: i64, c: *i64) -> i64 |
| 94 | func build_scene(gmem: *u8, pb_off: i64, fb_va: i64, W: i64, H: i64, with_obj: i64) -> i64 |
| 108 | func count_scene(gmem: *u8, fb_va: i64, W: i64, H: i64, zbuf: *i64) -> i64 called by 1: main |
| 112 | func main() -> i64 |