summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-05-24 09:55:47 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-05-24 10:06:58 +0200
commit01c4568786631515ea13ec8cf991d534272e87b7 (patch)
tree6d1b068b856f0f6cc842c56043fdaa756499bd61 /src
parentMerge pull request #10422 from liamwhite/gc (diff)
downloadyuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar.gz
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar.bz2
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar.lz
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar.xz
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.tar.zst
yuzu-01c4568786631515ea13ec8cf991d534272e87b7.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/texture_cache/util.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp
index 1463f157b..95a5b47d8 100644
--- a/src/video_core/texture_cache/util.cpp
+++ b/src/video_core/texture_cache/util.cpp
@@ -123,7 +123,9 @@ template <u32 GOB_EXTENT>
return {
.width = AdjustMipBlockSize<GOB_SIZE_X>(num_tiles.width, block_size.width, level),
.height = AdjustMipBlockSize<GOB_SIZE_Y>(num_tiles.height, block_size.height, level),
- .depth = AdjustMipBlockSize<GOB_SIZE_Z>(num_tiles.depth, block_size.depth, level),
+ .depth = level == 0
+ ? block_size.depth
+ : AdjustMipBlockSize<GOB_SIZE_Z>(num_tiles.depth, block_size.depth, level),
};
}
@@ -165,6 +167,13 @@ template <u32 GOB_EXTENT>
}
[[nodiscard]] constexpr Extent3D TileShift(const LevelInfo& info, u32 level) {
+ if (level == 0) {
+ return Extent3D{
+ .width = info.block.width,
+ .height = info.block.height,
+ .depth = info.block.depth,
+ };
+ }
const Extent3D blocks = NumLevelBlocks(info, level);
return Extent3D{
.width = AdjustTileSize(info.block.width, GOB_SIZE_X, blocks.width),
@@ -1288,7 +1297,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) == 0x4000);
+static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0}, 0) == 0x40000);
+
+static_assert(CalculateLevelSize(LevelInfo{{128, 8, 1}, {0, 4, 0}, {1, 1}, 4, 0}, 0) == 0x40000);
static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 0, 7) ==
0x2afc00);