diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 7a4fc786eb..d8c26f3243 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -804,7 +804,11 @@ void TextureCacheCommon::NotifyFramebuffer(u32 address, VirtualFramebuffer *fram depth ? "DEPTH" : "COLOR", (int)candidates.size(), addr, framebuffer->width, framebuffer->height, depth ? framebuffer->z_stride : framebuffer->fb_stride, GeBufferFormatToString(framebuffer->format)); } - AttachBestCandidate(candidates); + // There can actually be multiple ones to update here! This can be the case where two textures point to different framebuffers that share depth buffers. + // So we have no choice but to run all the candidate matches. + for (int i = 0; i < (int)candidates.size(); i++) { + ApplyFramebufferMatch(candidates[i].match, candidates[i].entry, framebuffer->fb_address, framebuffer, candidates[i].channel); + } } break; } @@ -845,13 +849,11 @@ void TextureCacheCommon::AttachFramebufferValid(TexCacheEntry *entry, VirtualFra cacheSizeEstimate_ -= EstimateTexMemoryUsage(entry); } ReleaseTexture(entry, true); + entry->framebuffer = framebuffer; entry->invalidHint = 0; entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; entry->maxLevel = 0; - if (channel == NOTIFY_FB_DEPTH) { - entry->status |= TexCacheEntry::STATUS_DEPTH; - } fbTexInfo_[cachekey] = fbInfo; framebuffer->last_frame_attached = gpuStats.numFlips; GPUDebug::NotifyTextureAttachment(entry->addr); @@ -873,9 +875,6 @@ void TextureCacheCommon::AttachFramebufferInvalid(TexCacheEntry *entry, VirtualF entry->invalidHint = -1; entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; entry->maxLevel = 0; - if (channel == NOTIFY_FB_DEPTH) { - entry->status |= TexCacheEntry::STATUS_DEPTH; - } fbTexInfo_[cachekey] = fbInfo; GPUDebug::NotifyTextureAttachment(entry->addr); } diff --git a/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp b/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp index 87920c52a7..05fdf3a4a9 100644 --- a/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp +++ b/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp @@ -195,7 +195,8 @@ bool GenerateVulkanGLSLFragmentShader(const FShaderID &id, char *buffer, uint32_ } } else { if (doTextureProjection) { - // We don't use textureProj because we need better control and it's probably not much of a savings anyway. + // We don't use textureProj because we need to manually offset from the divided coordinate to do filtering here. + // On older hardware it has the advantage of higher resolution math, but such old hardware can't run Vulkan. WRITE(p, " vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord, texcoord); } else { WRITE(p, " vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord);