summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-05-11 05:50:01 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-06-21 02:36:12 +0200
commit07cc7e0c12143a84744abb8dc03eb46eb615b308 (patch)
treedb17a059f3cd8fb1827bf6d5f231f9446b1914f3 /src/video_core
parentRemove Framebuffer reconfiguration and restrict rendertarget protection (diff)
downloadyuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar.gz
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar.bz2
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar.lz
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar.xz
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.tar.zst
yuzu-07cc7e0c12143a84744abb8dc03eb46eb615b308.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/texture_cache/texture_cache.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 4ac5668c8..1b8ada910 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -5,6 +5,7 @@
#pragma once
#include <memory>
+#include <mutex>
#include <set>
#include <tuple>
#include <unordered_map>
@@ -56,12 +57,16 @@ public:
}
void InvalidateRegion(CacheAddr addr, std::size_t size) {
+ std::lock_guard lock{mutex};
+
for (const auto& surface : GetSurfacesInRegion(addr, size)) {
Unregister(surface);
}
}
void FlushRegion(CacheAddr addr, std::size_t size) {
+ std::lock_guard lock{mutex};
+
auto surfaces = GetSurfacesInRegion(addr, size);
if (surfaces.empty()) {
return;
@@ -220,6 +225,8 @@ protected:
const Common::Rectangle<u32>& dst_rect) = 0;
void Register(TSurface surface) {
+ std::lock_guard lock{mutex};
+
const GPUVAddr gpu_addr = surface->GetGpuAddr();
const CacheAddr cache_ptr = ToCacheAddr(memory_manager->GetPointer(gpu_addr));
const std::size_t size = surface->GetSizeInBytes();
@@ -237,6 +244,8 @@ protected:
}
void Unregister(TSurface surface) {
+ std::lock_guard lock{mutex};
+
if (surface->IsProtected()) {
return;
}
@@ -579,6 +588,7 @@ private:
FramebufferTargetInfo depth_buffer;
std::vector<u8> staging_buffer;
+ std::recursive_mutex mutex;
};
} // namespace VideoCommon