diff options
| -rw-r--r-- | src/video_core/rasterizer_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_global_cache.h | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 9 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 6 |
6 files changed, 26 insertions, 17 deletions
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h index 291772186..f820f3ed9 100644 --- a/src/video_core/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache.h | |||
| @@ -37,9 +37,6 @@ public: | |||
| 37 | /// Gets the size of the shader in guest memory, required for cache management | 37 | /// Gets the size of the shader in guest memory, required for cache management |
| 38 | virtual std::size_t GetSizeInBytes() const = 0; | 38 | virtual std::size_t GetSizeInBytes() const = 0; |
| 39 | 39 | ||
| 40 | /// Wriets any cached resources back to memory | ||
| 41 | virtual void Flush() = 0; | ||
| 42 | |||
| 43 | /// Sets whether the cached object should be considered registered | 40 | /// Sets whether the cached object should be considered registered |
| 44 | void SetIsRegistered(bool registered) { | 41 | void SetIsRegistered(bool registered) { |
| 45 | is_registered = registered; | 42 | is_registered = registered; |
| @@ -158,6 +155,8 @@ protected: | |||
| 158 | return ++modified_ticks; | 155 | return ++modified_ticks; |
| 159 | } | 156 | } |
| 160 | 157 | ||
| 158 | virtual void FlushObjectInner(const T& object) = 0; | ||
| 159 | |||
| 161 | /// Flushes the specified object, updating appropriate cache state as needed | 160 | /// Flushes the specified object, updating appropriate cache state as needed |
| 162 | void FlushObject(const T& object) { | 161 | void FlushObject(const T& object) { |
| 163 | std::lock_guard lock{mutex}; | 162 | std::lock_guard lock{mutex}; |
| @@ -165,7 +164,7 @@ protected: | |||
| 165 | if (!object->IsDirty()) { | 164 | if (!object->IsDirty()) { |
| 166 | return; | 165 | return; |
| 167 | } | 166 | } |
| 168 | object->Flush(); | 167 | FlushObjectInner(object); |
| 169 | object->MarkAsModified(false, *this); | 168 | object->MarkAsModified(false, *this); |
| 170 | } | 169 | } |
| 171 | 170 | ||
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index fc33aa433..f9247a40e 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -42,9 +42,6 @@ public: | |||
| 42 | return alignment; | 42 | return alignment; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 46 | void Flush() override {} | ||
| 47 | |||
| 48 | private: | 45 | private: |
| 49 | VAddr cpu_addr{}; | 46 | VAddr cpu_addr{}; |
| 50 | std::size_t size{}; | 47 | std::size_t size{}; |
| @@ -75,6 +72,9 @@ public: | |||
| 75 | protected: | 72 | protected: |
| 76 | void AlignBuffer(std::size_t alignment); | 73 | void AlignBuffer(std::size_t alignment); |
| 77 | 74 | ||
| 75 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 76 | void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {} | ||
| 77 | |||
| 78 | private: | 78 | private: |
| 79 | OGLStreamBuffer stream_buffer; | 79 | OGLStreamBuffer stream_buffer; |
| 80 | 80 | ||
diff --git a/src/video_core/renderer_opengl/gl_global_cache.h b/src/video_core/renderer_opengl/gl_global_cache.h index 196e6e278..3211f0112 100644 --- a/src/video_core/renderer_opengl/gl_global_cache.h +++ b/src/video_core/renderer_opengl/gl_global_cache.h | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | /// Reloads the global region from guest memory | 46 | /// Reloads the global region from guest memory |
| 47 | void Reload(u32 size_); | 47 | void Reload(u32 size_); |
| 48 | 48 | ||
| 49 | void Flush() override; | 49 | void Flush(); |
| 50 | 50 | ||
| 51 | private: | 51 | private: |
| 52 | VAddr cpu_addr{}; | 52 | VAddr cpu_addr{}; |
| @@ -65,6 +65,12 @@ public: | |||
| 65 | GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor, | 65 | GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor, |
| 66 | Tegra::Engines::Maxwell3D::Regs::ShaderStage stage); | 66 | Tegra::Engines::Maxwell3D::Regs::ShaderStage stage); |
| 67 | 67 | ||
| 68 | protected: | ||
| 69 | |||
| 70 | void FlushObjectInner(const GlobalRegion& object) override { | ||
| 71 | object->Flush(); | ||
| 72 | } | ||
| 73 | |||
| 68 | private: | 74 | private: |
| 69 | GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const; | 75 | GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const; |
| 70 | GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size); | 76 | GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index db280dbb3..4b21c555f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -371,10 +371,6 @@ public: | |||
| 371 | return memory_size; | 371 | return memory_size; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | void Flush() override { | ||
| 375 | FlushGLBuffer(); | ||
| 376 | } | ||
| 377 | |||
| 378 | const OGLTexture& Texture() const { | 374 | const OGLTexture& Texture() const { |
| 379 | return texture; | 375 | return texture; |
| 380 | } | 376 | } |
| @@ -473,6 +469,11 @@ public: | |||
| 473 | void SignalPreDrawCall(); | 469 | void SignalPreDrawCall(); |
| 474 | void SignalPostDrawCall(); | 470 | void SignalPostDrawCall(); |
| 475 | 471 | ||
| 472 | protected: | ||
| 473 | void FlushObjectInner(const Surface& object) override { | ||
| 474 | object->FlushGLBuffer(); | ||
| 475 | } | ||
| 476 | |||
| 476 | private: | 477 | private: |
| 477 | void LoadSurface(const Surface& surface); | 478 | void LoadSurface(const Surface& surface); |
| 478 | Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true); | 479 | Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true); |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 0cf8e0b3d..eae771c08 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h | |||
| @@ -56,9 +56,6 @@ public: | |||
| 56 | return shader_length; | 56 | return shader_length; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 60 | void Flush() override {} | ||
| 61 | |||
| 62 | /// Gets the shader entries for the shader | 59 | /// Gets the shader entries for the shader |
| 63 | const GLShader::ShaderEntries& GetShaderEntries() const { | 60 | const GLShader::ShaderEntries& GetShaderEntries() const { |
| 64 | return entries; | 61 | return entries; |
| @@ -121,6 +118,10 @@ public: | |||
| 121 | /// Gets the current specified shader stage program | 118 | /// Gets the current specified shader stage program |
| 122 | Shader GetStageProgram(Maxwell::ShaderProgram program); | 119 | Shader GetStageProgram(Maxwell::ShaderProgram program); |
| 123 | 120 | ||
| 121 | protected: | ||
| 122 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 123 | void FlushObjectInner(const Shader& object) override {} | ||
| 124 | |||
| 124 | private: | 125 | private: |
| 125 | std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders( | 126 | std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders( |
| 126 | const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback, | 127 | const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback, |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 08b786aad..5082f86b6 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -49,8 +49,6 @@ public: | |||
| 49 | return alignment; | 49 | return alignment; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 53 | void Flush() override {} | ||
| 54 | 52 | ||
| 55 | private: | 53 | private: |
| 56 | VAddr cpu_addr{}; | 54 | VAddr cpu_addr{}; |
| @@ -87,6 +85,10 @@ public: | |||
| 87 | return buffer_handle; | 85 | return buffer_handle; |
| 88 | } | 86 | } |
| 89 | 87 | ||
| 88 | protected: | ||
| 89 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 90 | void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {} | ||
| 91 | |||
| 90 | private: | 92 | private: |
| 91 | void AlignBuffer(std::size_t alignment); | 93 | void AlignBuffer(std::size_t alignment); |
| 92 | 94 | ||