From afc9a14b375068ceff4c57ff6f40a5f8dfb01d6c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 21 Aug 2022 16:46:51 -0700 Subject: [PATCH 1/2] GPU: Share CLUTs if no extended CLUT. Oops, this was backwards. See #15878. --- GPU/Common/TextureCacheCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index e4a8c9cd33..72839eb97a 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1670,7 +1670,7 @@ CheckAlphaResult TextureCacheCommon::ReadIndexedTex(u8 *out, int outPitch, int l // Misshitsu no Sacrifice has separate CLUT data, this is a hack to allow it. // Normally separate CLUTs are not allowed for 8-bit or higher indices. - const bool mipmapShareClut = gstate.isClutSharedForMipmaps() && gstate.getClutLoadBlocks() == 0x40; + const bool mipmapShareClut = gstate.isClutSharedForMipmaps() || gstate.getClutLoadBlocks() != 0x40; const int clutSharingOffset = mipmapShareClut ? 0 : (level & 1) * 256; GEPaletteFormat palFormat = (GEPaletteFormat)gstate.getClutPaletteFormat(); From 89a499b4d2f0c2587551d94a4bc925a6f34ef052 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 21 Aug 2022 16:47:46 -0700 Subject: [PATCH 2/2] GLES: Correct preview of mip levels > 0. Don't need to force level 0 anymore. Software can show levels hardware refuses to load. This is consistent with other backends. --- GPU/D3D11/TextureCacheD3D11.cpp | 2 ++ GPU/GLES/TextureCacheGLES.cpp | 15 --------------- GPU/Vulkan/TextureCacheVulkan.cpp | 2 ++ 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index 55917a7c24..2fea477610 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -465,6 +465,8 @@ bool TextureCacheD3D11::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE); // We may have blitted to a temp FBO. framebufferManager_->RebindFramebuffer("RebindFramebuffer - GetCurrentTextureDebug"); + if (!retval) + ERROR_LOG(G3D, "Failed to get debug texture: copy to memory failed"); return retval; } else { return false; diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index beb89c6b43..fb3c1a01b3 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -382,19 +382,8 @@ Draw::DataFormat TextureCacheGLES::GetDestFormat(GETextureFormat format, GEPalet } bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) { - GPUgstate saved; - if (level != 0) { - saved = gstate; - - // The way we set textures is a bit complex. Let's just override level 0. - gstate.texsize[0] = gstate.texsize[level]; - gstate.texaddr[0] = gstate.texaddr[level]; - gstate.texbufwidth[0] = gstate.texbufwidth[level]; - } - InvalidateLastTexture(); SetTexture(); - if (!nextTexture_) { if (nextFramebufferTexture_) { VirtualFramebuffer *vfb = nextFramebufferTexture_; @@ -427,10 +416,6 @@ bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) int w = gstate.getTextureWidth(level); int h = gstate.getTextureHeight(level); - if (level != 0) { - gstate = saved; - } - bool result = entry->textureName != nullptr; if (result) { buffer.Allocate(w, h, GE_FORMAT_8888, false); diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 51ca567183..ba860c1be5 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -777,6 +777,8 @@ bool TextureCacheVulkan::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int leve gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE); // We may have blitted to a temp FBO. framebufferManager_->RebindFramebuffer("RebindFramebuffer - GetCurrentTextureDebug"); + if (!retval) + ERROR_LOG(G3D, "Failed to get debug texture: copy to memory failed"); return retval; } else { return false;