summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-06-27 01:02:39 +0200
committerGitHub <noreply@github.com>2020-06-27 01:02:39 +0200
commit3579db425e3f7af8bf1283dc7fc35593f80a50aa (patch)
treea5c17c834634f408034bffbc8eec8e235276641b
parentMerge pull request #4111 from ReinUsesLisp/preserve-contents-vk (diff)
parentTextureCache: Fix case where layer goes off bound. (diff)
downloadyuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar.gz
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar.bz2
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar.lz
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar.xz
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.tar.zst
yuzu-3579db425e3f7af8bf1283dc7fc35593f80a50aa.zip
-rw-r--r--src/video_core/texture_cache/surface_base.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp
index 94d3a6ae5..0caf3b4f0 100644
--- a/src/video_core/texture_cache/surface_base.cpp
+++ b/src/video_core/texture_cache/surface_base.cpp
@@ -120,6 +120,9 @@ std::optional<std::pair<u32, u32>> SurfaceBaseImpl::GetLayerMipmap(
}
const auto relative_address{static_cast<GPUVAddr>(candidate_gpu_addr - gpu_addr)};
const auto layer{static_cast<u32>(relative_address / layer_size)};
+ if (layer >= params.depth) {
+ return {};
+ }
const GPUVAddr mipmap_address = relative_address - layer_size * layer;
const auto mipmap_it =
Common::BinaryFind(mipmap_offsets.begin(), mipmap_offsets.end(), mipmap_address);