From e7c2b054c198bcf7c39a2943f76c866be09aa7d7 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/util.cpp') diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 8c4a5523b3..906604a391 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