Source

pica.sail

source register reg (0x00-0x0f inputs, 0x10-0x1f temporaries, 0x20-0x7f float uniforms, which address register addr offsets: 0 none, 1 a0.x, 2 a0.y, 3 aL) as source n of pattern p: swizzled, then negated

function Source(reg : int, addr : int, p : bits(32), n : int) -> vec4 = {
    let v = if reg < 16 then InputReg(reg) else if reg < 32 then TempReg(reg - 16)
            else if addr != 0 then UniformOffset(reg - 32, AddrRead(addr - 1)) else UniformF(reg - 32);
    let at = if n == 1 then 5 else if n == 2 then 14 else 23;
    let x = UInt(p[at + 7 .. at + 6]);
    let y = UInt(p[at + 5 .. at + 4]);
    let z = UInt(p[at + 3 .. at + 2]);
    let w = UInt(p[at + 1 .. at]);
    let s = if x != 0 | y != 1 | z != 2 | w != 3 then V4Shuffle(v, v, x, y, z, w) else v;
    if p[at - 1 .. at - 1] == 0b1 then V4FNeg(s) else s
}

Used by


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 nihstro's shader_bytecode.h (BSD-3-Clause), as Azahar reads them.