summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-04-28 23:53:46 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-04-28 23:53:46 +0200
commit2f158765240623d5aea916cafca71b86be2d6fd4 (patch)
tree394eaae3d85d20eedf248cad4c92a8bdac50cd32
parentMemoryManager: Fix race conditions. (diff)
downloadyuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.gz
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.bz2
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.lz
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.xz
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.zst
yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.zip
-rw-r--r--src/video_core/fence_manager.h1
-rw-r--r--src/video_core/query_cache.h18
2 files changed, 13 insertions, 6 deletions
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h
index 19bbdd547..3b2f6aab6 100644
--- a/src/video_core/fence_manager.h
+++ b/src/video_core/fence_manager.h
@@ -64,6 +64,7 @@ public:
}
void SignalFence(std::function<void()>&& func) {
+ rasterizer.InvalidateGPUCache();
bool delay_fence = Settings::IsGPULevelHigh();
if constexpr (!can_async_check) {
TryReleasePendingFences<false>();
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 9c6f57817..941de95c1 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -310,16 +310,22 @@ private:
std::function<void()> operation([this, new_async_job_id, timestamp] {
std::unique_lock local_lock{mutex};
AsyncJob& async_job = slot_async_jobs[new_async_job_id];
+ u64 value = async_job.value;
+ VAddr address = async_job.query_location;
+ slot_async_jobs.erase(new_async_job_id);
+ local_lock.unlock();
if (timestamp) {
u64 timestamp_value = *timestamp;
- cpu_memory.WriteBlockUnsafe(async_job.query_location + sizeof(u64),
- &timestamp_value, sizeof(8));
- cpu_memory.WriteBlockUnsafe(async_job.query_location, &async_job.value, sizeof(8));
+ cpu_memory.WriteBlockUnsafe(address + sizeof(u64), &timestamp_value, sizeof(u64));
+ cpu_memory.WriteBlockUnsafe(address, &value, sizeof(u64));
+ rasterizer.InvalidateRegion(address, sizeof(u64) * 2,
+ VideoCommon::CacheType::NoQueryCache);
} else {
- u32 small_value = static_cast<u32>(async_job.value);
- cpu_memory.WriteBlockUnsafe(async_job.query_location, &small_value, sizeof(u32));
+ u32 small_value = static_cast<u32>(value);
+ cpu_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32));
+ rasterizer.InvalidateRegion(address, sizeof(u32),
+ VideoCommon::CacheType::NoQueryCache);
}
- slot_async_jobs.erase(new_async_job_id);
});
rasterizer.SyncOperation(std::move(operation));
}