diff options
| author | 2020-04-16 12:29:53 -0400 | |
|---|---|---|
| committer | 2020-04-22 11:36:24 -0400 | |
| commit | f616dc0b591b783b3fb75ca89633f1c26cce05a9 (patch) | |
| tree | 43a9c2052c5ceaad8cf6a69173b0817e54cc8f42 /src/video_core/texture_cache | |
| parent | Fix GCC error. (diff) | |
| download | yuzu-f616dc0b591b783b3fb75ca89633f1c26cce05a9.tar.gz yuzu-f616dc0b591b783b3fb75ca89633f1c26cce05a9.tar.xz yuzu-f616dc0b591b783b3fb75ca89633f1c26cce05a9.zip | |
Address Feedback.
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index f3ca1ffd1..1148c3a34 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -120,15 +120,8 @@ public: | |||
| 120 | std::lock_guard lock{mutex}; | 120 | std::lock_guard lock{mutex}; |
| 121 | 121 | ||
| 122 | auto surfaces = GetSurfacesInRegion(addr, size); | 122 | auto surfaces = GetSurfacesInRegion(addr, size); |
| 123 | if (surfaces.empty()) { | 123 | return std::any_of(surfaces.begin(), surfaces.end(), |
| 124 | return false; | 124 | [](const TSurface& surface) { return surface->IsModified(); }); |
| 125 | } | ||
| 126 | for (const auto& surface : surfaces) { | ||
| 127 | if (surface->IsModified()) { | ||
| 128 | return true; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | return false; | ||
| 132 | } | 125 | } |
| 133 | 126 | ||
| 134 | TView GetTextureSurface(const Tegra::Texture::TICEntry& tic, | 127 | TView GetTextureSurface(const Tegra::Texture::TICEntry& tic, |
| @@ -333,41 +326,34 @@ public: | |||
| 333 | } | 326 | } |
| 334 | 327 | ||
| 335 | void CommitAsyncFlushes() { | 328 | void CommitAsyncFlushes() { |
| 336 | commited_flushes.push_back(uncommited_flushes); | 329 | committed_flushes.push_back(uncommitted_flushes); |
| 337 | uncommited_flushes.reset(); | 330 | uncommitted_flushes.reset(); |
| 338 | } | 331 | } |
| 339 | 332 | ||
| 340 | bool HasUncommitedFlushes() { | 333 | bool HasUncommittedFlushes() const { |
| 341 | if (uncommited_flushes) { | 334 | return uncommitted_flushes != nullptr; |
| 342 | return true; | ||
| 343 | } | ||
| 344 | return false; | ||
| 345 | } | 335 | } |
| 346 | 336 | ||
| 347 | bool ShouldWaitAsyncFlushes() { | 337 | bool ShouldWaitAsyncFlushes() const { |
| 348 | if (commited_flushes.empty()) { | 338 | if (committed_flushes.empty()) { |
| 349 | return false; | ||
| 350 | } | ||
| 351 | auto& flush_list = commited_flushes.front(); | ||
| 352 | if (!flush_list) { | ||
| 353 | return false; | 339 | return false; |
| 354 | } | 340 | } |
| 355 | return true; | 341 | return committed_flushes.front() != nullptr; |
| 356 | } | 342 | } |
| 357 | 343 | ||
| 358 | void PopAsyncFlushes() { | 344 | void PopAsyncFlushes() { |
| 359 | if (commited_flushes.empty()) { | 345 | if (committed_flushes.empty()) { |
| 360 | return; | 346 | return; |
| 361 | } | 347 | } |
| 362 | auto& flush_list = commited_flushes.front(); | 348 | auto& flush_list = committed_flushes.front(); |
| 363 | if (!flush_list) { | 349 | if (!flush_list) { |
| 364 | commited_flushes.pop_front(); | 350 | committed_flushes.pop_front(); |
| 365 | return; | 351 | return; |
| 366 | } | 352 | } |
| 367 | for (TSurface& surface : *flush_list) { | 353 | for (TSurface& surface : *flush_list) { |
| 368 | FlushSurface(surface); | 354 | FlushSurface(surface); |
| 369 | } | 355 | } |
| 370 | commited_flushes.pop_front(); | 356 | committed_flushes.pop_front(); |
| 371 | } | 357 | } |
| 372 | 358 | ||
| 373 | protected: | 359 | protected: |
| @@ -1206,10 +1192,10 @@ private: | |||
| 1206 | }; | 1192 | }; |
| 1207 | 1193 | ||
| 1208 | void AsyncFlushSurface(TSurface& surface) { | 1194 | void AsyncFlushSurface(TSurface& surface) { |
| 1209 | if (!uncommited_flushes) { | 1195 | if (!uncommitted_flushes) { |
| 1210 | uncommited_flushes = std::make_shared<std::list<TSurface>>(); | 1196 | uncommitted_flushes = std::make_shared<std::list<TSurface>>(); |
| 1211 | } | 1197 | } |
| 1212 | uncommited_flushes->push_back(surface); | 1198 | uncommitted_flushes->push_back(surface); |
| 1213 | } | 1199 | } |
| 1214 | 1200 | ||
| 1215 | VideoCore::RasterizerInterface& rasterizer; | 1201 | VideoCore::RasterizerInterface& rasterizer; |
| @@ -1258,8 +1244,8 @@ private: | |||
| 1258 | 1244 | ||
| 1259 | std::list<TSurface> marked_for_unregister; | 1245 | std::list<TSurface> marked_for_unregister; |
| 1260 | 1246 | ||
| 1261 | std::shared_ptr<std::list<TSurface>> uncommited_flushes{}; | 1247 | std::shared_ptr<std::list<TSurface>> uncommitted_flushes{}; |
| 1262 | std::list<std::shared_ptr<std::list<TSurface>>> commited_flushes; | 1248 | std::list<std::shared_ptr<std::list<TSurface>>> committed_flushes; |
| 1263 | 1249 | ||
| 1264 | StagingCache staging_cache; | 1250 | StagingCache staging_cache; |
| 1265 | std::recursive_mutex mutex; | 1251 | std::recursive_mutex mutex; |