summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-06-10 22:17:33 -0700
committerGitHub <noreply@github.com>2021-06-10 22:17:33 -0700
commit46ec0ee55b5820a517f251780c908cff5fcd1c13 (patch)
treeb8639614c724fb83f959e50da8608236b0210ebf /src/video_core
parent4547b2735a7e663be436bca54ed83da06a109c86 (diff)
parent6755025310335abdb655c11fc65801fee99bb3d9 (diff)
Merge pull request #6445 from degasus/fix_ubsn
Fix GCC undefined behavior sanitizer.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/buffer_cache/buffer_base.h3
-rw-r--r--src/video_core/texture_cache/util.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h
index 0c00ae280..a39505903 100644
--- a/src/video_core/buffer_cache/buffer_base.h
+++ b/src/video_core/buffer_cache/buffer_base.h
@@ -476,6 +476,9 @@ private:
current_size = 0;
on_going = false;
}
+ if (empty_bits == PAGES_PER_WORD) {
+ break;
+ }
page += empty_bits;
const int continuous_bits = std::countr_one(word >> page);
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp
index 8c4a5523b..906604a39 100644
--- a/src/video_core/texture_cache/util.cpp
+++ b/src/video_core/texture_cache/util.cpp
@@ -647,6 +647,9 @@ u32 CalculateLayerSize(const ImageInfo& info) noexcept {
}
LevelArray CalculateMipLevelOffsets(const ImageInfo& info) noexcept {
+ if (info.type == ImageType::Linear) {
+ return {};
+ }
ASSERT(info.resources.levels <= static_cast<s32>(MAX_MIP_LEVELS));
const LevelInfo level_info = MakeLevelInfo(info);
LevelArray offsets{};