diff --git a/crates/victory-formats/src/texture.rs b/crates/victory-formats/src/texture.rs index 61aca7547..b8ae23105 100644 --- a/crates/victory-formats/src/texture.rs +++ b/crates/victory-formats/src/texture.rs @@ -179,6 +179,265 @@ pub struct Layout { /// Byte offsets inside a block for each coordinate, per axis. /// Empty for linear and unsupported modes. pattern: &'static SwizzlePattern, + /// The XOR mode's address bits, set by [`Layout::configure_xor`]. + xor: Option<&'static XorPattern>, +} + +/// GFX10.3 pipe and packer configurations of the two Series consoles: +/// Series S has 8 pipes and 4 packers, Series X 32 and 8. The XOR modes +/// (`_X`, `_T`) spread a texture over the pipes, so their addresses differ +/// between the two. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PipeConfig { + Pipes8Packers4, + Pipes32Packers8, +} + +/// One address bit of an XOR mode: the x, y and z (array slice, or depth +/// for 3D) element coordinate bits whose XOR gives it. +type XorBit = [u16; 3]; +/// The low 16 address bits of a block (4 KiB modes use 12). +type XorPattern = [XorBit; 16]; + +/// The XOR mode patterns, by console, mode ([`xor_family`]) and log2 of the +/// element size: addrlib's RB+ single-sample `ADDR_SW_PATINFO` rows for +/// the console's pipes and packers, expanded from `GFX10_SW_PATTERN_NIBBLE01` +/// to `NIBBLE3` (`GetSwizzlePatternFromPatternInfo`; `NIBBLE4` holds bits +/// above 64 KiB, empty for these modes), all from `gfx10SwizzlePattern.h`. Each mode's table is named in its comment. +#[rustfmt::skip] +static XOR_PATTERNS: [[[XorPattern; 5]; 12]; 2] = [ + // Series S: addrlib's "8 pipes (4 PKRs)" rows. + [ + // 4KB_S_X (GFX10_SW_4K_S_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0002], [0x0010, 0x0008, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0002], [0x0008, 0x0008, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 4KB_D_X (GFX10_SW_4K_D_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0002], [0x0010, 0x0008, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0002], [0x0008, 0x0008, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 64KB_S_T (GFX10_SW_64K_S_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0000], [0x0020, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0000], [0x0020, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0000], [0x0010, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0000], [0x0010, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0000], [0x0008, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_D_T (GFX10_SW_64K_D_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0000], [0x0020, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0000], [0x0020, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0000], [0x0010, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0000], [0x0010, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0000], [0x0008, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_Z_X (GFX10_SW_64K_Z_X_1xaa_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0040, 0x0000, 0x0000], [0x0200, 0x0040, 0x0000], [0x0080, 0x0100, 0x0000], [0x0100, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0000, 0x0008, 0x0000], [0x0020, 0x0000, 0x0000], [0x0040, 0x0100, 0x0000], [0x0100, 0x0040, 0x0000], [0x0080, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0020, 0x0100, 0x0000], [0x0040, 0x0080, 0x0000], [0x0080, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000], [0x0020, 0x0080, 0x0000], [0x0040, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0080, 0x0000], [0x0040, 0x0008, 0x0000], [0x0020, 0x0040, 0x0000]], + ], + // 64KB_S_X (GFX10_SW_64K_S_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0002], [0x0010, 0x0008, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0002], [0x0008, 0x0008, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_D_X (GFX10_SW_64K_D_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0002], [0x0010, 0x0008, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0002], [0x0008, 0x0008, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_R_X (GFX10_SW_64K_R_X_1xaa_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0040, 0x0000, 0x0000], [0x0200, 0x0040, 0x0000], [0x0080, 0x0100, 0x0000], [0x0100, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0000, 0x0008, 0x0000], [0x0020, 0x0000, 0x0000], [0x0040, 0x0100, 0x0000], [0x0100, 0x0040, 0x0000], [0x0080, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0020, 0x0100, 0x0000], [0x0040, 0x0080, 0x0000], [0x0080, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000], [0x0020, 0x0080, 0x0000], [0x0040, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0002], [0x0020, 0x0020, 0x0001], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0080, 0x0000], [0x0040, 0x0008, 0x0000], [0x0020, 0x0040, 0x0000]], + ], + // 4KB_S3_X (GFX10_SW_4K_S3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0020, 0x0004, 0x0020], [0x0008, 0x0010, 0x0010], [0x0010, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0010, 0x0004, 0x0020], [0x0004, 0x0010, 0x0010], [0x0008, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0004, 0x0010], [0x0004, 0x0010, 0x0008], [0x0008, 0x0008, 0x0004], [0x0000, 0x0008, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0002, 0x0010], [0x0004, 0x0008, 0x0008], [0x0008, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0008, 0x0002, 0x0010], [0x0002, 0x0008, 0x0008], [0x0004, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 64KB_S3_T (GFX10_SW_64K_S3_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0020, 0x0004, 0x0000], [0x0008, 0x0010, 0x0010], [0x0010, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0010], [0x0008, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0004, 0x0000], [0x0004, 0x0010, 0x0008], [0x0008, 0x0008, 0x0004], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0002, 0x0000], [0x0004, 0x0008, 0x0008], [0x0008, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0008, 0x0002, 0x0000], [0x0002, 0x0008, 0x0008], [0x0004, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + // 64KB_S3_X (GFX10_SW_64K_S3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0020, 0x0004, 0x0020], [0x0008, 0x0010, 0x0010], [0x0010, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0010, 0x0004, 0x0020], [0x0004, 0x0010, 0x0010], [0x0008, 0x0008, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0004, 0x0010], [0x0004, 0x0010, 0x0008], [0x0008, 0x0008, 0x0004], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0002, 0x0010], [0x0004, 0x0008, 0x0008], [0x0008, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0008, 0x0002, 0x0010], [0x0002, 0x0008, 0x0008], [0x0004, 0x0004, 0x0004], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + // 64KB_D3_X (GFX10_SW_64K_D3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0002], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0000], [0x0020, 0x0020, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0000, 0x0000, 0x0008], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0004], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0000], [0x0020, 0x0024, 0x0000], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0002], [0x0040, 0x0050, 0x0000], [0x0010, 0x0010, 0x0000], [0x0020, 0x0024, 0x0000], [0x0000, 0x0000, 0x0004], [0x0000, 0x0008, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0040, 0x0050, 0x0008], [0x0010, 0x0010, 0x0000], [0x0020, 0x0022, 0x0000], [0x0000, 0x0000, 0x0004], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0040, 0x0050, 0x0008], [0x0010, 0x0012, 0x0000], [0x0022, 0x0020, 0x0000], [0x0000, 0x0000, 0x0004], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + ], + // Series X: addrlib's "32 pipes (8 PKRs)" rows. + [ + // 4KB_S_X (GFX10_SW_4K_S_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0010, 0x0000], [0x0010, 0x0080, 0x0000], [0x0040, 0x0020, 0x0004], [0x0020, 0x0040, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000], [0x0010, 0x0040, 0x0000], [0x0040, 0x0010, 0x0004], [0x0020, 0x0020, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0008, 0x0040, 0x0000], [0x0020, 0x0010, 0x0004], [0x0010, 0x0020, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0040, 0x0004, 0x0000], [0x0008, 0x0020, 0x0000], [0x0020, 0x0008, 0x0004], [0x0010, 0x0010, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0020, 0x0004, 0x0000], [0x0004, 0x0020, 0x0000], [0x0010, 0x0008, 0x0004], [0x0008, 0x0010, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 4KB_D_X (GFX10_SW_4K_D_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0010, 0x0000], [0x0010, 0x0080, 0x0000], [0x0040, 0x0020, 0x0004], [0x0020, 0x0040, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000], [0x0010, 0x0040, 0x0000], [0x0040, 0x0010, 0x0004], [0x0020, 0x0020, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0040, 0x0008, 0x0000], [0x0008, 0x0040, 0x0000], [0x0020, 0x0010, 0x0004], [0x0010, 0x0020, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0040, 0x0004, 0x0000], [0x0008, 0x0020, 0x0000], [0x0020, 0x0008, 0x0004], [0x0010, 0x0010, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0020, 0x0004, 0x0000], [0x0004, 0x0020, 0x0000], [0x0010, 0x0008, 0x0004], [0x0008, 0x0010, 0x0002], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 64KB_S_T (GFX10_SW_64K_S_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0080, 0x0020, 0x0000], [0x0020, 0x0080, 0x0000], [0x0040, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0080, 0x0010, 0x0000], [0x0020, 0x0040, 0x0000], [0x0040, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0000], [0x0020, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0000], [0x0020, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0000], [0x0010, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_D_T (GFX10_SW_64K_D_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0080, 0x0020, 0x0000], [0x0020, 0x0080, 0x0000], [0x0040, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000], [0x0080, 0x0010, 0x0000], [0x0020, 0x0040, 0x0000], [0x0040, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0010, 0x0000], [0x0010, 0x0040, 0x0000], [0x0020, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0040, 0x0008, 0x0000], [0x0010, 0x0020, 0x0000], [0x0020, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0020, 0x0008, 0x0000], [0x0008, 0x0020, 0x0000], [0x0010, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_Z_X (GFX10_SW_64K_Z_X_1xaa_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0002], [0x0040, 0x0020, 0x0001], [0x0020, 0x0040, 0x0000], [0x0040, 0x0040, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000], [0x0100, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0002], [0x0040, 0x0020, 0x0001], [0x0020, 0x0040, 0x0000], [0x0040, 0x0040, 0x0000], [0x0000, 0x0008, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0002], [0x0040, 0x0020, 0x0001], [0x0020, 0x0040, 0x0000], [0x0040, 0x0040, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0040, 0x0040, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0008, 0x0040, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0040, 0x0008, 0x0000]], + ], + // 64KB_S_X (GFX10_SW_64K_S_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0100, 0x0010, 0x0000], [0x0010, 0x0100, 0x0000], [0x0080, 0x0020, 0x0004], [0x0020, 0x0080, 0x0002], [0x0040, 0x0040, 0x0001], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0100, 0x0008, 0x0000], [0x0010, 0x0080, 0x0000], [0x0080, 0x0010, 0x0004], [0x0020, 0x0040, 0x0002], [0x0040, 0x0020, 0x0001], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000], [0x0008, 0x0080, 0x0000], [0x0040, 0x0010, 0x0004], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0080, 0x0004, 0x0000], [0x0008, 0x0040, 0x0000], [0x0040, 0x0008, 0x0004], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0040, 0x0004, 0x0000], [0x0004, 0x0040, 0x0000], [0x0020, 0x0008, 0x0004], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_D_X (GFX10_SW_64K_D_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0100, 0x0010, 0x0000], [0x0010, 0x0100, 0x0000], [0x0080, 0x0020, 0x0004], [0x0020, 0x0080, 0x0002], [0x0040, 0x0040, 0x0001], [0x0040, 0x0000, 0x0000], [0x0000, 0x0080, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0100, 0x0008, 0x0000], [0x0010, 0x0080, 0x0000], [0x0080, 0x0010, 0x0004], [0x0020, 0x0040, 0x0002], [0x0040, 0x0020, 0x0001], [0x0040, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0080, 0x0008, 0x0000], [0x0008, 0x0080, 0x0000], [0x0040, 0x0010, 0x0004], [0x0010, 0x0040, 0x0002], [0x0020, 0x0020, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0040, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0080, 0x0004, 0x0000], [0x0008, 0x0040, 0x0000], [0x0040, 0x0008, 0x0004], [0x0010, 0x0020, 0x0002], [0x0020, 0x0010, 0x0001], [0x0020, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0040, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0040, 0x0004, 0x0000], [0x0004, 0x0040, 0x0000], [0x0020, 0x0008, 0x0004], [0x0008, 0x0020, 0x0002], [0x0010, 0x0010, 0x0001], [0x0010, 0x0000, 0x0000], [0x0000, 0x0020, 0x0000], [0x0020, 0x0000, 0x0000]], + ], + // 64KB_R_X (GFX10_SW_64K_R_X_1xaa_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0140, 0x0100, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0000, 0x0000], [0x0100, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0140, 0x0100, 0x0000], [0x0000, 0x0008, 0x0000], [0x0000, 0x0040, 0x0000], [0x0080, 0x0080, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0140, 0x0100, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0080, 0x0040, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0140, 0x0100, 0x0000], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0080, 0x0008, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0002, 0x0000], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0004], [0x0040, 0x0020, 0x0002], [0x0020, 0x0040, 0x0001], [0x0108, 0x0100, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0004, 0x0000], [0x0040, 0x0008, 0x0000]], + ], + // 4KB_S3_X (GFX10_SW_4K_S3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0040, 0x0004, 0x0040], [0x0008, 0x0020, 0x0020], [0x0020, 0x0010, 0x0008], [0x0010, 0x0008, 0x0010], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0020, 0x0004, 0x0040], [0x0004, 0x0020, 0x0020], [0x0010, 0x0010, 0x0008], [0x0008, 0x0008, 0x0010], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0020, 0x0004, 0x0020], [0x0004, 0x0020, 0x0010], [0x0010, 0x0010, 0x0004], [0x0008, 0x0008, 0x0008], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0020, 0x0002, 0x0020], [0x0004, 0x0010, 0x0010], [0x0010, 0x0008, 0x0004], [0x0008, 0x0004, 0x0008], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0010, 0x0002, 0x0020], [0x0002, 0x0010, 0x0010], [0x0008, 0x0008, 0x0004], [0x0004, 0x0004, 0x0008], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000]], + ], + // 64KB_S3_T (GFX10_SW_64K_S3_T_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0000, 0x0004, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0020, 0x0008, 0x0000], [0x0010, 0x0010, 0x0010], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0010, 0x0008, 0x0000], [0x0008, 0x0010, 0x0010], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0004, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0010, 0x0008, 0x0000], [0x0008, 0x0010, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0010, 0x0004, 0x0000], [0x0008, 0x0008, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0008, 0x0004, 0x0000], [0x0004, 0x0008, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + // 64KB_S3_X (GFX10_SW_64K_S3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0080, 0x0004, 0x0080], [0x0008, 0x0040, 0x0040], [0x0040, 0x0020, 0x0008], [0x0020, 0x0008, 0x0020], [0x0010, 0x0010, 0x0010], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0020, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0040, 0x0004, 0x0080], [0x0004, 0x0040, 0x0040], [0x0020, 0x0020, 0x0008], [0x0010, 0x0008, 0x0020], [0x0008, 0x0010, 0x0010], [0x0000, 0x0000, 0x0010], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0040, 0x0004, 0x0040], [0x0004, 0x0040, 0x0020], [0x0020, 0x0020, 0x0004], [0x0010, 0x0008, 0x0010], [0x0008, 0x0010, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0010, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0040, 0x0002, 0x0040], [0x0004, 0x0020, 0x0020], [0x0020, 0x0010, 0x0004], [0x0010, 0x0004, 0x0010], [0x0008, 0x0008, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0010, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0020, 0x0002, 0x0040], [0x0002, 0x0020, 0x0020], [0x0010, 0x0010, 0x0004], [0x0008, 0x0004, 0x0010], [0x0004, 0x0008, 0x0008], [0x0000, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + // 64KB_D3_X (GFX10_SW_64K_D3_X_RBPLUS_PATINFO) + [ + [[0x0001, 0x0000, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0002], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0004], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0000], [0x0040, 0x0024, 0x0000], [0x0020, 0x0040, 0x0000], [0x0080, 0x0000, 0x0008], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010]], + [[0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0004], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0000], [0x0040, 0x0024, 0x0000], [0x0020, 0x0048, 0x0000], [0x0080, 0x0000, 0x0008], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0010], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0002, 0x0000], [0x0000, 0x0000, 0x0002], [0x0080, 0x0090, 0x0000], [0x0010, 0x0010, 0x0000], [0x0040, 0x0024, 0x0000], [0x0020, 0x0048, 0x0000], [0x0080, 0x0000, 0x0004], [0x0004, 0x0000, 0x0000], [0x0000, 0x0000, 0x0008], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0001], [0x0002, 0x0000, 0x0000], [0x0000, 0x0000, 0x0002], [0x0080, 0x0090, 0x0008], [0x0010, 0x0010, 0x0000], [0x0040, 0x0022, 0x0000], [0x0020, 0x0044, 0x0000], [0x0080, 0x0000, 0x0004], [0x0004, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + [[0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0000, 0x0000, 0x0000], [0x0001, 0x0000, 0x0000], [0x0000, 0x0000, 0x0001], [0x0000, 0x0001, 0x0000], [0x0000, 0x0000, 0x0002], [0x0080, 0x0090, 0x0008], [0x0010, 0x0012, 0x0000], [0x0042, 0x0020, 0x0000], [0x0020, 0x0044, 0x0000], [0x0080, 0x0000, 0x0004], [0x0004, 0x0000, 0x0000], [0x0000, 0x0008, 0x0000], [0x0008, 0x0000, 0x0000]], + ], + ], +]; + +/// The row of [`XOR_PATTERNS`] for an XOR mode, as addrlib's +/// `GetSwizzlePatternInfo` picks it: thick 3D layouts have their own +/// standard and display patterns; 3D `Z_X` and `R_X` use the 2D ones. +fn xor_family(swizzle: Swizzle, thick: bool) -> Option { + Some(match (swizzle.0, thick) { + (21, false) => 0, + (22, false) => 1, + (17, false) => 2, + (18, false) => 3, + (24, _) => 4, + (25, false) => 5, + (26, false) => 6, + (27, _) => 7, + (21, true) => 8, + (17, true) => 9, + (25, true) => 10, + (26, true) => 11, + _ => return None, + }) +} + +/// `ComputeOffsetFromSwizzlePattern`: each address bit is the parity of +/// the coordinate bits its pattern entry names. +fn xor_offset(pattern: &XorPattern, bits: u32, x: u32, y: u32, z: u32) -> u64 { + pattern[..bits as usize] + .iter() + .enumerate() + .map(|(i, &[px, py, pz])| { + let parity = (x & u32::from(px)) ^ (y & u32::from(py)) ^ (z & u32::from(pz)); + u64::from(parity.count_ones() & 1) << i + }) + .sum() } type SwizzlePattern = [Vec; 3]; @@ -344,6 +603,7 @@ impl Layout { first_tail_mip: d.mips, mips, pattern: &EMPTY_PATTERN, + xor: None, } } @@ -526,18 +786,40 @@ impl Layout { first_tail_mip, mips, pattern, + xor: None, } } + /// Enables addressing for an XOR mode (`_X`, `_T`) with the console's + /// pipe configuration. The addresses are those of a texture whose + /// title memory starts on a block boundary (no pipe and bank XOR from + /// the address). Other layouts are left as they are. + pub fn configure_xor(&mut self, config: PipeConfig) { + let d = &self.desc; + if !d.swizzle.xor() || d.samples != 1 { + return; + } + let Some(family) = xor_family(d.swizzle, self.thick) else { + return; + }; + let console = match config { + PipeConfig::Pipes8Packers4 => 0, + PipeConfig::Pipes32Packers8 => 1, + }; + let element_log2 = d.element_bytes.trailing_zeros() as usize; + self.xor = Some(&XOR_PATTERNS[console][family][element_log2]); + } + /// Whether [`Layout::offset`] and the copies work for this layout: - /// linear and the modes without pipe or bank XOR, single-sampled. + /// linear, the modes without pipe or bank XOR, and the XOR modes once + /// [`Layout::configure_xor`] has named the console; single-sampled. + /// + /// `SW_4KB_R_X` stays unaddressed: GFX10 has no pattern for it. /// - /// shortcut: no addressing for the XOR modes (`_X`, `_T`) and MSAA; - /// they need the GPU's pipe and bank configuration (Series X and S - /// differ). Titles use them for render targets and depth, which the - /// host renders; add them when a title copies into or out of one. + /// shortcut: no addressing for MSAA; titles use it for render targets + /// and depth, which the host renders. pub fn addressable(&self) -> bool { - self.desc.swizzle == Swizzle::LINEAR || !self.pattern[0].is_empty() + self.desc.swizzle == Swizzle::LINEAR || !self.pattern[0].is_empty() || self.xor.is_some() } /// The slice and the depth inside it for `z` (an array slice or a 3D @@ -567,6 +849,9 @@ impl Layout { Error::Invalid }); } + if let Some(pattern) = self.xor { + return Ok(self.xor_address(pattern, m, x, y, z)); + } let (slice, z) = self.split(z); let base = u64::from(slice) * self.slice_size + m.offset; if self.desc.swizzle == Swizzle::LINEAR { @@ -576,6 +861,22 @@ impl Layout { Ok(base + self.row(m, y, z) + self.column(m, x)) } + /// `ComputeSurfaceAddrFromCoordMacroTiled` for an XOR mode: the block's + /// place, then the pattern applied to the whole coordinates (shifted + /// into the tail for a tail mip), whose bits above the block still + /// pick the pipe. + fn xor_address(&self, pattern: &XorPattern, m: &Mip, x: u32, y: u32, z: u32) -> u64 { + let [bw, bh, _] = self.block; + let log2 = self.alignment.trailing_zeros(); + let (x, y) = (x + m.tail.map_or(0, |t| t.x), y + m.tail.map_or(0, |t| t.y)); + let (slice, _) = self.split(z); + let blocks = u64::from(y / bh) * u64::from(m.pitch / bw) + u64::from(x / bw); + u64::from(slice) * self.slice_size + + m.offset + + (blocks << log2) + + xor_offset(pattern, log2, x, y, z) + } + /// The part of an address that depends on the row (and depth in a /// thick block). fn row(&self, m: &Mip, y: u32, z: u32) -> u64 { @@ -710,6 +1011,10 @@ impl Layout { if tiled_len < tiled_need as usize || linear_len < need || row_pitch < bytes { return Err(Error::TooSmall); } + if let Some(pattern) = self.xor { + self.walk_xor::(pattern, src, dst, m, first, row_pitch, depth_pitch); + return Ok(()); + } let linear = self.desc.swizzle == Swizzle::LINEAR; // The row and depth contribute one common base to every column, so // the same contiguous runs repeat on every row, including mip tails. @@ -763,6 +1068,57 @@ impl Layout { } Ok(()) } + + /// [`Layout::walk`] for an XOR mode: runs of elements whose x bits land + /// on consecutive address bits, the rest one element at a time. + #[allow(clippy::too_many_arguments)] + fn walk_xor( + &self, + pattern: &XorPattern, + src: &[u8], + dst: &mut [u8], + m: &Mip, + first: u32, + row_pitch: usize, + depth_pitch: usize, + ) { + let n = self.desc.element_bytes as usize; + let element_log2 = n.trailing_zeros(); + let bits = self.alignment.trailing_zeros() as usize; + // x bit i is plain when it alone gives address bit element_log2 + i + // and appears in no other address bit. + let plain = |i: u32| { + let at = (element_log2 + i) as usize; + at < bits + && pattern[..bits].iter().enumerate().all(|(b, &[px, py, pz])| { + let mine = (px >> i) & 1 != 0; + if b == at { + mine && px == 1 << i && py == 0 && pz == 0 + } else { + !mine + } + }) + }; + let run = 1u32 << (0..16).take_while(|&i| plain(i)).count(); + let tail_x = m.tail.map_or(0, |t| t.x); + for z in 0..m.depth { + for y in 0..m.height { + let linear_row = z as usize * depth_pitch + y as usize * row_pitch; + let mut x = 0; + while x < m.width { + let len = if (x + tail_x).is_multiple_of(run) && x + run <= m.width { + run + } else { + 1 + }; + let tiled = self.xor_address(pattern, m, x, y, first + z) as usize; + let at = linear_row + x as usize * n; + copy_run::(src, dst, tiled, at, len as usize * n); + x += len; + } + } + } + } } fn copy_run( @@ -937,6 +1293,142 @@ impl Texture { mod tests { use super::*; + /// Every XOR mode, on both consoles: elements tiled by `tile` sit where + /// `offset` says, and `detile` gives the rows back, for arrays, thick + /// and thin 3D textures, mip tails, and 1- to 16-byte elements. + #[test] + fn xor_modes_tile_where_offset_points() { + let cases = [ + (Dimension::Tex2d, 300u32, 200u32, 3u32, 0u32, 4u32, Swizzle::SW_64KB_R_X), + (Dimension::Tex2d, 70, 50, 2, 0, 16, Swizzle::SW_4KB_D_X), + (Dimension::Tex2d, 129, 65, 1, 0, 2, Swizzle::SW_64KB_Z_X), + (Dimension::Tex2d, 40, 300, 5, 3, 8, Swizzle::SW_64KB_S_X), + (Dimension::Tex2d, 96, 96, 1, 0, 1, Swizzle::SW_64KB_D_X), + (Dimension::Tex2d, 64, 64, 2, 0, 4, Swizzle::SW_64KB_S_T), + (Dimension::Tex2d, 64, 64, 1, 0, 4, Swizzle::SW_64KB_D_T), + (Dimension::Tex2d, 33, 17, 4, 0, 4, Swizzle::SW_4KB_S_X), + (Dimension::Tex3d, 64, 32, 16, 0, 8, Swizzle::SW_64KB_S_X), + (Dimension::Tex3d, 20, 20, 20, 0, 4, Swizzle::SW_4KB_S_X), + (Dimension::Tex3d, 32, 32, 8, 0, 4, Swizzle::SW_64KB_D_X), + (Dimension::Tex3d, 50, 30, 6, 0, 4, Swizzle::SW_64KB_R_X), + (Dimension::Tex3d, 40, 24, 12, 0, 2, Swizzle::SW_64KB_S_T), + ]; + for config in [PipeConfig::Pipes8Packers4, PipeConfig::Pipes32Packers8] { + for (dimension, width, height, depth, mips, bytes, swizzle) in cases { + let mips = match mips { + 0 => { + let deep = if dimension == Dimension::Tex3d { depth } else { 1 }; + 32 - width.max(height).max(deep).leading_zeros() + } + n => n, + }; + let desc = Desc { + dimension, + width, + height, + depth, + mips, + element_bytes: bytes, + block: 1, + samples: 1, + swizzle, + }; + let mut layout = Layout::new(&desc).unwrap(); + assert!(!layout.addressable()); + layout.configure_xor(config); + assert!(layout.addressable(), "{desc:?}"); + let n = bytes as usize; + let mut tiled = vec![0u8; layout.size as usize]; + let slices = if dimension == Dimension::Tex3d { 1 } else { depth }; + let value = |mip: u32, x: u32, y: u32, z: u32| { + let i = u64::from(mip) << 48 + | u64::from(z) << 32 + | u64::from(y) << 16 + | u64::from(x); + let mut v = [0u8; 16]; + v[..8].copy_from_slice(&i.wrapping_mul(0x9e37_79b9_7f4a_7c15).to_le_bytes()); + v[8..].copy_from_slice(&(!i).wrapping_mul(0xc2b2_ae3d_27d4_eb4f).to_le_bytes()); + v + }; + for mip in 0..mips { + let m = layout.mips[mip as usize]; + let (row, rows) = (m.width as usize * n, m.height as usize); + for slice in 0..slices { + let mut linear = vec![0u8; row * rows * m.depth as usize]; + for z in 0..m.depth { + for y in 0..m.height { + for x in 0..m.width { + let at = + (z as usize * rows + y as usize) * row + x as usize * n; + let v = value(mip, x, y, slice + z); + linear[at..at + n].copy_from_slice(&v[..n]); + } + } + } + layout.tile(&mut tiled, mip, slice, &linear, row, row * rows).unwrap(); + let mut back = vec![0u8; linear.len()]; + layout.detile(&tiled, mip, slice, &mut back, row, row * rows).unwrap(); + assert_eq!(back, linear, "{desc:?} mip {mip} slice {slice}"); + } + } + for mip in 0..mips { + let m = &layout.mips[mip as usize]; + let zs = if dimension == Dimension::Tex3d { m.depth } else { depth }; + for z in 0..zs { + for y in 0..m.height { + for x in 0..m.width { + let at = layout.offset(mip, x, y, z).unwrap() as usize; + assert_eq!( + tiled[at..at + n], + value(mip, x, y, z)[..n], + "{config:?} {desc:?} mip {mip} ({x}, {y}, {z})" + ); + } + } + } + } + } + } + } + + #[test] + fn render_xor_water_matches_both_consoles_with_padded_rows() { + // Golden FNV-1a digests of every tiled byte from XCL 85e3826's + // independent GFX10 tiler. Each texel stores its own linear index. + let desc = Desc { dimension: Dimension::Tex2d, width: 256, height: 256, + depth: 1, mips: 1, element_bytes: 4, block: 1, samples: 1, + swizzle: Swizzle::SW_64KB_R_X }; + let pitch = 1040; + let mut linear = vec![0xfe; 255 * pitch + 1024]; + for y in 0..256usize { + for x in 0..256usize { + let at = y * pitch + 4 * x; + linear[at..at + 4].copy_from_slice(&((y * 256 + x) as u32).to_le_bytes()); + } + } + for (cfg, expected) in [(PipeConfig::Pipes8Packers4, 0xc0e94c4e1b16af25), + (PipeConfig::Pipes32Packers8, 0x49527ce701b6e325)] { + let mut layout = Layout::new(&desc).unwrap(); + assert!(!layout.addressable()); + layout.configure_xor(cfg); + let mut tiled = vec![0xbc; layout.size as usize]; + layout.tile(&mut tiled, 0, 0, &linear, pitch, 256 * pitch).unwrap(); + let digest = tiled.iter().fold(0xcbf29ce484222325u64, |h, &b| { + (h ^ u64::from(b)).wrapping_mul(0x100000001b3) + }); + assert_eq!(digest, expected); + for y in 0..256u32 { + for x in 0..256u32 { + let at = layout.offset(0, x, y, 0).unwrap() as usize; + assert_eq!(&tiled[at..at + 4], &(y * 256 + x).to_le_bytes()); + } + } + let mut round_trip = vec![0xfe; linear.len()]; + layout.detile(&tiled, 0, 0, &mut round_trip, pitch, 256 * pitch).unwrap(); + assert_eq!(round_trip, linear); + } + } + fn desc(w: u32, h: u32, mips: u32, bpe: u32, swizzle: Swizzle) -> Desc { Desc { dimension: Dimension::Tex2d, diff --git a/crates/victory-gpu/src/console.rs b/crates/victory-gpu/src/console.rs index ab7252c57..c7053d262 100644 --- a/crates/victory-gpu/src/console.rs +++ b/crates/victory-gpu/src/console.rs @@ -13,6 +13,15 @@ pub enum Console { } impl Console { + /// The GPU's pipes and packers, which the addresses of the XOR swizzle + /// modes depend on. + pub fn pipes(self) -> victory_formats::texture::PipeConfig { + match self { + Console::SeriesX => victory_formats::texture::PipeConfig::Pipes32Packers8, + Console::SeriesS => victory_formats::texture::PipeConfig::Pipes8Packers4, + } + } + /// Title memory in bytes: (GPU-optimal, standard). Series X in the /// advanced configuration; Series S has one range, counted as standard /// (7,776 MiB, the published console-mode figure). diff --git a/crates/victory-gpu/src/resource.rs b/crates/victory-gpu/src/resource.rs index 597ede594..ce75b6ebb 100644 --- a/crates/victory-gpu/src/resource.rs +++ b/crates/victory-gpu/src/resource.rs @@ -3533,7 +3533,10 @@ pub(crate) fn texture_kind(this: This) -> Option<(u64, u32, u32)> { /// Texture `this`'s console layout (one plane), where it lies in title /// memory and the bytes that layout takes, for `crate::texback`; `None` for -/// a buffer or a texture with planes. +/// a buffer or a texture with planes. A texture in an XOR mode at a block +/// boundary (as the ocean's height map in `SW_64KB_R_X`) is addressed with +/// the console's pipes and packers +/// ([`victory_formats::texture::Layout::configure_xor`]). #[cfg(windows)] pub(crate) fn title_texture(this: This) -> Option<(victory_formats::texture::Layout, usize, usize)> { if this.is_null() { @@ -3544,10 +3547,13 @@ pub(crate) fn title_texture(this: This) -> Option<(victory_formats::texture::Lay return None; } let t = texture_layout(&r.desc)?; - let [plane] = &t.planes[..] else { - return None; - }; - Some((plane.layout.clone(), r.data() as usize, t.size as usize)) + let [mut plane]: [_; 1] = t.planes.try_into().ok()?; + let at = r.data() as usize; + // The XOR modes' addresses assume a block-aligned start. + if at.is_multiple_of(plane.layout.alignment as usize) { + plane.layout.configure_xor(crate::console::current().pipes()); + } + Some((plane.layout, at, t.size as usize)) } /// The bytes of title memory a texture with the resource description @@ -3987,6 +3993,26 @@ mod tests { } } + #[test] + #[cfg(windows)] + fn xor_layouts_are_addressed_at_a_block_boundary() { + // SW_4KB_S always; the XOR modes (SW_64KB_R_X, SW_64KB_S_X) only at + // a 64 KiB boundary. + for (swizzle, bias, addressable) in [(0x105, 0, true), (0x11b, 0, true), + (0x11b, 256, false), (0x119, 0, true), (0x119, 4096, false)] { + let desc = ResourceDesc { layout: swizzle, flags: 4, ..texture(256, 256, 41, 1) }; + let bytes = footprint(&desc).unwrap().size as usize; + let memory = vec![0u8; bytes + 65536 + bias]; + let at = (memory.as_ptr() as usize).next_multiple_of(65536) + bias; + let mut r = std::ptr::null(); + assert_eq!(create_at_address(std::ptr::null(), at as u64, &desc, 0, + std::ptr::null(), &PAGEABLE_IIDS[0], &mut r), object::S_OK); + let destination = title_texture(r).map(|(layout, base, extent)| (layout.addressable(), base, extent)); + assert_eq!(destination, Some((addressable, at, bytes)), "layout {swizzle:#x}, {bias} bytes off"); + assert_eq!(resource_release(r), 0); + } + } + fn heap(size: u64) -> This { let desc = HeapDesc { size, diff --git a/crates/victory-hle/src/modules/xg.rs b/crates/victory-hle/src/modules/xg.rs index eb78ec58b..8ed0e4d98 100644 --- a/crates/victory-hle/src/modules/xg.rs +++ b/crates/victory-hle/src/modules/xg.rs @@ -147,7 +147,7 @@ fn texture(desc: &ResourceDesc) -> Option { l if l & !0xff == SWIZZLED => Swizzle(l & 0xff), _ => return None, }; - let texture = Texture::new(&TextureDesc { + let mut texture = Texture::new(&TextureDesc { dimension, width: u32::try_from(desc.width).ok()?, height: desc.height, @@ -158,6 +158,11 @@ fn texture(desc: &ResourceDesc) -> Option { swizzle, }) .ok()?; + // Offsets are from the texture's start, which the title places on a + // block boundary. + for plane in &mut texture.planes { + plane.layout.configure_xor(crate::console::current().pipes()); + } // The layout struct has room for 15 mips. (texture.planes[0].layout.mips.len() <= MIPS).then_some(texture) } @@ -653,6 +658,21 @@ mod tests { slot:: u32>(c, 1)(c); } + /// An XOR mode gets element offsets once the console is known: the + /// first rows of a 256x256 R32 `SW_64KB_R_X` texture on Series X. + #[test] + fn xor_modes_have_element_offsets() { + type Offset = extern "system" fn(This, u32, u32, u64, u32, u32, u32, *mut u32) -> u64; + let c = create(&desc(256, 256, 1, 41, 0x11b)); + let offset: Offset = slot(c, 6); + let at = |x, y| offset(c, 0, 0, x, y, 0, 0, std::ptr::null_mut()); + // x bits 0 and 1 land on address bits 2 and 3, y bit 0 on bit 4. + assert_eq!([at(0, 0), at(1, 0), at(2, 0), at(0, 1)], [0, 4, 8, 16]); + // x bit 7 also flips a pipe bit inside the block. + assert_eq!(at(128, 0), 65536 + 0x8100); + slot:: u32>(c, 1)(c); + } + #[test] fn suggestions_follow_the_use() { let mut out = 0;