diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index 55849ab30..7a2af40bd 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -33,6 +33,7 @@ #include #include #include +#include "Runtime/Graphics/CTexture.hpp" using namespace std::literals; @@ -510,7 +511,6 @@ int main(int argc, char** argv) { metaforce::CVarManager cvarMgr{fileMgr}; metaforce::CVarCommons cvarCmns{cvarMgr}; cvarMgr.parseCommandLine(args); - if (!restart) { // TODO add clear loggers func to logvisor so we can recreate loggers on restart bool logging = IsClientLoggingEnabled(argc, argv); @@ -560,6 +560,7 @@ int main(int argc, char** argv) { g_app->onImGuiAddTextures(); g_app->onAppLaunched(info); g_app->onAppWindowResized(info.windowSize); + metaforce::CTexture::SetMangleMips(cvarCmns.getMangleMipmaps()); while (!cvarMgr.restartRequired()) { const auto* event = aurora_update(); bool exiting = false; diff --git a/Runtime/ConsoleVariables/CVarCommons.cpp b/Runtime/ConsoleVariables/CVarCommons.cpp index aadd27d5f..c1d5b55ea 100644 --- a/Runtime/ConsoleVariables/CVarCommons.cpp +++ b/Runtime/ConsoleVariables/CVarCommons.cpp @@ -89,6 +89,9 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) { m_debugToolDrawPlatformCollision = m_mgr.findOrMakeCVar("debugTool.drawPlatformCollision", "Draws the bounding boxes of platforms"sv, false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugToolMangleMipmaps = m_mgr.findOrMakeCVar( + "debugTool.mangleMipmaps", "Sets each mipmap of a texture to a known color based on distance."sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly | CVar::EFlags::ModifyRestart); m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv, CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); m_lastDiscPath = m_mgr.findOrMakeCVar("lastDiscPath"sv, "Most recently loaded disc image path"sv, ""sv, diff --git a/Runtime/ConsoleVariables/CVarCommons.hpp b/Runtime/ConsoleVariables/CVarCommons.hpp index 7da5d6548..522e7e6d4 100644 --- a/Runtime/ConsoleVariables/CVarCommons.hpp +++ b/Runtime/ConsoleVariables/CVarCommons.hpp @@ -52,6 +52,7 @@ struct CVarCommons { CVar* m_debugToolDrawCollisionActors = nullptr; CVar* m_debugToolDrawMazePath = nullptr; CVar* m_debugToolDrawPlatformCollision = nullptr; + CVar* m_debugToolMangleMipmaps = nullptr; CVar* m_logFile = nullptr; CVar* m_lastDiscPath = nullptr; @@ -88,6 +89,9 @@ struct CVarCommons { void setLogFile(std::string_view log) { m_logFile->fromLiteral(log); } + bool getMangleMipmaps() const { return m_debugToolMangleMipmaps->toBoolean(); } + void setMangleMipmaps(bool b) { m_debugToolMangleMipmaps->fromBoolean(b); } + void serialize() { m_mgr.serialize(); } static CVarCommons* instance(); diff --git a/Runtime/Graphics/CTexture.cpp b/Runtime/Graphics/CTexture.cpp index 0e17a9515..0552d0aba 100644 --- a/Runtime/Graphics/CTexture.cpp +++ b/Runtime/Graphics/CTexture.cpp @@ -347,7 +347,7 @@ u32 CTexture::TexelFormatBitsPerPixel(ETexelFormat fmt) { } } -bool CTexture::sMangleMips = true; +bool CTexture::sMangleMips = false; u32 CTexture::sCurrentFrameCount = 0; u32 CTexture::sTotalAllocatedMemory = 0;