Constant buffer, local, shared and global memory instructions
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 | 0 | 0 | 1 | 0 | size | dynamic_bank | bank | off | |||||||||||||||
| 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 |
| off | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 1110 1111 1001 0---
Runs execute_LDC with Form() 0.
| Field | Bits | From |
|---|---|---|
| size | 50:48 | execute_LDC |
| dynamic_bank | 44 | execute_LDC |
| bank | 40:36 | execute_LDC |
| off | 35:20 | execute_LDC |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
LDC: the constant buffer word at the register at 8 plus the signed offset at 20, of bank 36 (bit 44: the register's high half added to the bank, its low half the address), a byte or halfword of it (48-50) or a pair. It loads the handle of a texture that is indexed: the element it picks, the address register over the stride, stored
let off = Bits32(SignExtend(Field(20, 16), 32)); /* made before the register's read, as the translator made it */
let a = R_read(RegA());
let bank = UInt(Field(36, 5));
let dynamic_bank = Field(44, 1) == 0b1;
let picked = if dynamic_bank then to_bits(32, bank) + (a >> 16) else 0x00000000;
let source = if dynamic_bank then a & 0x0000ffff else a;
let address = source + off;
let word = if dynamic_bank then CbufReadBank(bank, picked, address) else CbufReadDynamic(bank, address);
let size = UInt(Field(48, 3));
foreach (k from 0 to TextureCount() - 1) {
if TexIndexedBy(k) then TexIndexStore(k, R_read(RegA()) >> TexIndexShift(k))
};
if size < 4 then {
let byte_offset = address & (if size < 2 then 0x00000003 else 0x00000002);
let bit_offset = byte_offset << 3;
R_write(Dst(), SubwordExtract(word, bit_offset, SubwordWidth(size), size))
} else R_write(Dst(), word);
if size == 5 then {
let next = address + 0x00000004;
R_write(Dst() + 1, if dynamic_bank then CbufReadBank(bank, picked, next) else CbufReadDynamic(bank, next))
}
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).