code wiki / _hdl_build / nx_d3d_persp_gate.nx
nx_d3d_persp_gate.nx
buildroot/runtime/_hdl_build/nx_d3d_persp_gate.nx
about
nx_d3d_persp_gate.nx -- D3c: PERSPECTIVE-CORRECT attribute interpolation conformance vs WARP. Same screen triangle
as the gradient test, but each vertex has a different clip-space w (1,2,4). WARP interpolates color hyperbolically
(perspective-correct); a naive AFFINE rasterizer gets it visibly WRONG. We do the real per-fragment divide-by-w and
grade pixel-for-pixel vs Microsoft (knowledge/warp_persp.ppm). This is the honest, non-flattering rung -- the one a
real GPU pipeline must pass to run a game. Integer-exact hyperbolic weights; WARP = benchmark oracle. license_tier: ORIGINAL 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
| none |
functions
| 8 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 9 | func 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 } |
| 10 | func 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: main |
| 11 | func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: main |
| 12 | func rnd_div(num: i64, den: i64) -> i64 { return (num + den/2) / den } called by 1: main |
| 14 | func main() -> i64 |