VERY experimental Nintendo Switch 2 emulator
C++
Merge pull request #4012 from ReinUsesLisp/mipmap-overlaps
bunnei6da7788907cf
diff --cc src/video_core/texture_cache/texture_cache.hindex 45e3ddd2cf,4ba0d2c3a3..6f63217a2d--- a/src/video_core/texture_cache/texture_cache.h+++ b/src/video_core/texture_cache/texture_cache.h@@@ -653,23 -650,28 +653,28 @@@ private* @param params The parameters on the new surface.* @param gpu_addr The starting address of the new surface.**/- std::optional<std::pair<TSurface, TView>> TryReconstructSurface(std::vector<TSurface>& overlaps,+ std::optional<std::pair<TSurface, TView>> TryReconstructSurface(VectorSurface& overlaps,const SurfaceParams& params,- const GPUVAddr gpu_addr) {+ GPUVAddr gpu_addr) {if (params.target == SurfaceTarget::Texture3D) {- return {};+ return std::nullopt;}- bool modified = false;+ const auto test_modified = [](TSurface& surface) { return surface->IsModified(); };TSurface new_surface = GetUncachedSurface(gpu_addr, params);- u32 passed_tests = 0;++ if (std::none_of(overlaps.begin(), overlaps.end(), test_modified)) {+ LoadSurface(new_surface);+ for (const auto& surface : overlaps) {+ Unregister(surface);+ }+ Register(new_surface);+ return {{new_surface, new_surface->GetMainView()}};+ }++ std::size_t passed_tests = 0;for (auto& surface : overlaps) {const SurfaceParams& src_params = surface->GetSurfaceParams();- if (src_params.is_layered || src_params.num_levels > 1) {- // We send this cases to recycle as they are more complex to handle- return {};- }- const std::size_t candidate_size = surface->GetSizeInBytes();- auto mipmap_layer{new_surface->GetLayerMipmap(surface->GetGpuAddr())};+ const auto mipmap_layer{new_surface->GetLayerMipmap(surface->GetGpuAddr())};if (!mipmap_layer) {continue;}