diff options
| author | 2020-05-29 23:52:47 -0300 | |
|---|---|---|
| committer | 2020-05-29 23:56:52 -0300 | |
| commit | 1ee1a5d3d64379bf2463c072a32af8e64a8c14cf (patch) | |
| tree | 2d15f74f4e9a8118c88a0a2fedfc720e21ff5ba0 /src | |
| parent | texture_cache: Only copy textures that were modified from host (diff) | |
| download | yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.gz yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.tar.xz yuzu-1ee1a5d3d64379bf2463c072a32af8e64a8c14cf.zip | |
texture_cache: More relaxed reconstruction
Only reupload textures when they've not been modified from the GPU.
Diffstat (limited to 'src')
| -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: | |||
| 656 | if (params.target == SurfaceTarget::Texture3D) { | 656 | if (params.target == SurfaceTarget::Texture3D) { |
| 657 | return std::nullopt; | 657 | return std::nullopt; |
| 658 | } | 658 | } |
| 659 | const auto test_modified = [](TSurface& surface) { return surface->IsModified(); }; | ||
| 659 | TSurface new_surface = GetUncachedSurface(gpu_addr, params); | 660 | TSurface new_surface = GetUncachedSurface(gpu_addr, params); |
| 660 | std::size_t passed_tests = 0; | ||
| 661 | bool modified = false; | ||
| 662 | 661 | ||
| 663 | u32 num_resources = 0; | 662 | if (std::none_of(overlaps.begin(), overlaps.end(), test_modified)) { |
| 664 | for (auto& surface : overlaps) { | ||
| 665 | const SurfaceParams& src_params = surface->GetSurfaceParams(); | ||
| 666 | num_resources += src_params.depth * src_params.num_levels; | ||
| 667 | } | ||
| 668 | if (num_resources != params.depth * params.num_levels) { | ||
| 669 | LoadSurface(new_surface); | 663 | LoadSurface(new_surface); |
| 664 | for (const auto& surface : overlaps) { | ||
| 665 | Unregister(surface); | ||
| 666 | } | ||
| 667 | Register(new_surface); | ||
| 668 | return {{new_surface, new_surface->GetMainView()}}; | ||
| 670 | } | 669 | } |
| 671 | 670 | ||
| 671 | std::size_t passed_tests = 0; | ||
| 672 | for (auto& surface : overlaps) { | 672 | for (auto& surface : overlaps) { |
| 673 | const SurfaceParams& src_params = surface->GetSurfaceParams(); | 673 | const SurfaceParams& src_params = surface->GetSurfaceParams(); |
| 674 | const auto mipmap_layer{new_surface->GetLayerMipmap(surface->GetGpuAddr())}; | 674 | const auto mipmap_layer{new_surface->GetLayerMipmap(surface->GetGpuAddr())}; |
| @@ -681,11 +681,6 @@ private: | |||
| 681 | } | 681 | } |
| 682 | ++passed_tests; | 682 | ++passed_tests; |
| 683 | 683 | ||
| 684 | if (!surface->IsModified()) { | ||
| 685 | continue; | ||
| 686 | } | ||
| 687 | modified = true; | ||
| 688 | |||
| 689 | // Copy all mipmaps and layers | 684 | // Copy all mipmaps and layers |
| 690 | const u32 block_width = params.GetDefaultBlockWidth(); | 685 | const u32 block_width = params.GetDefaultBlockWidth(); |
| 691 | const u32 block_height = params.GetDefaultBlockHeight(); | 686 | const u32 block_height = params.GetDefaultBlockHeight(); |
| @@ -709,6 +704,7 @@ private: | |||
| 709 | return std::nullopt; | 704 | return std::nullopt; |
| 710 | } | 705 | } |
| 711 | 706 | ||
| 707 | const bool modified = std::any_of(overlaps.begin(), overlaps.end(), test_modified); | ||
| 712 | for (const auto& surface : overlaps) { | 708 | for (const auto& surface : overlaps) { |
| 713 | Unregister(surface); | 709 | Unregister(surface); |
| 714 | } | 710 | } |