Browse Source

rework

pull/3528/head
PavelBARABANOV 3 weeks ago
parent
commit
8eb720c874
  1. 48
      src/video_core/fence_manager.h
  2. 4
      src/video_core/renderer_vulkan/vk_master_semaphore.cpp

48
src/video_core/fence_manager.h

@ -71,52 +71,58 @@ public:
uncommitted_operations.emplace_back(std::move(func)); uncommitted_operations.emplace_back(std::move(func));
} }
void SignalFence(std::function<void()>&& func) {
const bool should_flush = ShouldFlush();
const bool delay_fence = Settings::IsGPULevelHigh() || (Settings::IsGPULevelMedium() && should_flush);
void SignalFence(std::function<void()>&& func) {
#ifdef __ANDROID__ #ifdef __ANDROID__
const bool early_release_fences = Settings::values.early_release_fences.GetValue(); const bool early_release_fences = Settings::values.early_release_fences.GetValue();
#else #else
constexpr bool early_release_fences = false; constexpr bool early_release_fences = false;
#endif #endif
constexpr bool async_supported = can_async_check;
const bool should_flush = ShouldFlush();
const bool delay_fence = Settings::IsGPULevelHigh() ||
(Settings::IsGPULevelMedium() && should_flush);
CommitAsyncFlushes(); CommitAsyncFlushes();
TFence new_fence = CreateFence(!should_flush); TFence new_fence = CreateFence(!should_flush);
std::unique_lock lock(guard, std::defer_lock);
const bool needs_lock = (early_release_fences && delay_fence) ||
(!early_release_fences && async_supported);
if (needs_lock) {
lock.lock();
}
if (!delay_fence) {
if (early_release_fences) { if (early_release_fences) {
if (!delay_fence) {
TryReleasePendingFences<false>(); TryReleasePendingFences<false>();
} else if constexpr (!async_supported) {
}
if (delay_fence) {
guard.lock();
uncommitted_operations.emplace_back(std::move(func));
}
} else {
if constexpr (!can_async_check) {
TryReleasePendingFences<false>(); TryReleasePendingFences<false>();
} }
if constexpr (can_async_check) {
guard.lock();
} }
if (delay_fence) { if (delay_fence) {
uncommitted_operations.emplace_back(std::move(func)); uncommitted_operations.emplace_back(std::move(func));
} }
if (!uncommitted_operations.empty()) {
pending_operations.emplace_back(std::move(uncommitted_operations));
uncommitted_operations.clear();
} }
pending_operations.emplace_back(std::move(uncommitted_operations));
QueueFence(new_fence); QueueFence(new_fence);
if (!delay_fence) { if (!delay_fence) {
func(); func();
} }
fences.push(std::move(new_fence)); fences.push(std::move(new_fence));
if (needs_lock) {
lock.unlock();
cv.notify_all();
}
if (should_flush) { if (should_flush) {
rasterizer.FlushCommands(); rasterizer.FlushCommands();
} }
rasterizer.InvalidateGPUCache();
if (early_release_fences) {
if (delay_fence) {
guard.unlock();
cv.notify_all();
} }
} else {
if constexpr (can_async_check) {
guard.unlock();
cv.notify_all();
}
}
rasterizer.InvalidateGPUCache();
}
void SignalSyncPoint(u32 value) { void SignalSyncPoint(u32 value) {
syncpoint_manager.IncrementGuest(value); syncpoint_manager.IncrementGuest(value);

4
src/video_core/renderer_vulkan/vk_master_semaphore.cpp

@ -224,7 +224,11 @@ void MasterSemaphore::WaitThread(std::stop_token token) {
free_queue.push_front(std::move(fence)); free_queue.push_front(std::move(fence));
gpu_tick.store(host_tick); gpu_tick.store(host_tick);
} }
#ifdef ANDROID
free_cv.notify_all(); free_cv.notify_all();
#else
free_cv.notify_one();
#endif
} }
} }

Loading…
Cancel
Save