code wiki / (root) / nx_textured_tri_fast.nx

nx_textured_tri_fast.nx

buildroot/runtime/nx_textured_tri_fast.nx

8644 B195 linesdepth 7pulls 10 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_textured_tri_fast.nx -- E1-R1 of the raster perf ladder (board S18): the SAME textured-triangle semantics as nx_textured_tri.txtri_render, made incremental. BIT-EXACT by construction: (a) edge functions are affine -> per-pixel re-evaluation (6 muls) becomes +=dE/dx steps (exact ints); (b) UV numerators Nu=w0*u0+w1*u1+w2*u2 are affine too -> row-DDA increments (exact ints), the /area truncating division stays per-fragment so u,v match the reference EXACTLY; (c) bilinear sampling inlines nx_txs_sample_bilinear's CLAMP arithmetic verbatim, with direct row-pointer loads (the wrap-clamp already guarantees in-bounds -- nx_image_get's checks never fire on this path) and >>10 replacing /1024 ONLY where operands are provably non-negative. The equivalence gate lives in nx_raster_bench (fast frame must checksum IDENTICAL to the reference; neg-control: a perturbed scene must NOT match). license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_textured_tri.nx nx_textured_tri_fast.nx nishi_game.nx nx_raster_bench.nx

imports: nx_syscalls.nxnx_textured_tri.nx

imported by: nishi_game.nxnx_raster_bench.nx

structs

none

consts

none

functions

15func txsf_bilinear(tp: *u8, w: i64, h: i64, stride: i64, tch: i64, u_q10: i64, v_q10: i64) -> i64
51func txtri_render_fast_clip(fb: *Image, tex: *Image, x0: i64, y0: i64, u0: i64, v0: i64, x1: i64, y1: i64, u1: i64, v1: i64, x2: i64, y2: i64, u2: i64, v2: i64, y0clip: i64, y1clip: i64) -> i64
193func txtri_render_fast(fb: *Image, tex: *Image, x0: i64, y0: i64, u0: i64, v0: i64, x1: i64, y1: i64, u1: i64, v1: i64, x2: i64, y2: i64, u2: i64, v2: i64) -> i64