summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2019-10-16 22:09:40 -0300
committerGravatar GitHub2019-10-16 22:09:40 -0300
commit60c602e4e77abdefedf0fb1c70606723d17988c9 (patch)
tree7d77fe4d85ef752857c21d87bbceeded8ab73551
parentMerge pull request #2982 from lioncash/surface (diff)
parentvideo_core/texture_cache: Amend Doxygen references (diff)
downloadyuzu-60c602e4e77abdefedf0fb1c70606723d17988c9.tar.gz
yuzu-60c602e4e77abdefedf0fb1c70606723d17988c9.tar.xz
yuzu-60c602e4e77abdefedf0fb1c70606723d17988c9.zip
Merge pull request #2978 from lioncash/doxygen
video_core/texture_cache: Amend Doxygen references
-rw-r--r--src/video_core/texture_cache/texture_cache.h135
1 files changed, 78 insertions, 57 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 0a23114f9..6a92b22d3 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -62,10 +62,10 @@ public:
62 } 62 }
63 } 63 }
64 64
65 /*** 65 /**
66 * `Guard` guarantees that rendertargets don't unregister themselves if the 66 * Guarantees that rendertargets don't unregister themselves if the
67 * collide. Protection is currently only done on 3D slices. 67 * collide. Protection is currently only done on 3D slices.
68 ***/ 68 */
69 void GuardRenderTargets(bool new_guard) { 69 void GuardRenderTargets(bool new_guard) {
70 guard_render_targets = new_guard; 70 guard_render_targets = new_guard;
71 } 71 }
@@ -287,7 +287,7 @@ protected:
287 const Tegra::Engines::Fermi2D::Config& copy_config) = 0; 287 const Tegra::Engines::Fermi2D::Config& copy_config) = 0;
288 288
289 // Depending on the backend, a buffer copy can be slow as it means deoptimizing the texture 289 // Depending on the backend, a buffer copy can be slow as it means deoptimizing the texture
290 // and reading it from a sepparate buffer. 290 // and reading it from a separate buffer.
291 virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0; 291 virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
292 292
293 void ManageRenderTargetUnregister(TSurface& surface) { 293 void ManageRenderTargetUnregister(TSurface& surface) {
@@ -386,12 +386,13 @@ private:
386 }; 386 };
387 387
388 /** 388 /**
389 * `PickStrategy` takes care of selecting a proper strategy to deal with a texture recycle. 389 * Takes care of selecting a proper strategy to deal with a texture recycle.
390 * @param overlaps, the overlapping surfaces registered in the cache. 390 *
391 * @param params, the paremeters on the new surface. 391 * @param overlaps The overlapping surfaces registered in the cache.
392 * @param gpu_addr, the starting address of the new surface. 392 * @param params The parameters on the new surface.
393 * @param untopological, tells the recycler that the texture has no way to match the overlaps 393 * @param gpu_addr The starting address of the new surface.
394 * due to topological reasons. 394 * @param untopological Indicates to the recycler that the texture has no way
395 * to match the overlaps due to topological reasons.
395 **/ 396 **/
396 RecycleStrategy PickStrategy(std::vector<TSurface>& overlaps, const SurfaceParams& params, 397 RecycleStrategy PickStrategy(std::vector<TSurface>& overlaps, const SurfaceParams& params,
397 const GPUVAddr gpu_addr, const MatchTopologyResult untopological) { 398 const GPUVAddr gpu_addr, const MatchTopologyResult untopological) {
@@ -419,16 +420,19 @@ private:
419 } 420 }
420 421
421 /** 422 /**
422 * `RecycleSurface` es a method we use to decide what to do with textures we can't resolve in 423 * Used to decide what to do with textures we can't resolve in the cache It has 2 implemented
423 *the cache It has 2 implemented strategies: Ignore and Flush. Ignore just unregisters all the 424 * strategies: Ignore and Flush.
424 *overlaps and loads the new texture. Flush, flushes all the overlaps into memory and loads the 425 *
425 *new surface from that data. 426 * - Ignore: Just unregisters all the overlaps and loads the new texture.
426 * @param overlaps, the overlapping surfaces registered in the cache. 427 * - Flush: Flushes all the overlaps into memory and loads the new surface from that data.
427 * @param params, the paremeters on the new surface. 428 *
428 * @param gpu_addr, the starting address of the new surface. 429 * @param overlaps The overlapping surfaces registered in the cache.
429 * @param preserve_contents, tells if the new surface should be loaded from meory or left blank 430 * @param params The parameters for the new surface.
430 * @param untopological, tells the recycler that the texture has no way to match the overlaps 431 * @param gpu_addr The starting address of the new surface.
431 * due to topological reasons. 432 * @param preserve_contents Indicates that the new surface should be loaded from memory or left
433 * blank.
434 * @param untopological Indicates to the recycler that the texture has no way to match the
435 * overlaps due to topological reasons.
432 **/ 436 **/
433 std::pair<TSurface, TView> RecycleSurface(std::vector<TSurface>& overlaps, 437 std::pair<TSurface, TView> RecycleSurface(std::vector<TSurface>& overlaps,
434 const SurfaceParams& params, const GPUVAddr gpu_addr, 438 const SurfaceParams& params, const GPUVAddr gpu_addr,
@@ -465,10 +469,12 @@ private:
465 } 469 }
466 470
467 /** 471 /**
468 * `RebuildSurface` this method takes a single surface and recreates into another that 472 * Takes a single surface and recreates into another that may differ in
469 * may differ in format, target or width alingment. 473 * format, target or width alignment.
470 * @param current_surface, the registered surface in the cache which we want to convert. 474 *
471 * @param params, the new surface params which we'll use to recreate the surface. 475 * @param current_surface The registered surface in the cache which we want to convert.
476 * @param params The new surface params which we'll use to recreate the surface.
477 * @param is_render Whether or not the surface is a render target.
472 **/ 478 **/
473 std::pair<TSurface, TView> RebuildSurface(TSurface current_surface, const SurfaceParams& params, 479 std::pair<TSurface, TView> RebuildSurface(TSurface current_surface, const SurfaceParams& params,
474 bool is_render) { 480 bool is_render) {
@@ -502,12 +508,14 @@ private:
502 } 508 }
503 509
504 /** 510 /**
505 * `ManageStructuralMatch` this method takes a single surface and checks with the new surface's 511 * Takes a single surface and checks with the new surface's params if it's an exact
506 * params if it's an exact match, we return the main view of the registered surface. If it's 512 * match, we return the main view of the registered surface. If its formats don't
507 * formats don't match, we rebuild the surface. We call this last method a `Mirage`. If formats 513 * match, we rebuild the surface. We call this last method a `Mirage`. If formats
508 * match but the targets don't, we create an overview View of the registered surface. 514 * match but the targets don't, we create an overview View of the registered surface.
509 * @param current_surface, the registered surface in the cache which we want to convert. 515 *
510 * @param params, the new surface params which we want to check. 516 * @param current_surface The registered surface in the cache which we want to convert.
517 * @param params The new surface params which we want to check.
518 * @param is_render Whether or not the surface is a render target.
511 **/ 519 **/
512 std::pair<TSurface, TView> ManageStructuralMatch(TSurface current_surface, 520 std::pair<TSurface, TView> ManageStructuralMatch(TSurface current_surface,
513 const SurfaceParams& params, bool is_render) { 521 const SurfaceParams& params, bool is_render) {
@@ -529,13 +537,14 @@ private:
529 } 537 }
530 538
531 /** 539 /**
532 * `TryReconstructSurface` unlike `RebuildSurface` where we know the registered surface 540 * Unlike RebuildSurface where we know whether or not registered surfaces match the candidate
533 * matches the candidate in some way, we got no guarantess here. We try to see if the overlaps 541 * in some way, we have no guarantees here. We try to see if the overlaps are sublayers/mipmaps
534 * are sublayers/mipmaps of the new surface, if they all match we end up recreating a surface 542 * of the new surface, if they all match we end up recreating a surface for them,
535 * for them, else we return nothing. 543 * else we return nothing.
536 * @param overlaps, the overlapping surfaces registered in the cache. 544 *
537 * @param params, the paremeters on the new surface. 545 * @param overlaps The overlapping surfaces registered in the cache.
538 * @param gpu_addr, the starting address of the new surface. 546 * @param params The parameters on the new surface.
547 * @param gpu_addr The starting address of the new surface.
539 **/ 548 **/
540 std::optional<std::pair<TSurface, TView>> TryReconstructSurface(std::vector<TSurface>& overlaps, 549 std::optional<std::pair<TSurface, TView>> TryReconstructSurface(std::vector<TSurface>& overlaps,
541 const SurfaceParams& params, 550 const SurfaceParams& params,
@@ -584,19 +593,27 @@ private:
584 } 593 }
585 594
586 /** 595 /**
587 * `GetSurface` gets the starting address and parameters of a candidate surface and tries 596 * Gets the starting address and parameters of a candidate surface and tries
588 * to find a matching surface within the cache. This is done in 3 big steps. The first is to 597 * to find a matching surface within the cache. This is done in 3 big steps:
589 * check the 1st Level Cache in order to find an exact match, if we fail, we move to step 2. 598 *
590 * Step 2 is checking if there are any overlaps at all, if none, we just load the texture from 599 * 1. Check the 1st Level Cache in order to find an exact match, if we fail, we move to step 2.
591 * memory else we move to step 3. Step 3 consists on figuring the relationship between the 600 *
592 * candidate texture and the overlaps. We divide the scenarios depending if there's 1 or many 601 * 2. Check if there are any overlaps at all, if there are none, we just load the texture from
593 * overlaps. If there's many, we just try to reconstruct a new surface out of them based on the 602 * memory else we move to step 3.
594 * candidate's parameters, if we fail, we recycle. When there's only 1 overlap then we have to 603 *
595 * check if the candidate is a view (layer/mipmap) of the overlap or if the registered surface 604 * 3. Consists of figuring out the relationship between the candidate texture and the
596 * is a mipmap/layer of the candidate. In this last case we reconstruct a new surface. 605 * overlaps. We divide the scenarios depending if there's 1 or many overlaps. If
597 * @param gpu_addr, the starting address of the candidate surface. 606 * there's many, we just try to reconstruct a new surface out of them based on the
598 * @param params, the paremeters on the candidate surface. 607 * candidate's parameters, if we fail, we recycle. When there's only 1 overlap then we
599 * @param preserve_contents, tells if the new surface should be loaded from meory or left blank. 608 * have to check if the candidate is a view (layer/mipmap) of the overlap or if the
609 * registered surface is a mipmap/layer of the candidate. In this last case we reconstruct
610 * a new surface.
611 *
612 * @param gpu_addr The starting address of the candidate surface.
613 * @param params The parameters on the candidate surface.
614 * @param preserve_contents Indicates that the new surface should be loaded from memory or
615 * left blank.
616 * @param is_render Whether or not the surface is a render target.
600 **/ 617 **/
601 std::pair<TSurface, TView> GetSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, 618 std::pair<TSurface, TView> GetSurface(const GPUVAddr gpu_addr, const SurfaceParams& params,
602 bool preserve_contents, bool is_render) { 619 bool preserve_contents, bool is_render) {
@@ -651,7 +668,7 @@ private:
651 // Step 3 668 // Step 3
652 // Now we need to figure the relationship between the texture and its overlaps 669 // Now we need to figure the relationship between the texture and its overlaps
653 // we do a topological test to ensure we can find some relationship. If it fails 670 // we do a topological test to ensure we can find some relationship. If it fails
654 // inmediatly recycle the texture 671 // immediately recycle the texture
655 for (const auto& surface : overlaps) { 672 for (const auto& surface : overlaps) {
656 const auto topological_result = surface->MatchesTopology(params); 673 const auto topological_result = surface->MatchesTopology(params);
657 if (topological_result != MatchTopologyResult::FullMatch) { 674 if (topological_result != MatchTopologyResult::FullMatch) {
@@ -720,12 +737,13 @@ private:
720 } 737 }
721 738
722 /** 739 /**
723 * `DeduceSurface` gets the starting address and parameters of a candidate surface and tries 740 * Gets the starting address and parameters of a candidate surface and tries to find a
724 * to find a matching surface within the cache that's similar to it. If there are many textures 741 * matching surface within the cache that's similar to it. If there are many textures
725 * or the texture found if entirely incompatible, it will fail. If no texture is found, the 742 * or the texture found if entirely incompatible, it will fail. If no texture is found, the
726 * blit will be unsuccessful. 743 * blit will be unsuccessful.
727 * @param gpu_addr, the starting address of the candidate surface. 744 *
728 * @param params, the paremeters on the candidate surface. 745 * @param gpu_addr The starting address of the candidate surface.
746 * @param params The parameters on the candidate surface.
729 **/ 747 **/
730 Deduction DeduceSurface(const GPUVAddr gpu_addr, const SurfaceParams& params) { 748 Deduction DeduceSurface(const GPUVAddr gpu_addr, const SurfaceParams& params) {
731 const auto host_ptr{system.GPU().MemoryManager().GetPointer(gpu_addr)}; 749 const auto host_ptr{system.GPU().MemoryManager().GetPointer(gpu_addr)};
@@ -777,11 +795,14 @@ private:
777 } 795 }
778 796
779 /** 797 /**
780 * `DeduceBestBlit` gets the a source and destination starting address and parameters, 798 * Gets the a source and destination starting address and parameters,
781 * and tries to deduce if they are supposed to be depth textures. If so, their 799 * and tries to deduce if they are supposed to be depth textures. If so, their
782 * parameters are modified and fixed into so. 800 * parameters are modified and fixed into so.
783 * @param gpu_addr, the starting address of the candidate surface. 801 *
784 * @param params, the parameters on the candidate surface. 802 * @param src_params The parameters of the candidate surface.
803 * @param dst_params The parameters of the destination surface.
804 * @param src_gpu_addr The starting address of the candidate surface.
805 * @param dst_gpu_addr The starting address of the destination surface.
785 **/ 806 **/
786 void DeduceBestBlit(SurfaceParams& src_params, SurfaceParams& dst_params, 807 void DeduceBestBlit(SurfaceParams& src_params, SurfaceParams& dst_params,
787 const GPUVAddr src_gpu_addr, const GPUVAddr dst_gpu_addr) { 808 const GPUVAddr src_gpu_addr, const GPUVAddr dst_gpu_addr) {