From bdcf2c5cff4a8b02e3b8eeb2e9dd897fc9a7f94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 20 Sep 2020 20:42:28 +0200 Subject: [PATCH] Have to invalidate "lastBoundTexture" when binding framebuffers as texture. Fixes parts of #13431 for D3D11 at least. Will probably soon get rid of this concept, it's only useful in D3D9/11 and those are probably not gonna lose much perf if we remove this minor state caching. --- GPU/Common/TextureCacheCommon.cpp | 1 + GPU/D3D11/TextureCacheD3D11.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index c3eaf6703a..64c687bf1e 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1588,6 +1588,7 @@ void TextureCacheCommon::ApplyTexture() { // Maybe we bound a framebuffer? if (nextFramebufferTexture_) { bool depth = Memory::IsDepthTexVRAMAddress(gstate.getTextureAddress(0)); + InvalidateLastTexture(); ApplyTextureFramebuffer(nextFramebufferTexture_, gstate.getTextureFormat(), depth ? NOTIFY_FB_DEPTH : NOTIFY_FB_COLOR); nextFramebufferTexture_ = nullptr; } diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index 5a0f63e600..3a9dbda64a 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -145,6 +145,7 @@ void TextureCacheD3D11::ReleaseTexture(TexCacheEntry *entry, bool delete_them) { void TextureCacheD3D11::ForgetLastTexture() { InvalidateLastTexture(); gstate_c.Dirty(DIRTY_TEXTURE_PARAMS); + ID3D11ShaderResourceView *nullTex[2]{}; context_->PSSetShaderResources(0, 2, nullTex); }