diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/rasterizer_cache.h | 17 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 3 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 3 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h index 083b283b0..4a34491a9 100644 --- a/src/video_core/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache.h @@ -17,6 +17,22 @@ template <class T> class RasterizerCache : NonCopyable { public: + /// Write any cached resources overlapping the region back to memory (if dirty) + void FlushRegion(Tegra::GPUVAddr addr, size_t size) { + if (size == 0) + return; + + const ObjectInterval interval{addr, addr + size}; + for (auto& pair : boost::make_iterator_range(object_cache.equal_range(interval))) { + for (auto& cached_object : pair.second) { + if (!cached_object) + continue; + + cached_object->Flush(); + } + } + } + /// Mark the specified region as being invalidated void InvalidateRegion(VAddr addr, u64 size) { if (size == 0) @@ -71,6 +87,7 @@ protected: void Unregister(const T& object) { auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer(); rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1); + object->Flush(); object_cache.subtract({GetInterval(object), ObjectSet{object}}); } diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 965976334..b389ca684 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -24,6 +24,9 @@ struct CachedBufferEntry final { return size; } + // We do not have to flush this cache as things in it are never modified by us. + void Flush() {} + VAddr addr; std::size_t size; GLintptr offset; diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 7bb287f56..d9157ec3c 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -33,6 +33,9 @@ public: return GLShader::MAX_PROGRAM_CODE_LENGTH * sizeof(u64); } + // We do not have to flush this cache as things in it are never modified by us. + void Flush() {} + /// Gets the shader entries for the shader const GLShader::ShaderEntries& GetShaderEntries() const { return entries; |