GPU/TextureCache: Only use a single palette record for C16

Stops C16 textures larger than 256x256 being split up.
This commit is contained in:
Stenzek 2025-01-28 17:33:34 +10:00
parent b0c0d6444c
commit f58fa2297e
No known key found for this signature in database
2 changed files with 16 additions and 3 deletions

View File

@ -1818,8 +1818,21 @@ void GPUTextureCache::UpdateVRAMWriteSources(VRAMWrite* entry, SourceKey source_
return;
// Add to the palette tracking list
auto iter = std::find_if(entry->palette_records.begin(), entry->palette_records.end(),
[&source_key](const auto& it) { return (it.key == source_key); });
std::vector<VRAMWrite::PaletteRecord>::iterator iter;
if (source_key.HasPalette())
{
// Palette requires exact match.
iter = std::find_if(entry->palette_records.begin(), entry->palette_records.end(),
[&source_key](const auto& it) { return (it.key == source_key); });
}
else
{
// C16 only needs to match on the mode, palette is not used, and page doesn't matter.
// In theory we could extend the page skipping to palette textures too, but is it needed?
iter = std::find_if(entry->palette_records.begin(), entry->palette_records.end(),
[&source_key](const auto& it) { return (it.key.mode == source_key.mode); });
}
if (iter != entry->palette_records.end())
{
iter->rect = iter->rect.runion(write_intersection);

View File

@ -58,7 +58,7 @@ struct TListNode
TListNode<T>* next;
};
struct SourceKey
struct alignas(4) SourceKey
{
u8 page;
GPUTextureMode mode;