fixed bit field field the encoding fixes should be
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | soft_ftz | ||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| lane | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0101 0000 1111 1---
Runs execute_FSWZADD with Form() 0.
| Field | Bits | From |
|---|---|---|
| soft_ftz | 44 | execute_FSWZADD |
| lane | 29:28 | execute_FSWZADD |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
FSWZADD: Each lane of a quad (0 the upper left, 1 the upper right, 2 the lower left, 3 the lower right) does the mode in its bits of the swizzle (shader_fswzadd_lanes): a + b (0), b - a (1), a - b (2) or b (3). Nothing crosses lanes: compilers read the neighbour with SHFL.BFLY first, and dFdx is FSWZADD of it and x with 0x99 (nouveau's handleDFDX, NAK's ddx). Nouveau's manual TXD fixes the order of the lanes and the modes: 0xcc adds the gradient in a to b on the right lanes and keeps b on the left ones. Eden and Ryujinx count the lanes from the low bits, and Eden negates every mode. The rounding mode (39-40) is round to nearest, as FADD's is, and NDV (38) changes nothing computed
let left0 = RegF(RegA());
let right0 = RegF(RegB());
let soft_ftz = Field(44, 1) == 0b1 & SoftFtz();
let left = if soft_ftz then FloatFtz(left0) else left0;
let right = if soft_ftz then FloatFtz(right0) else right0;
/* without subgroups, the place FragCoord gives */
let lane = if FswzMask(UInt(Field(28, 2))) != 15 then QuadLane() else 0x00000000;
/* pick k: whether this lane's mode is k + 1, where some lanes' are and others' aren't */
let m1 = FswzMask(1);
let m2 = FswzMask(2);
let m3 = FswzMask(3);
let some1 = m1 != 0 & m1 != 15;
let some2 = m2 != 0 & m2 != 15;
let some3 = m3 != 0 & m3 != 15;
let pick1 = if some1 then ((to_bits(32, m1) >> lane) & 0x00000001) != 0x00000000 else false;
let pick2 = if some2 then ((to_bits(32, m2) >> lane) & 0x00000001) != 0x00000000 else false;
let pick3 = if some3 then ((to_bits(32, m3) >> lane) & 0x00000001) != 0x00000000 else false;
if m3 == 15 then R_writeF(Dst(), right) else {
let lhs0 = if m1 == 15 then FNeg(left) else left;
let lhs = if some1 then (if pick1 then FNeg(left) else left) else lhs0;
let rhs0 = if m2 == 15 then FNeg(right) else right;
let rhs = if some2 then (if pick2 then FNeg(right) else right) else rhs0;
let sum = FAddNC(lhs, rhs);
let flushed = if soft_ftz then FloatFtz(sum) else sum;
R_writeF(Dst(), if some3 then (if pick3 then right else flushed) else flushed)
}
Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Eden's maxwell.inc (GPL-2.0-or-later).