FenceManager: Implement should wait.
This commit is contained in:
parent
1f345ebe3a
commit
57fdbd9b89
2 changed files with 17 additions and 2 deletions
|
@ -53,7 +53,10 @@ public:
|
||||||
void WaitPendingFences() {
|
void WaitPendingFences() {
|
||||||
while (!fences.empty()) {
|
while (!fences.empty()) {
|
||||||
TFence& current_fence = fences.front();
|
TFence& current_fence = fences.front();
|
||||||
WaitFence(current_fence);
|
bool should_wait = texture_cache.ShouldWaitAsyncFlushes();
|
||||||
|
if (should_wait) {
|
||||||
|
WaitFence(current_fence);
|
||||||
|
}
|
||||||
texture_cache.PopAsyncFlushes();
|
texture_cache.PopAsyncFlushes();
|
||||||
auto& gpu{system.GPU()};
|
auto& gpu{system.GPU()};
|
||||||
auto& memory_manager{gpu.MemoryManager()};
|
auto& memory_manager{gpu.MemoryManager()};
|
||||||
|
@ -80,7 +83,8 @@ private:
|
||||||
void TryReleasePendingFences() {
|
void TryReleasePendingFences() {
|
||||||
while (!fences.empty()) {
|
while (!fences.empty()) {
|
||||||
TFence& current_fence = fences.front();
|
TFence& current_fence = fences.front();
|
||||||
if (!IsFenceSignaled(current_fence)) {
|
bool should_wait = texture_cache.ShouldWaitAsyncFlushes();
|
||||||
|
if (should_wait && !IsFenceSignaled(current_fence)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
texture_cache.PopAsyncFlushes();
|
texture_cache.PopAsyncFlushes();
|
||||||
|
|
|
@ -322,6 +322,17 @@ public:
|
||||||
uncommited_flushes.reset();
|
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() {
|
void PopAsyncFlushes() {
|
||||||
if (commited_flushes.empty()) {
|
if (commited_flushes.empty()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue