Skip to content

Commit

Permalink
Really not sure how we can detect whether a depth deswizzle is needed…
Browse files Browse the repository at this point in the history
… :( Hopefully temporary flag...
  • Loading branch information
hrydgard committed Aug 20, 2022
1 parent eeed656 commit 33b1fb0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "ZZT3SelectHack", &flags_.ZZT3SelectHack);
CheckSetting(iniFile, gameID, "AllowLargeFBTextureOffsets", &flags_.AllowLargeFBTextureOffsets);
CheckSetting(iniFile, gameID, "AtracLoopHack", &flags_.AtracLoopHack);
CheckSetting(iniFile, gameID, "DeswizzleDepth", &flags_.DeswizzleDepth);
}

void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct CompatFlags {
bool ZZT3SelectHack;
bool AllowLargeFBTextureOffsets;
bool AtracLoopHack;
bool DeswizzleDepth;
};

class IniFile;
Expand Down
2 changes: 1 addition & 1 deletion Core/CoreParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct CoreParameter {
bool headLess; // Try to avoid messageboxes etc

// Internal PSP rendering resolution and scale factor.
int renderScaleFactor;
int renderScaleFactor = 1;
int renderWidth;
int renderHeight;

Expand Down
12 changes: 10 additions & 2 deletions GPU/Common/FramebufferManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ void FramebufferManagerCommon::CopyToDepthFromOverlappingFramebuffers(VirtualFra
// For now, let's just do the last thing, if there are multiple.

// for (auto &source : sources) {
if (sources.size()) {
if (!sources.empty()) {
auto &source = sources.back();
if (source.channel == RASTER_DEPTH) {
// Good old depth->depth copy.
Expand All @@ -561,11 +561,19 @@ void FramebufferManagerCommon::CopyToDepthFromOverlappingFramebuffers(VirtualFra
dest->last_frame_depth_updated = gpuStats.numFlips;
} else if (source.channel == RASTER_COLOR) {
VirtualFramebuffer *src = source.vfb;

// Really hate to do this, but tracking the depth swizzle state across multiple
// copies is not easy.
Draw2DShader shader = DRAW2D_565_TO_DEPTH;
if (PSP_CoreParameter().compat.flags().DeswizzleDepth) {
shader = DRAW2D_565_TO_DEPTH_DESWIZZLE;
}

// Copying color to depth.
BlitUsingRaster(
src->fbo, 0.0f, 0.0f, src->renderWidth, src->renderHeight,
dest->fbo, 0.0f, 0.0f, src->renderWidth, src->renderHeight,
false, DRAW2D_565_TO_DEPTH_DESWIZZLE, "565_to_depth");
false, shader, "565_to_depth");
}
}

Expand Down
10 changes: 10 additions & 0 deletions assets/compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1266,3 +1266,13 @@ ULES00618 = true
# Silver Fall
ULES00808 = true
ULUS10270 = true

[DeswizzleDepth]
UCUS98633 = true
UCAS40145 = true
UCES00420 = true
UCJS10052 = true
UCKS45048 = true
UCJS18030 = true
UCJS18047 = true
NPJG00015 = true

0 comments on commit 33b1fb0

Please sign in to comment.