summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-01-01 22:10:29 +0100
committerGitHub <noreply@github.com>2022-01-01 22:10:29 +0100
commit214b9fc9a7749784915dad37f734e03b1db9912b (patch)
tree047882d4e5ae7755c71f4bd60e0c7ccda8bc8957 /src
parentMerge pull request #7654 from Morph1984/dynarmic (diff)
parenttexture_cache/util: Fix s32 overflow when resolving overlaps (diff)
downloadyuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar.gz
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar.bz2
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar.lz
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar.xz
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.tar.zst
yuzu-214b9fc9a7749784915dad37f734e03b1db9912b.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/texture_cache/util.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp
index 7bd31b211..d8e19cb2f 100644
--- a/src/video_core/texture_cache/util.cpp
+++ b/src/video_core/texture_cache/util.cpp
@@ -364,14 +364,14 @@ template <u32 GOB_EXTENT>
[[nodiscard]] std::optional<SubresourceExtent> ResolveOverlapRightAddress2D(
const ImageInfo& new_info, GPUVAddr gpu_addr, const ImageBase& overlap, bool strict_size) {
- const u32 layer_stride = new_info.layer_stride;
- const s32 new_size = layer_stride * new_info.resources.layers;
- const s32 diff = static_cast<s32>(overlap.gpu_addr - gpu_addr);
+ const u64 layer_stride = new_info.layer_stride;
+ const u64 new_size = layer_stride * new_info.resources.layers;
+ const u64 diff = overlap.gpu_addr - gpu_addr;
if (diff > new_size) {
return std::nullopt;
}
- const s32 base_layer = diff / layer_stride;
- const s32 mip_offset = diff % layer_stride;
+ const s32 base_layer = static_cast<s32>(diff / layer_stride);
+ const s32 mip_offset = static_cast<s32>(diff % layer_stride);
const std::array offsets = CalculateMipLevelOffsets(new_info);
const auto end = offsets.begin() + new_info.resources.levels;
const auto it = std::find(offsets.begin(), end, static_cast<u32>(mip_offset));