AST

Attributes and varyings

fixed bit field field the encoding fixes should be

AST

6362616059585756555453525150494847464544434241403938373635343332
1110111111110width
313029282726252423222120191817161514131211109876543210
patchaddrpred.notpredRd

bits 63:48: 1110 1111 1111 0---

Runs execute_AST with Form() 0.

Fields

FieldBitsFrom
width48:47execute_AST
patch31execute_AST
addr29:20execute_AST
pred.not19the decoder
pred18:16the decoder
Rd7:0Dst()

Operation Sail

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).