Skip to content

Commit 33b1fb0

Browse files
committed
Really not sure how we can detect whether a depth deswizzle is needed :( Hopefully temporary flag...
1 parent eeed656 commit 33b1fb0

5 files changed

Lines changed: 23 additions & 3 deletions

File tree

Core/Compatibility.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
9797
CheckSetting(iniFile, gameID, "ZZT3SelectHack", &flags_.ZZT3SelectHack);
9898
CheckSetting(iniFile, gameID, "AllowLargeFBTextureOffsets", &flags_.AllowLargeFBTextureOffsets);
9999
CheckSetting(iniFile, gameID, "AtracLoopHack", &flags_.AtracLoopHack);
100+
CheckSetting(iniFile, gameID, "DeswizzleDepth", &flags_.DeswizzleDepth);
100101
}
101102

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

Core/Compatibility.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct CompatFlags {
8787
bool ZZT3SelectHack;
8888
bool AllowLargeFBTextureOffsets;
8989
bool AtracLoopHack;
90+
bool DeswizzleDepth;
9091
};
9192

9293
class IniFile;

Core/CoreParameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct CoreParameter {
6666
bool headLess; // Try to avoid messageboxes etc
6767

6868
// Internal PSP rendering resolution and scale factor.
69-
int renderScaleFactor;
69+
int renderScaleFactor = 1;
7070
int renderWidth;
7171
int renderHeight;
7272

GPU/Common/FramebufferManagerCommon.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ void FramebufferManagerCommon::CopyToDepthFromOverlappingFramebuffers(VirtualFra
552552
// For now, let's just do the last thing, if there are multiple.
553553

554554
// for (auto &source : sources) {
555-
if (sources.size()) {
555+
if (!sources.empty()) {
556556
auto &source = sources.back();
557557
if (source.channel == RASTER_DEPTH) {
558558
// Good old depth->depth copy.
@@ -561,11 +561,19 @@ void FramebufferManagerCommon::CopyToDepthFromOverlappingFramebuffers(VirtualFra
561561
dest->last_frame_depth_updated = gpuStats.numFlips;
562562
} else if (source.channel == RASTER_COLOR) {
563563
VirtualFramebuffer *src = source.vfb;
564+
565+
// Really hate to do this, but tracking the depth swizzle state across multiple
566+
// copies is not easy.
567+
Draw2DShader shader = DRAW2D_565_TO_DEPTH;
568+
if (PSP_CoreParameter().compat.flags().DeswizzleDepth) {
569+
shader = DRAW2D_565_TO_DEPTH_DESWIZZLE;
570+
}
571+
564572
// Copying color to depth.
565573
BlitUsingRaster(
566574
src->fbo, 0.0f, 0.0f, src->renderWidth, src->renderHeight,
567575
dest->fbo, 0.0f, 0.0f, src->renderWidth, src->renderHeight,
568-
false, DRAW2D_565_TO_DEPTH_DESWIZZLE, "565_to_depth");
576+
false, shader, "565_to_depth");
569577
}
570578
}
571579

assets/compat.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,3 +1266,13 @@ ULES00618 = true
12661266
# Silver Fall
12671267
ULES00808 = true
12681268
ULUS10270 = true
1269+
1270+
[DeswizzleDepth]
1271+
UCUS98633 = true
1272+
UCAS40145 = true
1273+
UCES00420 = true
1274+
UCJS10052 = true
1275+
UCKS45048 = true
1276+
UCJS18030 = true
1277+
UCJS18047 = true
1278+
NPJG00015 = true

0 commit comments

Comments
 (0)