From 2f700aa495706301d90fbb3157cf84d37ff361af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 13 Dec 2020 00:19:39 +0100 Subject: [PATCH] Fix DiRT 2's car reflections. --- GPU/Common/FramebufferManagerCommon.cpp | 11 +++++++++-- assets/compat.ini | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 019cb8b860..20566b0cb2 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -536,10 +536,14 @@ void FramebufferManagerCommon::ReinterpretFramebufferFrom(VirtualFramebuffer *vf // Fixes #13717. if (!PSP_CoreParameter().compat.flags().ReinterpretFramebuffers) { draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "FakeReinterpret"); - currentRenderVfb_ = vfb; // 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. gstate_c.Dirty(DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE); + + if (currentRenderVfb_ != vfb) { + // In case ReinterpretFramebuffer was called from the texture manager. + draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, "After FakeReinterpret"); + } } } return; @@ -626,13 +630,16 @@ void FramebufferManagerCommon::ReinterpretFramebufferFrom(VirtualFramebuffer *vf // Unbind. draw_->BindTexture(0, nullptr); - RebindFramebuffer("After reinterpret"); shaderManager_->DirtyLastShader(); textureCache_->ForgetLastTexture(); gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_VERTEXSHADER_STATE); + if (currentRenderVfb_ != vfb) { + // In case ReinterpretFramebuffer was called from the texture manager. + draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, "After reinterpret"); + } delete[] vsCode; delete[] fsCode; } diff --git a/assets/compat.ini b/assets/compat.ini index c7c41e5d63..4e93373a96 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -819,15 +819,16 @@ NPEZ00198 = true # This setting will go away in the near future, hopefully we can enable it # for all or most games. [ReinterpretFramebuffers] -# Outrun 2006: Coast to Coast - issue #11358 +# Outrun 2006: Coast to Coast - issue #11358 (car reflections) ULES00262 = true ULUS10064 = true ULKS46087 = true -# Colin McRae's DiRT 2? -# ULUS10471 = true -# ULJM05533 = true -# NPJH50006 = true +# Colin McRae's DiRT 2 - issue #13012 (car lighting) +ULUS10471 = true +ULJM05533 = true +NPJH50006 = true +ULES01301 = true # Ultimate Ghosts & Goblins ULJM05147 = true @@ -845,6 +846,12 @@ ULES00262 = true ULUS10064 = true ULKS46087 = true +# Colin McRae's DiRT 2 - issue #13012 (car lighting) +ULUS10471 = true +ULJM05533 = true +NPJH50006 = true +ULES01301 = true + [DoublePrecisionSinCos] # Hitman Reborn Battle Arena 2 (#12900) ULJS00218 = true