diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-13 18:28:22 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-14 21:38:27 +0100 |
commit | cc0694559fd7084221540d595edb228f8267a96c (patch) | |
tree | 6503b51a9cf99bc980fc31e24823777c94fbe167 /src/video_core/query_cache.h | |
parent | vk_query_cache: Implement generic query cache on Vulkan (diff) | |
download | yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar.gz yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar.bz2 yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar.lz yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar.xz yuzu-cc0694559fd7084221540d595edb228f8267a96c.tar.zst yuzu-cc0694559fd7084221540d595edb228f8267a96c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/query_cache.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 069032121..86f5aade1 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -9,6 +9,7 @@ #include <cstring> #include <iterator> #include <memory> +#include <mutex> #include <optional> #include <unordered_map> #include <vector> @@ -98,10 +99,12 @@ public: VideoCore::QueryType::SamplesPassed}}} {} void InvalidateRegion(CacheAddr addr, std::size_t size) { + std::unique_lock lock{mutex}; FlushAndRemoveRegion(addr, size); } void FlushRegion(CacheAddr addr, std::size_t size) { + std::unique_lock lock{mutex}; FlushAndRemoveRegion(addr, size); } @@ -112,6 +115,7 @@ public: * @param timestamp Timestamp, when empty the flushed query is assumed to be short. */ void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) { + std::unique_lock lock{mutex}; auto& memory_manager = system.GPU().MemoryManager(); const auto host_ptr = memory_manager.GetPointer(gpu_addr); @@ -219,6 +223,8 @@ private: Core::System& system; VideoCore::RasterizerInterface& rasterizer; + std::recursive_mutex mutex; + std::unordered_map<u64, std::vector<CachedQuery>> cached_queries; std::array<CounterStream, VideoCore::NumQueryTypes> streams; |