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.
This commit is contained in:
Billy Laws 2023-02-20 13:42:47 +00:00
parent 34fddfccba
commit 1dd13e90b0
2 changed files with 5 additions and 6 deletions

View File

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

View File

@ -41,7 +41,7 @@ namespace skyline::gpu::interconnect {
struct CacheEntry {
TextureImageControl tic;
TextureView *view;
ContextTag executionTag;
u64 sequenceNumber;
};
std::vector<CacheEntry> textureHeaderCache;