summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-11-30 03:09:43 +0100
committerGitHub <noreply@github.com>2019-11-30 03:09:43 +0100
commitb2c763671047e9dfefd8b55a0c7f0935f5d35cf8 (patch)
tree54062097312593d1396128bef4d7de3de5ea603e
parentMerge pull request #3169 from lioncash/memory (diff)
parenttexture_cache/surface_base: Fix out of bounds texture views (diff)
downloadyuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar.gz
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar.bz2
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar.lz
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar.xz
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.tar.zst
yuzu-b2c763671047e9dfefd8b55a0c7f0935f5d35cf8.zip
-rw-r--r--src/video_core/texture_cache/surface_base.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h
index 1bed82898..5f79bb0aa 100644
--- a/src/video_core/texture_cache/surface_base.h
+++ b/src/video_core/texture_cache/surface_base.h
@@ -254,16 +254,14 @@ public:
if (!layer_mipmap) {
return {};
}
- const u32 end_layer{layer_mipmap->first};
- const u32 end_mipmap{layer_mipmap->second};
+ const auto [end_layer, end_mipmap] = *layer_mipmap;
if (layer != end_layer) {
if (mipmap == 0 && end_mipmap == 0) {
- return GetView(ViewParams(view_params.target, layer, end_layer - layer + 1, 0, 1));
+ return GetView(ViewParams(view_params.target, layer, end_layer - layer, 0, 1));
}
return {};
} else {
- return GetView(
- ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap + 1));
+ return GetView(ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap));
}
}
@@ -278,8 +276,7 @@ public:
if (!layer_mipmap) {
return {};
}
- const u32 layer{layer_mipmap->first};
- const u32 mipmap{layer_mipmap->second};
+ const auto [layer, mipmap] = *layer_mipmap;
if (GetMipmapSize(mipmap) != candidate_size) {
return EmplaceIrregularView(view_params, view_addr, candidate_size, mipmap, layer);
}