From 6755025310335abdb655c11fc65801fee99bb3d9 Mon Sep 17 00:00:00 2001 From: Markus Wick Date: Thu, 10 Jun 2021 21:07:27 +0200 Subject: Fix GCC undefined behavior sanitizer. * Wrong alignment in u64 LOG_DEBUG -> memcpy. * Huge shift exponent in stride calculation for linear buffer, unused result -> skipped. * Large shift in buffer cache if word = 0, skip checking for set bits. Non of those were critical, so this should not change any behavior. At least with the assumption, that the last one used masking behavior, which always yield continuous_bits = 0. --- src/video_core/texture_cache/util.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/video_core/texture_cache') 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(MAX_MIP_LEVELS)); const LevelInfo level_info = MakeLevelInfo(info); LevelArray offsets{}; -- cgit v1.2.3