code wiki / (root) / nx_world_depth_gate_t195.nx

nx_world_depth_gate_t195.nx source

↩ module page · 31 lines · 1374 B

1import "nx_wgsl_world_depth_t195.nx" 2import "nx_gate_verdict.nx" 3func wd_capture(dialect:i64,path:*u8)->i64{ 4 let m:*i64=sir_new() 5 // Match the currently inspected cast camera for this integration fixture. 6 shsrc_world_depth(m,ws_f(m,"0.08" as *u8),ws_f(m,"300.0" as *u8)) 7 let b:*u8=sys_mmap(WG_EMIT_CAP) 8 let trace:*i64=sys_mmap(WG_TRACE_CAP*8) as *i64 9 var tn:i64=0 10 var n:i64=0 11 if dialect==1{n=wgsl_emit_module(m,STAGE_FRAGMENT,b,WG_EMIT_CAP,trace,WG_TRACE_CAP,&tn)}else{n=glsl_emit_module(m,STAGE_FRAGMENT,b,WG_EMIT_CAP,trace,WG_TRACE_CAP,&tn)} 12 if n<=0{return 0} 13 let fd:i64=sys_openat_wr(path,384) 14 if fd<0{return 0} 15 var done:i64=0 16 while done<n{let wrote:i64=sys_write(fd,(b as i64+done) as *u8,n-done);if wrote<=0{sys_close(fd);return 0};done=done+wrote} 17 if sys_close(fd)!=0{return 0} 18 var size:i64=0 19 let check:*u8=sys_read_file(path,&size) 20 if (check as i64)==0{return 0} 21 if size!=n{return 0} 22 var i:i64=0 23 while i<n{if check[i]!=b[i]{return 0};i=i+1} 24 return 1 25} 26func main()->i64{ 27 let c:*i64=gv_ctr() 28 gv_check("full world WGSL retained",wd_capture(1,"knowledge/gates/world-depth-t195.wgsl" as *u8)==1,c) 29 gv_check("full world GLSL retained",wd_capture(0,"knowledge/gates/world-depth-t195.glsl" as *u8)==1,c) 30 return gv_verdict("world-depth-emission" as *u8,c,"full source emitted and retained; browser compilation and scene integration pending" as *u8) 31}