From a4840e1992667946830c0af11166885fbd534cae Mon Sep 17 00:00:00 2001 From: Triang3l Date: Tue, 24 May 2022 22:33:27 +0300 Subject: [PATCH] [GPU] FIXME comment for 1bpb/2bpb texture tiled extent --- src/xenia/gpu/texture_util.cc | 6 ++++++ src/xenia/gpu/texture_util.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/xenia/gpu/texture_util.cc b/src/xenia/gpu/texture_util.cc index 849aac8e1..218ad1133 100644 --- a/src/xenia/gpu/texture_util.cc +++ b/src/xenia/gpu/texture_util.cc @@ -391,6 +391,12 @@ TextureGuestLayout GetGuestTextureLayout( // 2D 32x32-block tiles are laid out linearly in the texture. // Calculate the extent as ((all rows except for the last * pitch in // tiles + last row length in tiles) * bytes per tile). + // FIXME(Triang3l): This is wrong for 1bpb and 2bpb. At 1bpb (32x32 is + // 1024 bytes), offset for X + 32 minus offset for X is 512, not 1024, + // but offset for X + 128 minus offset for X + 96 is 2560. Also, for + // XY = 0...31, the extent of the addresses is 2560, not 1024. At 2bpb, + // addressing repeats every 64x64, and the extent for XY = 0...31 is + // 3072, not 2048. level_layout.array_slice_data_extent_bytes = (level_layout.y_extent_blocks - xenos::kTextureTileWidthHeight) * level_layout.row_pitch_bytes + diff --git a/src/xenia/gpu/texture_util.h b/src/xenia/gpu/texture_util.h index 7e20ab76f..e1f849b42 100644 --- a/src/xenia/gpu/texture_util.h +++ b/src/xenia/gpu/texture_util.h @@ -207,6 +207,11 @@ void GetTextureTotalSize(xenos::DataDimension dimension, // Offset3D(X * 32, Y * 32, Z * 8) + Offset3D(x, y, z) // (true for negative offsets too). // - 2D 32x32 tiles are laid out linearly. +// FIXME(Triang3l): This is wrong for 1bpb and 2bpb. At 1bpb (32x32 is 1024 +// bytes), offset for X + 32 minus offset for X is 512, not 1024, but offset for +// X + 128 minus offset for X + 96 is 2560. Also, for XY = 0...31, the extent of +// the addresses is 2560, not 1024. At 2bpb, addressing repeats every 64x64, and +// the extent for XY = 0...31 is 3072, not 2048. // - 3D tiled texture slices 0:3 and 4:7 are stored separately in memory, in // non-overlapping ranges, but addressing in 4:7 is different than in 0:3. // - Addressing of blocks that are contiguous along X (for tiling/untiling of