summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-06-01 22:15:55 -0400
committerGravatar ReinUsesLisp2019-06-20 21:38:33 -0300
commit3809041c24a6ebea009923c14fb36aa1031bf188 (patch)
treeeb998770ed0255ec52649b5f619ddc18550c3afd /src/video_core/texture_cache
parenttexture_cache: Implement Buffer Copy and detect Turing GPUs Image Copies (diff)
downloadyuzu-3809041c24a6ebea009923c14fb36aa1031bf188.tar.gz
yuzu-3809041c24a6ebea009923c14fb36aa1031bf188.tar.xz
yuzu-3809041c24a6ebea009923c14fb36aa1031bf188.zip
texture_cache: Optimize GetSurface and use references on functions that don't change a surface.
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/texture_cache.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index e0d0e1f70..951168357 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -234,15 +234,15 @@ protected:
234 234
235 virtual TSurface CreateSurface(GPUVAddr gpu_addr, const SurfaceParams& params) = 0; 235 virtual TSurface CreateSurface(GPUVAddr gpu_addr, const SurfaceParams& params) = 0;
236 236
237 virtual void ImageCopy(TSurface src_surface, TSurface dst_surface, 237 virtual void ImageCopy(TSurface& src_surface, TSurface& dst_surface,
238 const CopyParams& copy_params) = 0; 238 const CopyParams& copy_params) = 0;
239 239
240 virtual void ImageBlit(TView src_view, TView dst_view, 240 virtual void ImageBlit(TView& src_view, TView& dst_view,
241 const Tegra::Engines::Fermi2D::Config& copy_config) = 0; 241 const Tegra::Engines::Fermi2D::Config& copy_config) = 0;
242 242
243 // Depending on the backend, a buffer copy can be slow as it means deoptimizing the texture 243 // Depending on the backend, a buffer copy can be slow as it means deoptimizing the texture
244 // and reading it from a sepparate buffer. 244 // and reading it from a sepparate buffer.
245 virtual void BufferCopy(TSurface src_surface, TSurface dst_surface) = 0; 245 virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
246 246
247 void Register(TSurface surface) { 247 void Register(TSurface surface) {
248 std::lock_guard lock{mutex}; 248 std::lock_guard lock{mutex};
@@ -516,8 +516,9 @@ private:
516 // Step 1 516 // Step 1
517 // Check Level 1 Cache for a fast structural match. If candidate surface 517 // Check Level 1 Cache for a fast structural match. If candidate surface
518 // matches at certain level we are pretty much done. 518 // matches at certain level we are pretty much done.
519 if (l1_cache.count(cache_addr) > 0) { 519 auto iter = l1_cache.find(cache_addr);
520 TSurface current_surface = l1_cache[cache_addr]; 520 if (iter != l1_cache.end()) {
521 TSurface& current_surface = iter->second;
521 auto topological_result = current_surface->MatchesTopology(params); 522 auto topological_result = current_surface->MatchesTopology(params);
522 if (topological_result != MatchTopologyResult::FullMatch) { 523 if (topological_result != MatchTopologyResult::FullMatch) {
523 std::vector<TSurface> overlaps{current_surface}; 524 std::vector<TSurface> overlaps{current_surface};
@@ -526,7 +527,6 @@ private:
526 } 527 }
527 MatchStructureResult s_result = current_surface->MatchesStructure(params); 528 MatchStructureResult s_result = current_surface->MatchesStructure(params);
528 if (s_result != MatchStructureResult::None && 529 if (s_result != MatchStructureResult::None &&
529 current_surface->GetGpuAddr() == gpu_addr &&
530 (params.target != SurfaceTarget::Texture3D || 530 (params.target != SurfaceTarget::Texture3D ||
531 current_surface->MatchTarget(params.target))) { 531 current_surface->MatchTarget(params.target))) {
532 if (s_result == MatchStructureResult::FullMatch) { 532 if (s_result == MatchStructureResult::FullMatch) {