mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 15:32:52 +00:00
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:
parent
7c7b85ed7f
commit
cb5f8e73a1
@ -161,10 +161,6 @@ int VideoOutDriver::UnregisterBuffers(VideoOutPort* port, s32 attributeIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::microseconds VideoOutDriver::Flip(const Request& req) {
|
std::chrono::microseconds VideoOutDriver::Flip(const Request& req) {
|
||||||
if (!req) {
|
|
||||||
return std::chrono::microseconds{0};
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto start = std::chrono::high_resolution_clock::now();
|
const auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
// Whatever the game is rendering show splash if it is active
|
// 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);
|
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 VideoOutDriver::SubmitFlip(VideoOutPort* port, s32 index, s64 flip_arg,
|
||||||
bool is_eop /*= false*/) {
|
bool is_eop /*= false*/) {
|
||||||
{
|
{
|
||||||
@ -283,7 +284,14 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
|
|||||||
auto& vblank_status = main_port.vblank_status;
|
auto& vblank_status = main_port.vblank_status;
|
||||||
if (vblank_status.count % (main_port.flip_rate + 1) == 0) {
|
if (vblank_status.count % (main_port.flip_rate + 1) == 0) {
|
||||||
const auto request = receive_request();
|
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;
|
FRAME_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::chrono::microseconds Flip(const Request& req);
|
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 SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_arg, bool is_eop = false);
|
||||||
void PresentThread(std::stop_token token);
|
void PresentThread(std::stop_token token);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user