From 1dd13e90b0d2bd6b8542549eba47096d54ece57d Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 20 Feb 2023 13:42:47 +0000 Subject: [PATCH] Use channel sequence number for TIC cache validity tracking Fixes some OpenGL games which update a TIC with I2M but never end up triggering an execution otherwise. --- .../cpp/skyline/gpu/interconnect/common/textures.cpp | 9 ++++----- .../main/cpp/skyline/gpu/interconnect/common/textures.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/common/textures.cpp b/app/src/main/cpp/skyline/gpu/interconnect/common/textures.cpp index 0ccb4886..07f095d0 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/common/textures.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/common/textures.cpp @@ -243,11 +243,11 @@ namespace skyline::gpu::interconnect { std::fill(textureHeaderCache.begin(), textureHeaderCache.end(), CacheEntry{}); } else if (textureHeaders.size() > index && textureHeaderCache[index].view) { auto &cached{textureHeaderCache[index]}; - if (cached.executionTag == ctx.executor.executionTag) + if (cached.sequenceNumber == ctx.channelCtx.channelSequenceNumber) return cached.view; if (cached.tic == textureHeaders[index] && !cached.view->texture->replaced) { - cached.executionTag = ctx.executor.executionTag; + cached.sequenceNumber = ctx.channelCtx.channelSequenceNumber; return cached.view; } } @@ -346,18 +346,17 @@ namespace skyline::gpu::interconnect { auto mappings{ctx.channelCtx.asCtx->gmmu.TranslateRange(textureHeader.Iova(), guest.GetSize())}; guest.mappings.assign(mappings.begin(), mappings.end()); - if (guest.mappings.empty() || !guest.mappings.front().valid()) { + if (guest.mappings.empty() || !guest.mappings.front().valid() || guest.mappings.front().empty()) { Logger::Warn("Unmapped texture in pool: 0x{:X}", textureHeader.Iova()); if (!nullTextureView) nullTextureView = CreateNullTexture(ctx); return nullTextureView.get(); } - texture = ctx.gpu.texture.FindOrCreate(guest, ctx.executor.tag); } - textureHeaderCache[index] = {textureHeader, texture.get(), ctx.executor.executionTag}; + textureHeaderCache[index] = {textureHeader, texture.get(), ctx.channelCtx.channelSequenceNumber}; return texture.get(); } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/common/textures.h b/app/src/main/cpp/skyline/gpu/interconnect/common/textures.h index 53213245..45e35d30 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/common/textures.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/common/textures.h @@ -41,7 +41,7 @@ namespace skyline::gpu::interconnect { struct CacheEntry { TextureImageControl tic; TextureView *view; - ContextTag executionTag; + u64 sequenceNumber; }; std::vector textureHeaderCache;