Skip to content

Commit

Permalink
Force half instead random
Browse files Browse the repository at this point in the history
  • Loading branch information
sum2012 committed Feb 1, 2024
1 parent f0f8c04 commit b06ff87
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions GPU/Common/FramebufferManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,8 @@
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"

bool GenerateBoolean() {
int randomNumber = rand() % 100; // Generate a random number between 0 and 99
if (randomNumber < 50) {
return true; // 50% chance of returning true
}
else {
return false; // 50% chance of returning false
}
}
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 @@ -1043,8 +1036,9 @@ 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.
HalfSkipDownloadFramebufferOnSwitch = !HalfSkipDownloadFramebufferOnSwitch;
if (!PSP_CoreParameter().compat.flags().DisableFirstFrameReadback) {
if (g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::NO_SKIP || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::HALF_SKIP && GenerateBoolean) {
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;
Expand All @@ -1061,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::SKIP || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::COPY_TO_TEXTURE || g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::HALF_SKIP && GenerateBoolean) {
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

0 comments on commit b06ff87

Please sign in to comment.