diff options
| author | 2021-06-23 08:03:01 -0400 | |
|---|---|---|
| committer | 2021-06-23 08:03:01 -0400 | |
| commit | 17fff10e06e7935522a5a69705b9a750761aab79 (patch) | |
| tree | 7e7b3ae9fedbc0fed85f6c5c58e92e8d047efd87 /src/video_core/renderer_vulkan | |
| parent | Merge pull request #6508 from ReinUsesLisp/bootmanager-stop-token (diff) | |
| parent | Reaper: Set minimum cleaning limit on OGL. (diff) | |
| download | yuzu-17fff10e06e7935522a5a69705b9a750761aab79.tar.gz yuzu-17fff10e06e7935522a5a69705b9a750761aab79.tar.xz yuzu-17fff10e06e7935522a5a69705b9a750761aab79.zip | |
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/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 52860b4cf..a2ab4d1ee 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -818,6 +818,10 @@ void TextureCacheRuntime::CopyImage(Image& dst, Image& src, | |||
| 818 | }); | 818 | }); |
| 819 | } | 819 | } |
| 820 | 820 | ||
| 821 | u64 TextureCacheRuntime::GetDeviceLocalMemory() const { | ||
| 822 | return device.GetDeviceLocalMemory(); | ||
| 823 | } | ||
| 824 | |||
| 821 | Image::Image(TextureCacheRuntime& runtime, const ImageInfo& info_, GPUVAddr gpu_addr_, | 825 | Image::Image(TextureCacheRuntime& runtime, const ImageInfo& info_, GPUVAddr gpu_addr_, |
| 822 | VAddr cpu_addr_) | 826 | VAddr cpu_addr_) |
| 823 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime.scheduler}, | 827 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime.scheduler}, |
| @@ -876,6 +880,8 @@ Image::Image(TextureCacheRuntime& runtime, const ImageInfo& info_, GPUVAddr gpu_ | |||
| 876 | } | 880 | } |
| 877 | } | 881 | } |
| 878 | 882 | ||
| 883 | Image::~Image() = default; | ||
| 884 | |||
| 879 | void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { | 885 | void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { |
| 880 | // TODO: Move this to another API | 886 | // TODO: Move this to another API |
| 881 | scheduler->RequestOutsideRenderPassOperationContext(); | 887 | scheduler->RequestOutsideRenderPassOperationContext(); |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 4a57d378b..172bcdf98 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -97,6 +97,8 @@ struct TextureCacheRuntime { | |||
| 97 | // All known Vulkan drivers can natively handle BGR textures | 97 | // All known Vulkan drivers can natively handle BGR textures |
| 98 | return true; | 98 | return true; |
| 99 | } | 99 | } |
| 100 | |||
| 101 | u64 GetDeviceLocalMemory() const; | ||
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 102 | class Image : public VideoCommon::ImageBase { | 104 | class Image : public VideoCommon::ImageBase { |
| @@ -104,6 +106,14 @@ public: | |||
| 104 | explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, | 106 | explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, |
| 105 | VAddr cpu_addr); | 107 | VAddr cpu_addr); |
| 106 | 108 | ||
| 109 | ~Image(); | ||
| 110 | |||
| 111 | Image(const Image&) = delete; | ||
| 112 | Image& operator=(const Image&) = delete; | ||
| 113 | |||
| 114 | Image(Image&&) = default; | ||
| 115 | Image& operator=(Image&&) = default; | ||
| 116 | |||
| 107 | void UploadMemory(const StagingBufferRef& map, | 117 | void UploadMemory(const StagingBufferRef& map, |
| 108 | std::span<const VideoCommon::BufferImageCopy> copies); | 118 | std::span<const VideoCommon::BufferImageCopy> copies); |
| 109 | 119 | ||
| @@ -257,6 +267,7 @@ struct TextureCacheParams { | |||
| 257 | static constexpr bool ENABLE_VALIDATION = true; | 267 | static constexpr bool ENABLE_VALIDATION = true; |
| 258 | static constexpr bool FRAMEBUFFER_BLITS = false; | 268 | static constexpr bool FRAMEBUFFER_BLITS = false; |
| 259 | static constexpr bool HAS_EMULATED_COPIES = false; | 269 | static constexpr bool HAS_EMULATED_COPIES = false; |
| 270 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; | ||
| 260 | 271 | ||
| 261 | using Runtime = Vulkan::TextureCacheRuntime; | 272 | using Runtime = Vulkan::TextureCacheRuntime; |
| 262 | using Image = Vulkan::Image; | 273 | using Image = Vulkan::Image; |