Files
craft-libs/crates/material-graph/tests/rules/bilinear_read.tsv
T
Valentin Klein c3155aad96 Share the material graph runtime and WGSL pixel compiler (#3109)
* Extract the material graph runtime from TextureCraft

Preserve its evaluator, compiler, existing verification, and format reference from TextureCraft #777 at 22a37c29.

Original TextureCraft importer author: xilefenko (TextureCraft #521).

* Adapt graph helpers to the shared workspace lints

Preserve node evaluation and version tracking while splitting long dispatch branches. Update the EXR doctest and rule table references for the shared crate.

* Read the format reference with LF endings in its test

* Test that the format reference example reads the same with CRLF line endings

* Make the kind versions follow module attributes, arm order, raw strings, includes and the epoch

* Fix graph cache keys, publish, import and subgraph extraction; harden the graph tests

* Keep the cubic sampler from panicking on NaN texels; say what RGBE drops; check NaN halves by their bits

* Lower vector inputs of f_to_bool and f_vec to valid WGSL; tighten the FX-map error and pattern coverage tests; document clamping and the splatter data cutoff

* Say which composite glyph placements the font reader lacks; fail the y-up text test on a blank render

* Leave publish as it was; unit-test the WGSL vector lowering; document EPOCH and keep_outputs results

* Satisfy clippy in the version scanner and the WGSL lowering; compare cache hits by relation
2026-11-23 08:55:49 -05:00

3.1 KiB

1# Rule: a bilinear read between two texels a and b (16-bit levels) at a fraction f of the way from a's centre to b's:
2# the weight is w = round(f 256) (steps of 1/256), the read rounds half up to a 16-bit step:
3# (a (256 - w) + b w + 128) >> 8. It holds on 8-bit images too (their texels as 16-bit levels, k 257).
4# Tolerance: exact. Ours computes the read in single precision and rounds an exact tie ((a (256 - w) + b w) mod 256 = 128)
5# down, where the rule rounds it up: rows 1000/1001, 0/1 and 0/255 at w = 128 show it (ours one level below). Left as it is
6# (this table is part of a pure refactor); an implementation should follow rule_16.
7# Columns: a_16, b_16 = the two texels; fraction = f; weight_256 = w; ours_16 = our read; rule_16 = the integer form above.
8a_16b_16fractionweight_256ours_16rule_16
90655350.51283276832768
100655350.25641638416384
110655350.0019531251256256
120655350.0058593752512512
130655350.9982556527965279
146553500.3774582345823
15100010010.512810001001
16010.512801
1702550.5128127128
181003000.49804688128200200
192320593790.19140625492055920559
204418419280.57519531471992019920
2120253282010.663085941702553125531
2219217158640.49218751261756717567
2325760599250.69335941784951549515
2444393180660.90332032312063720637
2533737641480.686523441765464554645
2631806120440.28222656722624826248
2722230466730.60156251543693436934
284300134600.870117222385578557
295114534200.31933594822058720587
302137595640.25683594661694216942
314599686020.095703125254234442344
325351812620.70507811811657116571
3337673624770.98925782536218662186
3437652603500.02441406363818438184
3557181406400.41113281055039750397
3617920370690.733398441883198331983
372458010320.26367188681832518325
381994121270.4804687512368636863
3921176211130.89843752302111921119
406023530150.18066406461446714467
4130204328690.01855468853025630256
424030786590.3466797892930429304
431130060180.376953139792999299
4426972327080.008789062522701727017
451076282530.19921875511026210262
466189418200.94042972413973239732
4744567108730.56251442561425614
482290687180.483398441241603416034
491837508000.0527343751445154515
5046301433660.68164061754429544295
5120397517360.23632813612786427864
526664490610.0068359375269956995
535506356050.34375881585315853
5483951630.310546888021902190
555384136550.118164063063536353
5613595133110.928710942381333113331
5738314411250.91601562354089440894
5834905510170.42675781094176541765
5948618391370.16796875434702547025
605693175950.9697265624891379137
614962182220.31347656803668436684
627799238860.686523441761885918859
6344152535240.01855468854433544335
6435010543260.743164061904934649346
6564408275660.78906252023533735337
6650880350610.53417971374241442414
6752598464630.522460941344938749387
6863325225560.16992188445631856318