videoout: render blank frame when video output is closed

required to render imgui even when game has no video output

- fixed merge compile-error
This commit is contained in:
Vinicius Rangel 2024-09-03 14:37:21 -03:00
parent 7c7b85ed7f
commit cb5f8e73a1
No known key found for this signature in database
GPG key ID: A5B154D904B761D9
2 changed files with 14 additions and 5 deletions

View file

@ -161,10 +161,6 @@ int VideoOutDriver::UnregisterBuffers(VideoOutPort* port, s32 attributeIndex) {
}
std::chrono::microseconds VideoOutDriver::Flip(const Request& req) {
if (!req) {
return std::chrono::microseconds{0};
}
const auto start = std::chrono::high_resolution_clock::now();
// Whatever the game is rendering show splash if it is active
@ -207,6 +203,11 @@ std::chrono::microseconds VideoOutDriver::Flip(const Request& req) {
return std::chrono::duration_cast<std::chrono::microseconds>(end - start);
}
void VideoOutDriver::DrawBlankFrame() {
const auto empty_frame = renderer->PrepareBlankFrame(false);
renderer->Present(empty_frame);
}
bool VideoOutDriver::SubmitFlip(VideoOutPort* port, s32 index, s64 flip_arg,
bool is_eop /*= false*/) {
{
@ -283,7 +284,14 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
auto& vblank_status = main_port.vblank_status;
if (vblank_status.count % (main_port.flip_rate + 1) == 0) {
const auto request = receive_request();
delay = Flip(request);
if (!request) {
delay = std::chrono::microseconds{0};
if (!main_port.is_open) {
DrawBlankFrame();
}
} else {
delay = Flip(request);
}
FRAME_END;
}

View file

@ -102,6 +102,7 @@ private:
};
std::chrono::microseconds Flip(const Request& req);
void DrawBlankFrame(); // Used when there is no flip request to keep ImGui up to date
void SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_arg, bool is_eop = false);
void PresentThread(std::stop_token token);