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 |
| 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | width | ||||||||||||||||||
| 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 |
| patch | addr | pred.not | pred | Rd | |||||||||||||||||||||||||||
bits 63:48: 1110 1111 1111 0---
Runs execute_AST with Form() 0.
| Field | Bits | From |
|---|---|---|
| width | 48:47 | execute_AST |
| patch | 31 | execute_AST |
| addr | 29:20 | execute_AST |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Rd | 7:0 | Dst() |
AST: width words (47-48) of d on to the attribute address at 20. A control program stores its invocation's output vertex, and the patch's levels and vectors (bit 31); the vertex stages store their own outputs
let addr = UInt(Field(20, 10));
let width = UInt(Field(47, 2)) + 1;
let patch = Field(31, 1) == 0b1;
if Stage() == ST_TCS | patch then {
let vertex = if patch then 0x00000000 else InvocationIdInput();
foreach (k from 0 to width - 1) {
let location = addr + k * 4;
/* A later evaluation stage makes the control program's layer and viewport outputs inert */
if patch | (location != 100 & location != 104) then {
let component = to_bits(32, MOD(DIV(location, 4), 4));
if not_bool(patch) & location == 108 & HasPointSize(true) then PointSizeStore(Dst() + k, vertex)
else if not_bool(patch) & location >= 704 & location < 736 then {
if HasClip(true) & ClipUsed(DIV(location - 704, 4)) then ClipStore(Dst() + k, vertex, DIV(location - 704, 4))
} else if not_bool(patch) then OutputStore(Dst() + k, location, vertex, component)
else if location >= 32 then PatchStore(Dst() + k, DIV(location - 32, 16), component)
else if location < 24 then TessLevelStore(Dst() + k, if location < 16 then 0 else 1, DIV(MOD(location, 16), 4))
}
}
} else foreach (k from 0 to width - 1) {
let location = addr + k * 4;
if location == 108 then { if HasPointSize(true) then PointSizeOut(Dst() + k) }
else if location == 104 then ViewportOut(Dst() + k)
else if location == 100 then { if HasLayerOutput() then LayerOut(Dst() + k) } /* none: the device can't take this stage's layer */
/* the viewport mask, 0 or viewport 0 alone (the prescan's check): no broadcast, the primitive keeps the
viewport its index selects, as Eden and Ryujinx draw it on hosts without NV_viewport_array2 */
else if location == 928 then ()
else if location >= 704 then { if ClipUsed(DIV(location - 704, 4)) then ClipOut(DIV(location - 704, 4), Dst() + k) }
else VectorOut(location, MOD(DIV(location, 4), 4), Dst() + k)
}
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).