diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index fafdd6878b..ba833a91c5 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -76,6 +76,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "DateLimited", &flags_.DateLimited); CheckSetting(iniFile, gameID, "ReinterpretFramebuffers", &flags_.ReinterpretFramebuffers); CheckSetting(iniFile, gameID, "DoublePrecisionSinCos", &flags_.DoublePrecisionSinCos); + CheckSetting(iniFile, gameID, "ShaderColorBitmask", &flags_.ShaderColorBitmask); } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 415e589ad9..83a9dfe671 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -74,6 +74,7 @@ struct CompatFlags { bool DateLimited; bool ReinterpretFramebuffers; bool DoublePrecisionSinCos; + bool ShaderColorBitmask; }; class IniFile; diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 05187676f3..7124bd1d9c 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -531,6 +531,9 @@ void FramebufferManagerCommon::ReinterpretFramebufferFrom(VirtualFramebuffer *vf if (oldFormat == GE_FORMAT_565) { // We have to bind here instead of clear, since it can be that no framebuffer is bound. // The backend can sometimes directly optimize it to a clear. + // TODO: Ultimate Ghosts and Goblins, if we don't enable reinterpret, long after this hits an assert + // in VKContext::BindFramebufferAsTexture indicating that we've fallen out of sync between + // VKContext::curFramebuffer and currentRenderVfb_. That's issue #13717. draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "FakeReinterpret"); // Need to dirty anything that has command buffer dynamic state, in case we started a new pass above. // Should find a way to feed that information back, maybe... Or simply correct the issue in the rendermanager. @@ -1009,7 +1012,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { DownloadFramebufferOnSwitch(currentRenderVfb_); shaderManager_->DirtyLastShader(); - currentRenderVfb_ = 0; + currentRenderVfb_ = nullptr; if (displayFramebufPtr_ == 0) { if (Core_IsStepping()) @@ -1146,7 +1149,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { } void FramebufferManagerCommon::DecimateFBOs() { - currentRenderVfb_ = 0; + currentRenderVfb_ = nullptr; for (auto iter : fbosToDelete_) { iter->Release(); diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 83ce5b61ee..7deafabad8 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -959,7 +959,7 @@ void ApplyStencilReplaceAndLogicOpIgnoreBlend(ReplaceAlphaType replaceAlphaWithS bool IsColorWriteMaskComplex(bool allowFramebufferRead) { // Restrict to Outrun temporarily (by uglily reusing the ReinterpretFramebuffers flag) // This check must match the one in ConvertMaskState. - if (!allowFramebufferRead || !PSP_CoreParameter().compat.flags().ReinterpretFramebuffers) { + if (!allowFramebufferRead || !PSP_CoreParameter().compat.flags().ShaderColorBitmask) { // Don't have a choice - we'll make do but it won't always be right. return false; } @@ -999,9 +999,9 @@ void ConvertMaskState(GenericMaskState &maskState, bool allowFramebufferRead) { break; default: if (allowFramebufferRead) { - // Instead of just 'true', restrict shader bitmasks to Outrun temporarily (by uglily reusing the ReinterpretFramebuffers flag) + // Instead of just 'true', restrict shader bitmasks to Outrun temporarily. // TODO: This check must match the one in IsColorWriteMaskComplex. - maskState.applyFramebufferRead = PSP_CoreParameter().compat.flags().ReinterpretFramebuffers; + maskState.applyFramebufferRead = PSP_CoreParameter().compat.flags().ShaderColorBitmask; maskState.rgba[i] = true; } else { // Use the old heuristic. diff --git a/assets/compat.ini b/assets/compat.ini index 1aac5a6dd9..de4e820dc7 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -808,6 +808,18 @@ ULKS46087 = true # ULJM05533 = true # NPJH50006 = true +# Ultimate Ghosts & Goblins +ULJM05147 = true +ULUS10105 = true +ULES00419 = true +NPJH50235 = true + +[ShaderColorBitmask] +# Outrun 2006: Coast to Coast - issue #11358 +ULES00262 = true +ULUS10064 = true +ULKS46087 = true + [DoublePrecisionSinCos] # Hitman Reborn Battle Arena 2 (#12900) ULJS00218 = true