VERY experimental Nintendo Switch 2 emulator
C++
TextureCache: Fix case where layer goes off bound.
Fernando Sahmkow57926f80c06a
diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cppindex 94d3a6ae53..0caf3b4f05 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);