Skip to content
Snippets Groups Projects
Commit 57fdbd9b authored by Fernando Sahmkow's avatar Fernando Sahmkow
Browse files

FenceManager: Implement should wait.

parent 1f345ebe
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,10 @@ public:
void WaitPendingFences() {
while (!fences.empty()) {
TFence& current_fence = fences.front();
WaitFence(current_fence);
bool should_wait = texture_cache.ShouldWaitAsyncFlushes();
if (should_wait) {
WaitFence(current_fence);
}
texture_cache.PopAsyncFlushes();
auto& gpu{system.GPU()};
auto& memory_manager{gpu.MemoryManager()};
......@@ -80,7 +83,8 @@ private:
void TryReleasePendingFences() {
while (!fences.empty()) {
TFence& current_fence = fences.front();
if (!IsFenceSignaled(current_fence)) {
bool should_wait = texture_cache.ShouldWaitAsyncFlushes();
if (should_wait && !IsFenceSignaled(current_fence)) {
return;
}
texture_cache.PopAsyncFlushes();
......
......@@ -322,6 +322,17 @@ public:
uncommited_flushes.reset();
}
bool ShouldWaitAsyncFlushes() {
if (commited_flushes.empty()) {
return false;
}
auto& flush_list = commited_flushes.front();
if (!flush_list) {
return false;
}
return true;
}
void PopAsyncFlushes() {
if (commited_flushes.empty()) {
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment