Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Half skip" Mode #18807

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ struct Config {
float fCwCheatScrollPosition;
float fGameListScrollPosition;
int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive
int iSkipGPUReadbackMode; // 0 = off, 1 = skip, 2 = to texture
int iSkipGPUReadbackMode; // 0 = off, 1 = skip, 2 = to texture, 3 = half skip
int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High
bool bHardwareTessellation;
bool bShaderCache; // Hidden ini-only setting, useful for debugging shader compile times.
Expand Down
1 change: 1 addition & 0 deletions Core/ConfigValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ enum class SkipGPUReadbackMode : int {
NO_SKIP,
SKIP,
COPY_TO_TEXTURE,
HALF_SKIP,
};

enum class RemoteISOShareType : int {
Expand Down
19 changes: 13 additions & 6 deletions GPU/Common/FramebufferManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"

bool HalfSkipDownloadFramebufferOnSwitch = false;
bool HalfSkipShouldDownloadFramebufferDepth = false;

static size_t FormatFramebufferName(const VirtualFramebuffer *vfb, char *tag, size_t len) {
return snprintf(tag, len, "FB_%08x_%08x_%dx%d_%s", vfb->fb_address, vfb->z_address, vfb->bufferWidth, vfb->bufferHeight, GeBufferFormatToString(vfb->fb_format));
}
Expand Down Expand Up @@ -1033,11 +1036,14 @@ void FramebufferManagerCommon::DownloadFramebufferOnSwitch(VirtualFramebuffer *v
// Saving each frame would be slow.

// TODO: This type of download could be made async, for less stutter on framebuffer creation.
if (g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::NO_SKIP && !PSP_CoreParameter().compat.flags().DisableFirstFrameReadback) {
ReadFramebufferToMemory(vfb, 0, 0, vfb->safeWidth, vfb->safeHeight, RASTER_COLOR, Draw::ReadbackMode::BLOCK);
vfb->usageFlags = (vfb->usageFlags | FB_USAGE_DOWNLOAD | FB_USAGE_FIRST_FRAME_SAVED) & ~FB_USAGE_DOWNLOAD_CLEAR;
vfb->safeWidth = 0;
vfb->safeHeight = 0;
HalfSkipDownloadFramebufferOnSwitch = !HalfSkipDownloadFramebufferOnSwitch;
if (!PSP_CoreParameter().compat.flags().DisableFirstFrameReadback) {
if (g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::NO_SKIP || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::HALF_SKIP && HalfSkipDownloadFramebufferOnSwitch) {
ReadFramebufferToMemory(vfb, 0, 0, vfb->safeWidth, vfb->safeHeight, RASTER_COLOR, Draw::ReadbackMode::BLOCK);
vfb->usageFlags = (vfb->usageFlags | FB_USAGE_DOWNLOAD | FB_USAGE_FIRST_FRAME_SAVED) & ~FB_USAGE_DOWNLOAD_CLEAR;
vfb->safeWidth = 0;
vfb->safeHeight = 0;
}
}
}
}
Expand All @@ -1049,7 +1055,8 @@ bool FramebufferManagerCommon::ShouldDownloadFramebufferColor(const VirtualFrame

bool FramebufferManagerCommon::ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb) const {
// Download depth buffer for Syphon Filter lens flares
if (!PSP_CoreParameter().compat.flags().ReadbackDepth || g_Config.iSkipGPUReadbackMode != (int)SkipGPUReadbackMode::NO_SKIP) {
HalfSkipShouldDownloadFramebufferDepth = !HalfSkipShouldDownloadFramebufferDepth;
if (!PSP_CoreParameter().compat.flags().ReadbackDepth || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::SKIP || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::COPY_TO_TEXTURE || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::HALF_SKIP && HalfSkipShouldDownloadFramebufferDepth) {
return false;
}
return (vfb->usageFlags & FB_USAGE_RENDER_DEPTH) != 0 && vfb->width >= 480 && vfb->height >= 272;
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
CheckBox *disableCulling = graphicsSettings->Add(new CheckBox(&g_Config.bDisableRangeCulling, gr->T("Disable culling")));
disableCulling->SetDisabledPtr(&g_Config.bSoftwareRendering);

static const char *skipGpuReadbackModes[] = { "No (default)", "Skip", "Copy to texture" };
static const char *skipGpuReadbackModes[] = { "No (default)", "Skip", "Copy to texture" , "Half skip"};

PopupMultiChoice *skipGPUReadbacks = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iSkipGPUReadbackMode, gr->T("Skip GPU Readbacks"), skipGpuReadbackModes, 0, ARRAY_SIZE(skipGpuReadbackModes), I18NCat::GRAPHICS, screenManager()));
skipGPUReadbacks->SetDisabledPtr(&g_Config.bSoftwareRendering);
Expand Down
Loading