diff options
| author | 2023-04-28 23:53:46 +0200 | |
|---|---|---|
| committer | 2023-04-28 23:53:46 +0200 | |
| commit | 2f158765240623d5aea916cafca71b86be2d6fd4 (patch) | |
| tree | 394eaae3d85d20eedf248cad4c92a8bdac50cd32 /src | |
| parent | MemoryManager: Fix race conditions. (diff) | |
| download | yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.gz yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.tar.xz yuzu-2f158765240623d5aea916cafca71b86be2d6fd4.zip | |
QueryCache: Fix write invalidation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/fence_manager.h | 1 | ||||
| -rw-r--r-- | src/video_core/query_cache.h | 18 |
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: | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void SignalFence(std::function<void()>&& func) { | 66 | void SignalFence(std::function<void()>&& func) { |
| 67 | rasterizer.InvalidateGPUCache(); | ||
| 67 | bool delay_fence = Settings::IsGPULevelHigh(); | 68 | bool delay_fence = Settings::IsGPULevelHigh(); |
| 68 | if constexpr (!can_async_check) { | 69 | if constexpr (!can_async_check) { |
| 69 | TryReleasePendingFences<false>(); | 70 | 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: | |||
| 310 | std::function<void()> operation([this, new_async_job_id, timestamp] { | 310 | std::function<void()> operation([this, new_async_job_id, timestamp] { |
| 311 | std::unique_lock local_lock{mutex}; | 311 | std::unique_lock local_lock{mutex}; |
| 312 | AsyncJob& async_job = slot_async_jobs[new_async_job_id]; | 312 | AsyncJob& async_job = slot_async_jobs[new_async_job_id]; |
| 313 | u64 value = async_job.value; | ||
| 314 | VAddr address = async_job.query_location; | ||
| 315 | slot_async_jobs.erase(new_async_job_id); | ||
| 316 | local_lock.unlock(); | ||
| 313 | if (timestamp) { | 317 | if (timestamp) { |
| 314 | u64 timestamp_value = *timestamp; | 318 | u64 timestamp_value = *timestamp; |
| 315 | cpu_memory.WriteBlockUnsafe(async_job.query_location + sizeof(u64), | 319 | cpu_memory.WriteBlockUnsafe(address + sizeof(u64), ×tamp_value, sizeof(u64)); |
| 316 | ×tamp_value, sizeof(8)); | 320 | cpu_memory.WriteBlockUnsafe(address, &value, sizeof(u64)); |
| 317 | cpu_memory.WriteBlockUnsafe(async_job.query_location, &async_job.value, sizeof(8)); | 321 | rasterizer.InvalidateRegion(address, sizeof(u64) * 2, |
| 322 | VideoCommon::CacheType::NoQueryCache); | ||
| 318 | } else { | 323 | } else { |
| 319 | u32 small_value = static_cast<u32>(async_job.value); | 324 | u32 small_value = static_cast<u32>(value); |
| 320 | cpu_memory.WriteBlockUnsafe(async_job.query_location, &small_value, sizeof(u32)); | 325 | cpu_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32)); |
| 326 | rasterizer.InvalidateRegion(address, sizeof(u32), | ||
| 327 | VideoCommon::CacheType::NoQueryCache); | ||
| 321 | } | 328 | } |
| 322 | slot_async_jobs.erase(new_async_job_id); | ||
| 323 | }); | 329 | }); |
| 324 | rasterizer.SyncOperation(std::move(operation)); | 330 | rasterizer.SyncOperation(std::move(operation)); |
| 325 | } | 331 | } |