mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #19717 from hrydgard/tag-force-texture-hashing
Add special texture hashing mode solving the Tag Force problem
This commit is contained in:
commit
cc9a25cffa
4 changed files with 13 additions and 4 deletions
|
@ -301,6 +301,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri
|
|||
// Multiplies sizeInRAM/bytesPerLine in XXHASH by 0.5.
|
||||
options->Get("reduceHash", &reduceHash_, reduceHash_);
|
||||
options->Get("ignoreMipmap", &ignoreMipmap_, ignoreMipmap_);
|
||||
options->Get("skipLastDXT1Blocks128x64", &skipLastDXT1Blocks128x64_, skipLastDXT1Blocks128x64_);
|
||||
if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) {
|
||||
reduceHash_ = false;
|
||||
ERROR_LOG(Log::TexReplacement, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead.");
|
||||
|
@ -506,14 +507,17 @@ u32 TextureReplacer::ComputeHash(u32 addr, int bufw, int w, int h, bool swizzled
|
|||
}
|
||||
|
||||
const u8 *checkp = Memory::GetPointerUnchecked(addr);
|
||||
|
||||
float reduceHashSize = 1.0f;
|
||||
if (reduceHash_) {
|
||||
reduceHashSize = LookupReduceHashRange(w, h);
|
||||
// default to reduceHashGlobalValue which default is 0.5
|
||||
}
|
||||
|
||||
if (bufw <= w) {
|
||||
// We can assume the data is contiguous. These are the total used pixels.
|
||||
const u32 totalPixels = bufw * h + (w - bufw);
|
||||
const u32 sizeInRAM = (textureBitsPerPixel[fmt] * totalPixels) / 8 * reduceHashSize;
|
||||
u32 sizeInRAM = (textureBitsPerPixel[fmt] * totalPixels) / 8 * reduceHashSize;
|
||||
|
||||
// Sanity check: Ignore textures that are at the end of RAM.
|
||||
if (Memory::MaxSizeAtAddress(addr) < sizeInRAM) {
|
||||
|
@ -521,6 +525,12 @@ u32 TextureReplacer::ComputeHash(u32 addr, int bufw, int w, int h, bool swizzled
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Hack for Yu Gi Oh texture hashing problem. See issue #19714
|
||||
if (skipLastDXT1Blocks128x64_ && fmt == GE_TFMT_DXT1 && w == 128 && h == 64) {
|
||||
// Skip the last few blocks as specified.
|
||||
sizeInRAM -= 8 * skipLastDXT1Blocks128x64_;
|
||||
}
|
||||
|
||||
switch (hash_) {
|
||||
case ReplacedTextureHash::QUICK:
|
||||
return StableQuickTexHash(checkp, sizeInRAM);
|
||||
|
|
|
@ -149,8 +149,8 @@ protected:
|
|||
bool ignoreAddress_ = false;
|
||||
bool reduceHash_ = false;
|
||||
bool ignoreMipmap_ = false;
|
||||
int skipLastDXT1Blocks128x64_ = 0;
|
||||
|
||||
float reduceHashSize = 1.0f; // default value with reduceHash to false
|
||||
float reduceHashGlobalValue = 0.5f; // Global value for textures dump pngs of all sizes, 0.5 by default but can be set in textures.ini
|
||||
|
||||
double lastTextureCacheSizeGB_ = 0.0;
|
||||
|
|
|
@ -652,8 +652,6 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
|||
}
|
||||
// Format might be wrong in lowMemoryMode_, so don't save.
|
||||
if (plan.saveTexture && !lowMemoryMode_) {
|
||||
INFO_LOG(Log::G3D, "Calling NotifyTextureDecoded %08x", entry->addr);
|
||||
|
||||
// When hardware texture scaling is enabled, this saves the original.
|
||||
int w = dataScaled ? mipWidth : mipUnscaledWidth;
|
||||
int h = dataScaled ? mipHeight : mipUnscaledHeight;
|
||||
|
|
|
@ -2089,6 +2089,7 @@ UI::EventReturn DeveloperToolsScreen::OnLoggingChanged(UI::EventParams &e) {
|
|||
}
|
||||
|
||||
UI::EventReturn DeveloperToolsScreen::OnRunCPUTests(UI::EventParams &e) {
|
||||
// TODO: If game is loaded, don't do anything.
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
RunTests();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue