GSdx: Automatic HW Mipmapping option

Adds automatic HW mipmapping support.
It relies on CRC ids so if a game does
not have their CRC id but needs mipmapping
it will not work until the id is added.

Add GUI menu and tooltip for Automatic mipmap
"Automatic (Default)"
This option will be default option from now on.

Rename "Very Slow" text option to "Slow" for full mipmap
as it caused the text not to fit properly in the menu.

Credits also go to @RedPanda4552 and @ssakash for helping
with the code.
This commit is contained in:
lightningterror 2017-10-14 13:00:26 +02:00 committed by Gregory Hainaut
parent 431b4f6f17
commit 6d49bf6fc6
6 changed files with 97 additions and 7 deletions

View File

@ -1440,6 +1440,14 @@ enum class TriFiltering : uint8
Forced,
};
enum class HWMipmapLevel : int
{
Automatic = -1,
Off,
Basic,
Full
};
enum class CRCHackLevel : int8
{
Automatic = -1,

View File

@ -178,9 +178,10 @@ CRC::Game CRC::m_games[] =
{0x72E1E60E, Spartan, EU, 0},
{0x26689C87, Spartan, JP, 0},
{0x08277A9E, Spartan, US, 0},
{0xA32F7CD0, AceCombat4, US, 0},
{0xA32F7CD0, AceCombat4, US, 0}, // Also needed for automatic mipmapping
{0x5ED8FB53, AceCombat4, JP, 0},
{0x1B9B7563, AceCombat4, EU, 0},
{0x39B574F0, AceCombat5, US, 0},
{0xFC46EA61, Tekken5, JP, 0},
{0x1F88EE37, Tekken5, EU, 0},
{0x1F88BECD, Tekken5, EU, 0}, //language selector...
@ -253,7 +254,7 @@ CRC::Game CRC::m_games[] =
{0x774DE8E2, ValkyrieProfile2, JP, 0},
{0x04CCB600, ValkyrieProfile2, EU, 0},
{0xB65E141B, ValkyrieProfile2, DE, 0}, // PAL German
{0xC70FC973, ValkyrieProfile2, IT, 0},
{0xC70FC973, ValkyrieProfile2, IT, 0},
{0x47B9B2FD, RadiataStories, US, 0},
{0xAC73005E, RadiataStories, JP, 0},
{0xE8FCF8EC, SMTNocturne, US, ZWriteMustNotClear}, // saves/reloads z buffer around shadow drawing, same issue with all the SMT games following
@ -361,7 +362,7 @@ CRC::Game CRC::m_games[] =
{0x694A998E, TombRaiderUnderworld, JP, 0}, // cutie comment
{0x8E214549, TombRaiderUnderworld, EU, 0},
{0x618769D6, TombRaiderUnderworld, US, 0},
{0xB639EB17, TombRaiderAnniversary, US, 0},
{0xB639EB17, TombRaiderAnniversary, US, 0}, // Also needed for automatic mipmapping
{0xB05805B6, TombRaiderAnniversary, JP, 0}, // cutie comment
{0xA629A376, TombRaiderAnniversary, EU, 0},
{0xBC8B3F50, TombRaiderLegend, US, 0}, // cutie comment
@ -516,6 +517,33 @@ CRC::Game CRC::m_games[] =
{0xDF659E77, JakX, EU, 0},
{0x3091E6FB, JakX, US, 0},
{0x4653CA3E, HarleyDavidson, NoRegion, 0},
// Games list for Automatic Mipmapping
// Basic mipmapping
{0x65729657, AceCombatZero, US, 0},
{0x0940508D, BrianLaraInternationalCricket, EU, 0},
{0x67A29886, DestroyAllHumans, US, 0},
{0xE3E8E893, DestroyAllHumans, EU, 0},
{0x42DF8C8C, DestroyAllHumans2, US, 0},
{0x722BBD62, FIFA03, EU, 0},
{0x2BCCF704, FIFA03, EU, 0},
{0xCC6AA742, FIFA04, KO, 0},
{0x2C6A4E2E, FIFA04, US, 0},
{0x972611BB, FIFA05, US, 0},
{0x230CB71D, SoulReaver2, US, 0},
{0x6D8B4CD1, SoulReaver2, EU, 0},
{0x728AB07C, LegacyOfKainDefiance, US, 0},
{0xCE4933D0, RatchetAndClank, US, 0},
{0x76F724A3, RatchetAndClank, EU, 0},
{0xB3A71D10, RatchetAndClank2, US, 0}, // Going Commando
{0x38996035, RatchetAndClank2, US, 0},
{0x2F486E6F, RatchetAndClank2, EU, 0},
{0x45FE0CC4, RatchetAndClank3, US, 0}, // Up Your Arsenal
{0x9BFBCD42, RatchetAndClank4, US, 0}, // Deadlocked
{0x8661F7BA, RatchetAndClank5, US, 0}, // Size Matters
{0x8634861F, RickyPontingInternationalCricket, EU, 0},
{0x2B58234D, TribesAerialAssault, US, 0},
{0x4D22DB95, Whiplash, US, 0},
{0xB1BE3E51, Whiplash, EU, 0},
};
std::map<uint32, CRC::Game*> CRC::m_map;

View File

@ -27,12 +27,15 @@ public:
enum Title
{
NoTitle,
AceCombatZero,
AceCombat4,
AceCombat5,
ArTonelico2,
BigMuthaTruckers,
Black,
BlackHawkDown,
BleachBladeBattlers,
BrianLaraInternationalCricket,
Bully,
BullyCC,
BurnoutDominator,
@ -48,6 +51,8 @@ public:
DBZBT3,
DeathByDegreesTekkenNinaWilliams,
DemonStone,
DestroyAllHumans,
DestroyAllHumans2,
DevilMayCry3,
Dororo,
DuelSaviorDestiny,
@ -56,6 +61,9 @@ public:
FFX,
FFX2,
FFXII,
FIFA03,
FIFA04,
FIFA05,
FightingBeautyWulong,
FinalFightStreetwise,
FrontMission5,
@ -90,6 +98,7 @@ public:
Kunoichi,
KyuuketsuKitanMoonties,
Lamune,
LegacyOfKainDefiance,
LegoBatman,
LordOfTheRingsThirdAge,
LordOfTheRingsTwoTowers,
@ -109,8 +118,14 @@ public:
Onimusha3,
PiaCarroteYoukosoGPGakuenPrincess,
RadiataStories,
RatchetAndClank,
RatchetAndClank2,
RatchetAndClank3,
RatchetAndClank4,
RatchetAndClank5,
RedDeadRevolver,
ResidentEvil4,
RickyPontingInternationalCricket,
RozenMaidenGebetGarden,
SacredBlaze,
SakuraTaisen,
@ -137,6 +152,7 @@ public:
SoTC,
SoulCalibur2,
SoulCalibur3,
SoulReaver2,
Spartan,
SpyroEternalNight,
SpyroNewBeginning,
@ -159,6 +175,7 @@ public:
TombRaiderAnniversary,
TombRaiderLegend,
TombRaiderUnderworld,
TribesAerialAssault,
TomoyoAfter,
TouristTrophy,
UltramanFightingEvolution,
@ -166,6 +183,7 @@ public:
ValkyrieProfile2,
VF4,
VF4EVO,
Whiplash,
WildArms4,
WildArms5,
XE3,

View File

@ -186,6 +186,37 @@ void GSRendererHW::SetGameCRC(uint32 crc, int options)
GSRenderer::SetGameCRC(crc, options);
m_hacks.SetGameCRC(m_game);
// Code for Automatic Mipmapping. Relies on game CRCs.
if (theApp.GetConfigT<HWMipmapLevel>("mipmap_hw") == HWMipmapLevel::Automatic) {
switch (CRC::Lookup(crc).title) {
case CRC::AceCombatZero:
case CRC::AceCombat4:
case CRC::AceCombat5:
case CRC::BrianLaraInternationalCricket:
case CRC::DestroyAllHumans:
case CRC::DestroyAllHumans2:
case CRC::FIFA03:
case CRC::FIFA04:
case CRC::FIFA05:
case CRC::SoulReaver2:
case CRC::LegacyOfKainDefiance:
case CRC::RatchetAndClank:
case CRC::RatchetAndClank2:
case CRC::RatchetAndClank3:
case CRC::RatchetAndClank4:
case CRC::RatchetAndClank5:
case CRC::RickyPontingInternationalCricket:
case CRC::TombRaiderAnniversary:
case CRC::TribesAerialAssault:
case CRC::Whiplash:
m_mipmap = static_cast<int>(HWMipmapLevel::Basic);
break;
default:
m_mipmap = static_cast<int>(HWMipmapLevel::Off);
break;
}
}
}
bool GSRendererHW::CanUpscale()

View File

@ -181,6 +181,8 @@ const char* dialog_message(int ID, bool* updateText) {
return "Uploads GS data when rendering a new frame to reproduce some effects accurately. Fixes black screen issues in games like Armored Core: Last Raven.";
case IDC_MIPMAP_HW:
return "Control the accuracy level of the mipmapping emulation\n\n"
"Automatic:\nAutomatically sets the mipmapping level based on the game.\n"
"This is the recommended setting.\n\n"
"Off:\nMipmapping emulation is disabled.\n\n"
"Basic (Fast):\nPartially emulates mipmapping, performance impact is negligible in most cases.\n\n"
"Full (Slow):\nCompletely emulates the mipmapping function of the GS, might significantly impact performance.";

View File

@ -276,9 +276,12 @@ void GSdxApp::Init()
m_gs_offset_hack.push_back(GSSetting(2, "Special", "Texture"));
m_gs_offset_hack.push_back(GSSetting(3, "Special", "Texture - aggressive"));
m_gs_hw_mipmapping.push_back(GSSetting(0, "Off", ""));
m_gs_hw_mipmapping.push_back(GSSetting(1, "Basic", "Fast"));
m_gs_hw_mipmapping.push_back(GSSetting(2, "Full", "Very Slow - Not Recommended"));
m_gs_hw_mipmapping = {
GSSetting(HWMipmapLevel::Automatic, "Automatic", "Default"),
GSSetting(HWMipmapLevel::Off, "Off", ""),
GSSetting(HWMipmapLevel::Basic, "Basic", "Fast"),
GSSetting(HWMipmapLevel::Full, "Full", "Slow"),
};
m_gs_crc_level = {
GSSetting(CRCHackLevel::Automatic, "Automatic", "Default"),
@ -373,7 +376,7 @@ void GSdxApp::Init()
m_default_configuration["linear_present"] = "1";
m_default_configuration["MaxAnisotropy"] = "0";
m_default_configuration["mipmap"] = "1";
m_default_configuration["mipmap_hw"] = "0";
m_default_configuration["mipmap_hw"] = std::to_string(static_cast<int>(HWMipmapLevel::Automatic));
m_default_configuration["ModeHeight"] = "480";
m_default_configuration["ModeWidth"] = "640";
m_default_configuration["NTSC_Saturation"] = "1";