aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache/image_base.h
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2021-06-23 08:03:01 -0400
committerGitHub <noreply@github.com>2021-06-23 08:03:01 -0400
commit17fff10e06e7935522a5a69705b9a750761aab79 (patch)
tree7e7b3ae9fedbc0fed85f6c5c58e92e8d047efd87 /src/video_core/texture_cache/image_base.h
parent20f474b09ab503607fab651342bcee433d117c80 (diff)
parentf9b940a442d50875d2b45a0f2f380ccad88670da (diff)
Merge pull request #6465 from FernandoS27/sex-on-the-beach
GPU: Implement a garbage collector for GPU Caches (project Reaper+)
Diffstat (limited to 'src/video_core/texture_cache/image_base.h')
-rw-r--r--src/video_core/texture_cache/image_base.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/image_base.h b/src/video_core/texture_cache/image_base.h
index b7f3b7e43..e326cab71 100644
--- a/src/video_core/texture_cache/image_base.h
+++ b/src/video_core/texture_cache/image_base.h
@@ -25,6 +25,12 @@ enum class ImageFlagBits : u32 {
Strong = 1 << 5, ///< Exists in the image table, the dimensions are can be trusted
Registered = 1 << 6, ///< True when the image is registered
Picked = 1 << 7, ///< Temporary flag to mark the image as picked
+
+ // Garbage Collection Flags
+ BadOverlap = 1 << 8, ///< This image overlaps other but doesn't fit, has higher
+ ///< garbage collection priority
+ Alias = 1 << 9, ///< This image has aliases and has priority on garbage
+ ///< collection
};
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
@@ -44,11 +50,16 @@ struct ImageBase {
void InsertView(const ImageViewInfo& view_info, ImageViewId image_view_id);
+ [[nodiscard]] bool IsSafeDownload() const noexcept;
+
[[nodiscard]] bool Overlaps(VAddr overlap_cpu_addr, size_t overlap_size) const noexcept {
const VAddr overlap_end = overlap_cpu_addr + overlap_size;
return cpu_addr < overlap_end && overlap_cpu_addr < cpu_addr_end;
}
+ void CheckBadOverlapState();
+ void CheckAliasState();
+
ImageInfo info;
u32 guest_size_bytes = 0;
@@ -72,6 +83,7 @@ struct ImageBase {
std::vector<SubresourceBase> slice_subresources;
std::vector<AliasedImage> aliased_images;
+ std::vector<ImageId> overlapping_images;
};
struct ImageAllocBase {