diff options
| author | snowstormxd <214507868+snowstormxd@users.noreply.github.com> | 2026-11-01 21:32:04 +0000 |
|---|---|---|
| committer | snowstormxd <214507868+snowstormxd@users.noreply.github.com> | 2026-11-02 18:58:54 +0000 |
| commit | b2430b4d90016eb6a221224687459c1876bc5552 (patch) | |
| tree | d0e23fa8b34294e2cd3533f5ed180af1eeaf4f11 /src/video_core/shader_cache.cpp | |
| parent | 202c6b0356e1fa9366e5b9000df35a63f1eb9dc0 (diff) | |
shader_cache: batch memory-write invalidations without skipping ranges
Adapt the batching from ymatrix1/Eglantine PR #237, retaining all CPU invalidations. Acquire the lock once and remove pending shaders once per write batch. Compare real cache contents with sequential invalidation across randomized overlapping writes and pending removals.
Assisted-by: Codex (implementation, review, commit text and automated validation)
(cherry picked from commit b65f818d7789ffadfb58fe4543b18060fd88ce53)
Diffstat (limited to 'src/video_core/shader_cache.cpp')
| -rw-r--r-- | src/video_core/shader_cache.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp index 5faed0dba9..cafebaa56f 100644 --- a/src/video_core/shader_cache.cpp +++ b/src/video_core/shader_cache.cpp @@ -36,6 +36,17 @@ void ShaderCache::InvalidateRegion(VAddr addr, size_t size) { RemovePendingShaders(); } +void ShaderCache::InvalidateRegions(std::span<const std::pair<DAddr, size_t>> sequences) { + if (sequences.empty()) { + return; + } + std::scoped_lock lock{invalidation_mutex}; + for (const auto& [addr, size] : sequences) { + InvalidatePagesInRegion(addr, size); + } + RemovePendingShaders(); +} + void ShaderCache::OnCacheInvalidation(VAddr addr, size_t size) { std::scoped_lock lock{invalidation_mutex}; InvalidatePagesInRegion(addr, size); |
