Fix event order and some logic. Can now change skip buffer effect while running in background.

This commit is contained in:
Henrik Rydgård 2024-02-01 23:26:36 +01:00
parent 337de548b8
commit a07a2e445b
3 changed files with 22 additions and 20 deletions

View File

@ -801,6 +801,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
if (usePostShader) {
// When we render to temp framebuffers during post, we switch position, not UV.
// The flipping here is only because D3D has a clip coordinate system that doesn't match their screen coordinate system.
// The flipping here is only because D3D has a clip coordinate system that doesn't match their screen coordinate system.
bool flipped = flags & OutputFlags::POSITION_FLIPPED;
float y0 = flipped ? 1.0f : -1.0f;
float y1 = flipped ? -1.0f : 1.0f;

View File

@ -1326,7 +1326,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
// We only bind it in FramebufferManager::CopyDisplayToOutput (unless non-buffered)...
// We do, however, start the frame in other ways.
if ((g_Config.bSkipBufferEffects && !g_Config.bSoftwareRendering) || Core_IsStepping()) {
if ((skipBufferEffects && !g_Config.bSoftwareRendering) || Core_IsStepping()) {
// We need to clear here already so that drawing during the frame is done on a clean slate.
if (Core_IsStepping() && gpuStats.numFlips != 0) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::CLEAR, RPAction::CLEAR }, "EmuScreen_BackBuffer");
@ -1348,12 +1348,12 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
System_Notify(SystemNotification::KEEP_SCREEN_AWAKE);
} else if (!Core_ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
// Just to make sure.
if (PSP_IsInited() && !g_Config.bSkipBufferEffects) {
if (PSP_IsInited() && !skipBufferEffects) {
PSP_BeginHostFrame();
gpu->CopyDisplayToOutput(true);
PSP_EndHostFrame();
}
if (!gpu->PresentedThisFrame()) {
if (!framebufferBound && !gpu->PresentedThisFrame()) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, }, "EmuScreen_Behind");
}
// Need to make sure the UI texture is available, for "darken".

View File

@ -1061,23 +1061,6 @@ void NativeFrame(GraphicsContext *graphicsContext) {
ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_UP, startTime, false);
ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_DOWN, startTime, false);
std::vector<PendingMessage> toProcess;
{
std::lock_guard<std::mutex> lock(pendingMutex);
toProcess = std::move(pendingMessages);
pendingMessages.clear();
}
for (const auto &item : toProcess) {
if (HandleGlobalMessage(item.message, item.value)) {
// TODO: Add a to-string thingy.
INFO_LOG(SYSTEM, "Handled global message: %d / %s", (int)item.message, item.value.c_str());
}
g_screenManager->sendMessage(item.message, item.value.c_str());
}
g_requestManager.ProcessRequests();
// it's ok to call this redundantly with DoFrame from EmuScreen
Achievements::Idle();
@ -1104,6 +1087,24 @@ void NativeFrame(GraphicsContext *graphicsContext) {
g_screenManager->update();
// Do this after g_screenManager.update() so we can receive setting changes before rendering.
std::vector<PendingMessage> toProcess;
{
std::lock_guard<std::mutex> lock(pendingMutex);
toProcess = std::move(pendingMessages);
pendingMessages.clear();
}
for (const auto &item : toProcess) {
if (HandleGlobalMessage(item.message, item.value)) {
// TODO: Add a to-string thingy.
INFO_LOG(SYSTEM, "Handled global message: %d / %s", (int)item.message, item.value.c_str());
}
g_screenManager->sendMessage(item.message, item.value.c_str());
}
g_requestManager.ProcessRequests();
// Apply the UIContext bounds as a 2D transformation matrix.
// TODO: This should be moved into the draw context...
Matrix4x4 ortho = ComputeOrthoMatrix(g_display.dp_xres, g_display.dp_yres);