Merge pull request #15882 from unknownbrackets/mip-clut

GPU: Share CLUTs if no extended CLUT
This commit is contained in:
Henrik Rydgård 2022-08-22 05:53:34 +02:00 committed by GitHub
commit 64baff080a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 16 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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;