diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-30 04:52:47 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-30 04:56:52 +0200 |
commit | 1ee1a5d3d64379bf2463c072a32af8e64a8c14cf (patch) | |
tree | 2d15f74f4e9a8118c88a0a2fedfc720e21ff5ba0 /src/video_core/texture_cache/texture_cache.h | |
parent | texture_cache: Only copy textures that were modified from host (diff) | |
download | yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.gz yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.bz2 yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.lz yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.xz yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.zst yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.zip |
Diffstat (limited to 'src/video_core/texture_cache/texture_cache.h')
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 3e024a098..4ba0d2c3a 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -656,19 +656,19 @@ private: if (params.target == SurfaceTarget::Texture3D) { return std::nullopt; } + const auto test_modified = [](TSurface& surface) { return surface->IsModified(); }; TSurface new_surface = GetUncachedSurface(gpu_addr, params); - std::size_t passed_tests = 0; - bool modified = false; - u32 num_resources = 0; - for (auto& surface : overlaps) { - const SurfaceParams& src_params = surface->GetSurfaceParams(); - num_resources += src_params.depth * src_params.num_levels; - } - if (num_resources != params.depth * params.num_levels) { + 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(); const auto mipmap_layer{new_surface->GetLayerMipmap(surface->GetGpuAddr())}; @@ -681,11 +681,6 @@ private: } ++passed_tests; - if (!surface->IsModified()) { - continue; - } - modified = true; - // Copy all mipmaps and layers const u32 block_width = params.GetDefaultBlockWidth(); const u32 block_height = params.GetDefaultBlockHeight(); @@ -709,6 +704,7 @@ private: return std::nullopt; } + const bool modified = std::any_of(overlaps.begin(), overlaps.end(), test_modified); for (const auto& surface : overlaps) { Unregister(surface); } |