From 61fc1cdcfb1abd75f3a5e992b62dc36c29fb19ec Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 22 Apr 2018 11:16:33 -0700 Subject: [PATCH] GPU: Dirty tex when clearing or rendering to self. This way if we're blitting, we'll re-blit. --- GPU/D3D11/StateMappingD3D11.cpp | 3 +++ GPU/Directx9/StateMappingDX9.cpp | 3 +++ GPU/GLES/DrawEngineGLES.cpp | 3 +++ GPU/Vulkan/DrawEngineVulkan.cpp | 3 +++ 4 files changed, 12 insertions(+) diff --git a/GPU/D3D11/StateMappingD3D11.cpp b/GPU/D3D11/StateMappingD3D11.cpp index ee76b373224d..c1e669d2686b 100644 --- a/GPU/D3D11/StateMappingD3D11.cpp +++ b/GPU/D3D11/StateMappingD3D11.cpp @@ -426,6 +426,9 @@ void DrawEngineD3D11::ApplyDrawState(int prim) { if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) { textureCache_->SetTexture(); gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); + } else if (gstate.getTextureAddress(0) == ((gstate.getFrameBufRawAddress() | 0x04000000) & 0x3FFFFFFF)) { + // This catches the case of clearing a texture. + gstate_c.Dirty(DIRTY_TEXTURE_IMAGE); } } diff --git a/GPU/Directx9/StateMappingDX9.cpp b/GPU/Directx9/StateMappingDX9.cpp index b2e45959764e..26390bef390f 100644 --- a/GPU/Directx9/StateMappingDX9.cpp +++ b/GPU/Directx9/StateMappingDX9.cpp @@ -103,6 +103,9 @@ void DrawEngineDX9::ApplyDrawState(int prim) { if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) { textureCache_->SetTexture(); gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); + } else if (gstate.getTextureAddress(0) == ((gstate.getFrameBufRawAddress() | 0x04000000) & 0x3FFFFFFF)) { + // This catches the case of clearing a texture. + gstate_c.Dirty(DIRTY_TEXTURE_IMAGE); } // Start profiling here to skip SetTexture which is already accounted for diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index d79ee4efd4b6..29eb3ad9d481 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -311,6 +311,9 @@ void DrawEngineGLES::DoFlush() { textureCache_->SetTexture(); gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); textureNeedsApply = true; + } else if (gstate.getTextureAddress(0) == ((gstate.getFrameBufRawAddress() | 0x04000000) & 0x3FFFFFFF)) { + // This catches the case of clearing a texture. + gstate_c.Dirty(DIRTY_TEXTURE_IMAGE); } GEPrimitiveType prim = prevPrim_; diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 76643d606691..b47d23f6a311 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -570,6 +570,9 @@ void DrawEngineVulkan::DoFlush() { textureCache_->SetTexture(); gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); textureNeedsApply = true; + } else if (gstate.getTextureAddress(0) == ((gstate.getFrameBufRawAddress() | 0x04000000) & 0x3FFFFFFF)) { + // This catches the case of clearing a texture. + gstate_c.Dirty(DIRTY_TEXTURE_IMAGE); } GEPrimitiveType prim = prevPrim_;