mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-02 18:46:52 +00:00
Make sure we don't hash outside max bytes.
If we've never even loaded that much, play it safe.
This commit is contained in:
parent
5822faabf9
commit
ab67c49ae9
@ -865,7 +865,12 @@ void TextureCacheDX9::UpdateCurrentClut() {
|
||||
const u32 clutBaseBytes = clutBase * (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
|
||||
// Technically, these extra bytes weren't loaded, but hopefully it was loaded earlier.
|
||||
// If not, we're going to hash random data, which hopefully doesn't cause a performance issue.
|
||||
const u32 clutExtendedBytes = clutTotalBytes_ + clutBaseBytes;
|
||||
//
|
||||
// TODO: Actually, this seems like a hack. The game can upload part of a CLUT and reference other data.
|
||||
// clutTotalBytes_ is the last amount uploaded. We should hash clutMaxBytes_, but this will often hash
|
||||
// unrelated old entries for small palettes.
|
||||
// Adding clutBaseBytes may just be mitigating this for some usage patterns.
|
||||
const u32 clutExtendedBytes = std::min(clutTotalBytes_ + clutBaseBytes, clutMaxBytes_);
|
||||
|
||||
clutHash_ = DoReliableHash32((const char *)clutBufRaw_, clutExtendedBytes, 0xC0108888);
|
||||
clutBuf_ = clutBufRaw_;
|
||||
|
@ -997,7 +997,7 @@ void TextureCache::UpdateCurrentClut() {
|
||||
// clutTotalBytes_ is the last amount uploaded. We should hash clutMaxBytes_, but this will often hash
|
||||
// unrelated old entries for small palettes.
|
||||
// Adding clutBaseBytes may just be mitigating this for some usage patterns.
|
||||
const u32 clutExtendedBytes = clutTotalBytes_ + clutBaseBytes;
|
||||
const u32 clutExtendedBytes = std::min(clutTotalBytes_ + clutBaseBytes, clutMaxBytes_);
|
||||
|
||||
clutHash_ = DoReliableHash32((const char *)clutBufRaw_, clutExtendedBytes, 0xC0108888);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user