keep framerate stable even without vsync (#2165)

This commit is contained in:
Vinicius Rangel 2025-01-16 21:10:17 -03:00 committed by GitHub
parent 56a6c95730
commit 8695383d35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 38 additions and 17 deletions

View file

@ -9,6 +9,7 @@
#include "core/libraries/kernel/time.h"
#include "core/libraries/videoout/driver.h"
#include "core/libraries/videoout/videoout_error.h"
#include "imgui/renderer/imgui_core.h"
#include "video_core/renderer_vulkan/vk_presenter.h"
extern std::unique_ptr<Vulkan::Presenter> presenter;
@ -297,10 +298,12 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
if (vblank_status.count % (main_port.flip_rate + 1) == 0) {
const auto request = receive_request();
if (!request) {
if (!main_port.is_open) {
DrawBlankFrame();
} else {
DrawLastFrame();
if (timer.GetTotalWait().count() < 0) { // Dont draw too fast
if (!main_port.is_open) {
DrawBlankFrame();
} else if (ImGui::Core::MustKeepDrawing()) {
DrawLastFrame();
}
}
} else {
Flip(request);