Force half instead random

This commit is contained in:
sum2012 authored and Henrik Rydgård committed 2025-02-13 11:58:43 -06:00
1 parent 5da9ec063e
commit 9c3148ddf3
2 files changed
+9 -13

No files matched your search

+4 -12
View File
@@ -43,16 +43,6 @@
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
static 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
}
}
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));
}
@@ -1059,7 +1049,8 @@ 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 || (g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::HALF_SKIP && GenerateBoolean())) {
halfSkipDownloadFramebufferOnSwitch_ = !halfSkipDownloadFramebufferOnSwitch_;
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;
@@ -1086,7 +1077,8 @@ bool FramebufferManagerCommon::ShouldDownloadFramebufferDepth(const VirtualFrame
performDepthReadback = false;
break;
case SkipGPUReadbackMode::HALF_SKIP:
performDepthReadback = GenerateBoolean();
halfSkipShouldDownloadFramebufferDepth_ = !halfSkipShouldDownloadFramebufferDepth_;
performDepthReadback = halfSkipShouldDownloadFramebufferDepth_;
break;
case SkipGPUReadbackMode::COPY_TO_TEXTURE:
case SkipGPUReadbackMode::NO_SKIP:
+5 -1
View File
@@ -525,7 +525,7 @@ protected:
void ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, int h, bool force = false, bool skipCopy = false);
static bool ShouldDownloadFramebufferColor(const VirtualFramebuffer *vfb);
static bool ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb);
bool ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb);
void DownloadFramebufferOnSwitch(VirtualFramebuffer *vfb);
bool FindTransferFramebuffer(u32 basePtr, int stride, int x, int y, int w, int h, int bpp, bool destination, BlockTransferRect *rect);
@@ -653,6 +653,10 @@ protected:
// Depth readback helper state
u8 *convBuf_ = nullptr;
u32 convBufSize_ = 0;
// Half-skip toggles.
bool halfSkipDownloadFramebufferOnSwitch_ = false;
bool halfSkipShouldDownloadFramebufferDepth_ = false;
};
// Should probably live elsewhere.