mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-05 18:23:16 +00:00
Render without rendering (#2152)
* presenter: render the game inside a ImGui window * presenter: render the previous frame to keep the render rendering * swapchain: fix swapchain image view format not being converted to unorm * devtools: fix frame graph timing
This commit is contained in:
parent
440a693fae
commit
56a6c95730
19 changed files with 306 additions and 110 deletions
|
@ -1,8 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/config.h"
|
||||
#include "common/debug.h"
|
||||
|
@ -207,6 +205,13 @@ void VideoOutDriver::DrawBlankFrame() {
|
|||
presenter->Present(empty_frame);
|
||||
}
|
||||
|
||||
void VideoOutDriver::DrawLastFrame() {
|
||||
const auto frame = presenter->PrepareLastFrame();
|
||||
if (frame != nullptr) {
|
||||
presenter->Present(frame, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoOutDriver::SubmitFlip(VideoOutPort* port, s32 index, s64 flip_arg,
|
||||
bool is_eop /*= false*/) {
|
||||
{
|
||||
|
@ -278,17 +283,24 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
|
|||
return {};
|
||||
};
|
||||
|
||||
auto delay = std::chrono::microseconds{0};
|
||||
while (!token.stop_requested()) {
|
||||
timer.Start();
|
||||
|
||||
if (DebugState.IsGuestThreadsPaused()) {
|
||||
DrawLastFrame();
|
||||
timer.End();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if it's time to take a request.
|
||||
auto& vblank_status = main_port.vblank_status;
|
||||
if (vblank_status.count % (main_port.flip_rate + 1) == 0) {
|
||||
const auto request = receive_request();
|
||||
if (!request) {
|
||||
if (!main_port.is_open || DebugState.IsGuestThreadsPaused()) {
|
||||
if (!main_port.is_open) {
|
||||
DrawBlankFrame();
|
||||
} else {
|
||||
DrawLastFrame();
|
||||
}
|
||||
} else {
|
||||
Flip(request);
|
||||
|
|
|
@ -102,7 +102,8 @@ private:
|
|||
};
|
||||
|
||||
void Flip(const Request& req);
|
||||
void DrawBlankFrame(); // Used when there is no flip request to keep ImGui up to date
|
||||
void DrawBlankFrame(); // Video port out not open
|
||||
void DrawLastFrame(); // Used when there is no flip request
|
||||
void SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_arg, bool is_eop = false);
|
||||
void PresentThread(std::stop_token token);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue