Check that the Extent3D TileShift only operates on a 3D ASTC Texture by checking Mip count
It appears that previously the Extent3D Tileshift could apply to Mip 0 of 2D Textures in some cases, this is responsible for breaking Asterix and Obelix, the Recall animation in TOTK and an older version of the Tanslation pack for Tsukihime -A Piece of Blue Glass Moon. I'm open to someone with a better explanation for why these changes fix things, while not regressing TOTKs gloom.
This commit is contained in:
parent
21ecf01a17
commit
9d0d8461a9
1 changed files with 4 additions and 3 deletions
|
@ -68,6 +68,7 @@ struct LevelInfo {
|
|||
Extent2D tile_size;
|
||||
u32 bpp_log2;
|
||||
u32 tile_width_spacing;
|
||||
u32 num_levels;
|
||||
};
|
||||
|
||||
[[nodiscard]] constexpr u32 AdjustTileSize(u32 shift, u32 unit_factor, u32 dimension) {
|
||||
|
@ -166,7 +167,7 @@ template <u32 GOB_EXTENT>
|
|||
}
|
||||
|
||||
[[nodiscard]] constexpr Extent3D TileShift(const LevelInfo& info, u32 level) {
|
||||
if (level == 0) {
|
||||
if (level == 0 && info.num_levels == 1) {
|
||||
return Extent3D{
|
||||
.width = info.block.width,
|
||||
.height = info.block.height,
|
||||
|
@ -1294,9 +1295,9 @@ u32 MapSizeBytes(const ImageBase& image) {
|
|||
|
||||
static_assert(CalculateLevelSize(LevelInfo{{1920, 1080, 1}, {0, 2, 0}, {1, 1}, 2, 0}, 0) ==
|
||||
0x7f8000);
|
||||
static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0}, 0) == 0x40000);
|
||||
static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0, 1}, 0) == 0x40000);
|
||||
|
||||
static_assert(CalculateLevelSize(LevelInfo{{128, 8, 1}, {0, 4, 0}, {1, 1}, 4, 0}, 0) == 0x40000);
|
||||
static_assert(CalculateLevelSize(LevelInfo{{128, 8, 1}, {0, 4, 0}, {1, 1}, 4, 0, 1}, 0) == 0x40000);
|
||||
|
||||
static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 0, 7) ==
|
||||
0x2afc00);
|
||||
|
|
Loading…
Add table
Reference in a new issue