From 68480c548d33677ee31f188f3f0d52b41e1d0405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 19 Aug 2022 00:02:22 +0200 Subject: [PATCH] Texture bind channel fix --- GPU/Common/TextureCacheCommon.cpp | 6 ++++-- GPU/Common/TextureCacheCommon.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index d5de94ea28..7f1c86feb3 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1023,6 +1023,8 @@ void TextureCacheCommon::SetTextureFramebuffer(const AttachCandidate &candidate) // Keep the framebuffer alive. framebuffer->last_frame_used = gpuStats.numFlips; + nextFramebufferTextureChannel_ = RASTER_COLOR; + if (framebufferManager_->UseBufferedRendering()) { // We need to force it, since we may have set it on a texture before attaching. gstate_c.curTextureWidth = framebuffer->bufferWidth; @@ -1049,6 +1051,7 @@ void TextureCacheCommon::SetTextureFramebuffer(const AttachCandidate &candidate) failedTexture_ = true; } else { nextFramebufferTexture_ = framebuffer; + nextFramebufferTextureChannel_ = candidate.channel; } nextTexture_ = nullptr; } else { @@ -1764,9 +1767,8 @@ void TextureCacheCommon::ApplyTexture() { // Backends should handle this by binding a black texture with 0 alpha. BindTexture(nullptr); } else if (nextFramebufferTexture_) { - bool depth = Memory::IsDepthTexVRAMAddress(gstate.getTextureAddress(0)); // ApplyTextureFrameBuffer is responsible for setting SetTextureFullAlpha. - ApplyTextureFramebuffer(nextFramebufferTexture_, gstate.getTextureFormat(), depth ? RASTER_DEPTH : RASTER_COLOR); + ApplyTextureFramebuffer(nextFramebufferTexture_, gstate.getTextureFormat(), nextFramebufferTextureChannel_); nextFramebufferTexture_ = nullptr; } diff --git a/GPU/Common/TextureCacheCommon.h b/GPU/Common/TextureCacheCommon.h index dbfbb316e4..a8b48878e2 100644 --- a/GPU/Common/TextureCacheCommon.h +++ b/GPU/Common/TextureCacheCommon.h @@ -435,6 +435,7 @@ protected: TexCacheEntry *nextTexture_ = nullptr; bool failedTexture_ = false; VirtualFramebuffer *nextFramebufferTexture_ = nullptr; + RasterChannel nextFramebufferTextureChannel_ = RASTER_COLOR; u32 clutHash_ = 0;