summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2021-06-27 09:33:58 -0400
committerGravatar GitHub2021-06-27 09:33:58 -0400
commit4df04ad48a2b9f04712ad6627e9712f3625253a9 (patch)
treef66c02d4380eaf2ce4391741edb6dda5d6b0dcde
parentMerge pull request #6532 from MerryMage/libusb-apple (diff)
parentbuffer_cache: Only flush downloaded size (diff)
downloadyuzu-4df04ad48a2b9f04712ad6627e9712f3625253a9.tar.gz
yuzu-4df04ad48a2b9f04712ad6627e9712f3625253a9.tar.xz
yuzu-4df04ad48a2b9f04712ad6627e9712f3625253a9.zip
Merge pull request #6529 from ReinUsesLisp/reaper-fixups
buffer_cache,texture_cache: Misc fixups from the memory reaper
Diffstat (limited to '')
-rw-r--r--src/video_core/CMakeLists.txt1
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h11
-rw-r--r--src/video_core/command_classes/codecs/codec.h8
-rw-r--r--src/video_core/command_classes/vic.cpp25
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp5
-rw-r--r--src/video_core/texture_cache/texture_cache.h6
6 files changed, 42 insertions, 14 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index f9454bbaa..e31eb30c0 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -293,6 +293,7 @@ endif()
293if (MSVC) 293if (MSVC)
294 target_compile_options(video_core PRIVATE 294 target_compile_options(video_core PRIVATE
295 /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data 295 /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
296 /we4244 # 'var' : conversion from integer to 'type', possible loss of data
296 /we4456 # Declaration of 'identifier' hides previous local declaration 297 /we4456 # Declaration of 'identifier' hides previous local declaration
297 /we4457 # Declaration of 'identifier' hides function parameter 298 /we4457 # Declaration of 'identifier' hides function parameter
298 /we4458 # Declaration of 'identifier' hides class member 299 /we4458 # Declaration of 'identifier' hides class member
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 9d726a6fb..cad7f902d 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -99,7 +99,7 @@ class BufferCache {
99 }; 99 };
100 100
101public: 101public:
102 static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4_KiB; 102 static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = static_cast<u32>(4_KiB);
103 103
104 explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_, 104 explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_,
105 Tegra::Engines::Maxwell3D& maxwell3d_, 105 Tegra::Engines::Maxwell3D& maxwell3d_,
@@ -109,8 +109,6 @@ public:
109 109
110 void TickFrame(); 110 void TickFrame();
111 111
112 void RunGarbageCollector();
113
114 void WriteMemory(VAddr cpu_addr, u64 size); 112 void WriteMemory(VAddr cpu_addr, u64 size);
115 113
116 void CachedWriteMemory(VAddr cpu_addr, u64 size); 114 void CachedWriteMemory(VAddr cpu_addr, u64 size);
@@ -197,6 +195,8 @@ private:
197 ((cpu_addr + size) & ~Core::Memory::PAGE_MASK); 195 ((cpu_addr + size) & ~Core::Memory::PAGE_MASK);
198 } 196 }
199 197
198 void RunGarbageCollector();
199
200 void BindHostIndexBuffer(); 200 void BindHostIndexBuffer();
201 201
202 void BindHostVertexBuffers(); 202 void BindHostVertexBuffers();
@@ -416,8 +416,9 @@ void BufferCache<P>::CachedWriteMemory(VAddr cpu_addr, u64 size) {
416 416
417template <class P> 417template <class P>
418void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { 418void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) {
419 ForEachBufferInRange(cpu_addr, size, 419 ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) {
420 [&](BufferId, Buffer& buffer) { DownloadBufferMemory(buffer); }); 420 DownloadBufferMemory(buffer, cpu_addr, size);
421 });
421} 422}
422 423
423template <class P> 424template <class P>
diff --git a/src/video_core/command_classes/codecs/codec.h b/src/video_core/command_classes/codecs/codec.h
index 8a2a6c360..3e135a2a6 100644
--- a/src/video_core/command_classes/codecs/codec.h
+++ b/src/video_core/command_classes/codecs/codec.h
@@ -14,10 +14,18 @@ extern "C" {
14#pragma GCC diagnostic push 14#pragma GCC diagnostic push
15#pragma GCC diagnostic ignored "-Wconversion" 15#pragma GCC diagnostic ignored "-Wconversion"
16#endif 16#endif
17#ifdef _MSC_VER
18#pragma warning(push)
19#pragma warning(disable : 4242) // conversion from 'type' to 'type', possible loss of data
20#pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data
21#endif
17#include <libavcodec/avcodec.h> 22#include <libavcodec/avcodec.h>
18#if defined(__GNUC__) || defined(__clang__) 23#if defined(__GNUC__) || defined(__clang__)
19#pragma GCC diagnostic pop 24#pragma GCC diagnostic pop
20#endif 25#endif
26#ifdef _MSC_VER
27#pragma warning(pop)
28#endif
21} 29}
22 30
23namespace Tegra { 31namespace Tegra {
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp
index 0a8b82f2b..5faf8c0f1 100644
--- a/src/video_core/command_classes/vic.cpp
+++ b/src/video_core/command_classes/vic.cpp
@@ -3,7 +3,28 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array> 5#include <array>
6
7extern "C" {
8#if defined(__GNUC__) || defined(__clang__)
9#pragma GCC diagnostic push
10#pragma GCC diagnostic ignored "-Wconversion"
11#endif
12#ifdef _MSC_VER
13#pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data
14#pragma warning(push)
15#endif
16#include <libswscale/swscale.h>
17#if defined(__GNUC__) || defined(__clang__)
18#pragma GCC diagnostic pop
19#endif
20#ifdef _MSC_VER
21#pragma warning(pop)
22#endif
23}
24
6#include "common/assert.h" 25#include "common/assert.h"
26#include "common/logging/log.h"
27
7#include "video_core/command_classes/nvdec.h" 28#include "video_core/command_classes/nvdec.h"
8#include "video_core/command_classes/vic.h" 29#include "video_core/command_classes/vic.h"
9#include "video_core/engines/maxwell_3d.h" 30#include "video_core/engines/maxwell_3d.h"
@@ -11,10 +32,6 @@
11#include "video_core/memory_manager.h" 32#include "video_core/memory_manager.h"
12#include "video_core/textures/decoders.h" 33#include "video_core/textures/decoders.h"
13 34
14extern "C" {
15#include <libswscale/swscale.h>
16}
17
18namespace Tegra { 35namespace Tegra {
19 36
20Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_) 37Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_)
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
index 8cb65e588..0df4e1a1c 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
@@ -55,8 +55,9 @@ size_t BytesPerIndex(VkIndexType index_type) {
55template <typename T> 55template <typename T>
56std::array<T, 6> MakeQuadIndices(u32 quad, u32 first) { 56std::array<T, 6> MakeQuadIndices(u32 quad, u32 first) {
57 std::array<T, 6> indices{0, 1, 2, 0, 2, 3}; 57 std::array<T, 6> indices{0, 1, 2, 0, 2, 3};
58 std::ranges::transform(indices, indices.begin(), 58 for (T& index : indices) {
59 [quad, first](u32 index) { return first + index + quad * 4; }); 59 index = static_cast<T>(first + index + quad * 4);
60 }
60 return indices; 61 return indices;
61} 62}
62} // Anonymous namespace 63} // Anonymous namespace
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 84530a179..c7cfd02b6 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -110,9 +110,6 @@ public:
110 /// Notify the cache that a new frame has been queued 110 /// Notify the cache that a new frame has been queued
111 void TickFrame(); 111 void TickFrame();
112 112
113 /// Runs the Garbage Collector.
114 void RunGarbageCollector();
115
116 /// Return a constant reference to the given image view id 113 /// Return a constant reference to the given image view id
117 [[nodiscard]] const ImageView& GetImageView(ImageViewId id) const noexcept; 114 [[nodiscard]] const ImageView& GetImageView(ImageViewId id) const noexcept;
118 115
@@ -207,6 +204,9 @@ private:
207 } 204 }
208 } 205 }
209 206
207 /// Runs the Garbage Collector.
208 void RunGarbageCollector();
209
210 /// Fills image_view_ids in the image views in indices 210 /// Fills image_view_ids in the image views in indices
211 void FillImageViews(DescriptorTable<TICEntry>& table, 211 void FillImageViews(DescriptorTable<TICEntry>& table,
212 std::span<ImageViewId> cached_image_view_ids, std::span<const u32> indices, 212 std::span<ImageViewId> cached_image_view_ids, std::span<const u32> indices,