mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 21:34:16 +01:00
Avoid OOB memory acceses when trying to read OOB TICs
Some games pass in invalid texture handles (0xffff) when they don't need the texture so return the null texture in this case.
This commit is contained in:
parent
d8a4a2b08d
commit
177925be93
@ -225,7 +225,8 @@ namespace skyline::gpu::interconnect {
|
|||||||
if (textureHeaderCache.size() != textureHeaders.size()) {
|
if (textureHeaderCache.size() != textureHeaders.size()) {
|
||||||
textureHeaderCache.resize(textureHeaders.size());
|
textureHeaderCache.resize(textureHeaders.size());
|
||||||
std::fill(textureHeaderCache.begin(), textureHeaderCache.end(), CacheEntry{});
|
std::fill(textureHeaderCache.begin(), textureHeaderCache.end(), CacheEntry{});
|
||||||
} else if (auto &cached{textureHeaderCache[index]}; cached.view) {
|
} else if (textureHeaders.size() > index && textureHeaderCache[index].view) {
|
||||||
|
auto &cached{textureHeaderCache[index]};
|
||||||
if (cached.executionTag == ctx.executor.executionTag)
|
if (cached.executionTag == ctx.executor.executionTag)
|
||||||
return cached.view;
|
return cached.view;
|
||||||
|
|
||||||
@ -235,6 +236,13 @@ namespace skyline::gpu::interconnect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index >= textureHeaders.size()) {
|
||||||
|
if (!nullTextureView)
|
||||||
|
nullTextureView = CreateNullTexture(ctx);
|
||||||
|
|
||||||
|
return nullTextureView.get();
|
||||||
|
}
|
||||||
|
|
||||||
TextureImageControl &textureHeader{textureHeaders[index]};
|
TextureImageControl &textureHeader{textureHeaders[index]};
|
||||||
auto &texture{textureHeaderStore[textureHeader]};
|
auto &texture{textureHeaderStore[textureHeader]};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user