nx_shader_producer_compare_t56.nx source
↩ module page · 30 lines · 2096 B
1// Private audit: observed output equality does not establish source closure.
2import "nx_game_page_workspace_t48.nx"
3func sa_identity(path:*u8)->i64{
4 let size:*i64=sys_mmap(8) as *i64;let bytes:*u8=sys_read_file(path,size)
5 if (bytes as i64)<=0{return 3}
6 let digest:*u8=sys_mmap(GPA_SHA_HEX+1);gpa_sha(bytes,size[0],digest)
7 gpe_puts("producer path=");gpe_puts(path);gpe_puts(" bytes=");gpe_pn(size[0]);gpe_puts(" sha256=");gpe_puts(digest);gpe_puts("\n")
8 sys_free_file(bytes,size[0]);return 0
9}
10func sa_command(reference:*u8,candidate:*u8,command:*u8)->i64{
11 let a:*u8=sys_mmap(RK_WGSL_CAP);let b:*u8=sys_mmap(RK_WGSL_CAP);let an:*i64=sys_mmap(8) as *i64;let bn:*i64=sys_mmap(8) as *i64
12 let ar:i64=gsb_once(reference,command,a,RK_WGSL_CAP,an,RK_WGSL_TMO_MS)
13 let br:i64=gsb_once(candidate,command,b,RK_WGSL_CAP,bn,RK_WGSL_TMO_MS)
14 gpe_puts("command=");gpe_puts(command);gpe_puts(" reference_rc=");gpe_pn(ar);gpe_puts(" candidate_rc=");gpe_pn(br)
15 gpe_puts(" reference_bytes=");gpe_pn(an[0]);gpe_puts(" candidate_bytes=");gpe_pn(bn[0])
16 if ar!=0||br!=0||an[0]<=0||bn[0]<=0{gpe_puts(" state=capture-refused\n");return 3}
17 let ah:*u8=sys_mmap(GPA_SHA_HEX+1);let bh:*u8=sys_mmap(GPA_SHA_HEX+1);gpa_sha(a,an[0],ah);gpa_sha(b,bn[0],bh)
18 var equal:i64=1;if an[0]!=bn[0]{equal=0}else{var i:i64=0;while i<an[0]{if a[i]!=b[i]{equal=0};i=i+1}}
19 gpe_puts(" reference_sha256=");gpe_puts(ah);gpe_puts(" candidate_sha256=");gpe_puts(bh);gpe_puts(" equal=");gpe_pn(equal);gpe_puts("\n")
20 sys_munmap(a,RK_WGSL_CAP);sys_munmap(b,RK_WGSL_CAP);return 0
21}
22func main()->i64{
23 let reference:*u8="/volume1/homes/elderwesto/nishihost/nx_wgsl.sov.elf.new"
24 let candidate:*u8="/volume1/homes/elderwesto/nishihost/buildroot/_build/nx_wgsl_authored_t55.sov.elf"
25 if sa_identity(reference)!=0||sa_identity(candidate)!=0{return 3}
26 if sa_command(reference,candidate,"world")!=0{return 4}
27 if sa_command(reference,candidate,"compute")!=0{return 5}
28 if sa_command(reference,candidate,"layout")!=0{return 6}
29 gpe_puts("AUDIT COMPLETE observed output comparison only; source and runtime closure remain separate\n");return 0
30}