Skip to content

Commit 87e49d8

Browse files
authored
Merge pull request #16115 from hrydgard/fb-create-nearest-filter
Add compatibility flag for loading pixels on framebuffer create using nearest filtering
2 parents 89e6b10 + 1c0d66a commit 87e49d8

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

Core/Compatibility.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
109109
CheckSetting(iniFile, gameID, "SplitFramebufferMargin", &flags_.SplitFramebufferMargin);
110110
CheckSetting(iniFile, gameID, "ForceLowerResolutionForEffectsOn", &flags_.ForceLowerResolutionForEffectsOn);
111111
CheckSetting(iniFile, gameID, "AllowDownloadCLUT", &flags_.AllowDownloadCLUT);
112+
CheckSetting(iniFile, gameID, "NearestFilteringOnFramebufferCreate", &flags_.NearestFilteringOnFramebufferCreate);
112113
}
113114

114115
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {

Core/Compatibility.h

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct CompatFlags {
8989
bool SplitFramebufferMargin;
9090
bool ForceLowerResolutionForEffectsOn;
9191
bool AllowDownloadCLUT;
92+
bool NearestFilteringOnFramebufferCreate;
9293
};
9394

9495
struct VRCompat {

GPU/Common/FramebufferManagerCommon.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,11 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
10611061

10621062
DrawTextureFlags flags;
10631063
if (useBufferedRendering_ && vfb && vfb->fbo) {
1064-
flags = channel == RASTER_COLOR ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
1064+
if (channel == RASTER_DEPTH || PSP_CoreParameter().compat.flags().NearestFilteringOnFramebufferCreate) {
1065+
flags = DRAWTEX_NEAREST;
1066+
} else {
1067+
flags = DRAWTEX_LINEAR;
1068+
}
10651069
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, tag);
10661070
SetViewport2D(0, 0, vfb->renderWidth, vfb->renderHeight);
10671071
draw_->SetScissorRect(0, 0, vfb->renderWidth, vfb->renderHeight);

assets/compat.ini

+21
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,27 @@ ULJM05494 = true
12831283
NPJH50143 = true
12841284
ULJM05738 = true
12851285

1286+
[NearestFilteringOnFramebufferCreate]
1287+
# Ridge Racer speedometer dynamic CLUT problem - they rely on some palette entries
1288+
# from memory, and render to the rest of the palette. The palette entries loaded from memory
1289+
# must not be blurred by filtering, so nearest it is. See issue #8509
1290+
1291+
# Ridge Racer
1292+
ULJS00001 = true
1293+
ULUS10001 = true
1294+
UCKS45002 = true
1295+
UCES00002 = true
1296+
ULJS19002 = true
1297+
UCKS45053 = true
1298+
NPJH50140 = true
1299+
1300+
# Ridge Racer 2
1301+
ULJS00080 = true
1302+
UCKS45032 = true
1303+
UCES00422 = true
1304+
UCAS40273 = true
1305+
NPJH50366 = true
1306+
12861307
[AllowDownloadCLUT]
12871308
# Temporary compatibility option, while working on the GPU CLUT-from-framebuffer path.
12881309
# Not required for any games now that it works, but might be useful for development.

0 commit comments

Comments
 (0)