Skip to content

Commit e8518c0

Browse files
committed
Add CVar for mangle mipmaps
1 parent 247f361 commit e8518c0

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Runtime/CMain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <aurora/main.h>
3434
#include <dolphin/vi.h>
3535
#include <SDL3/SDL_messagebox.h>
36+
#include "Runtime/Graphics/CTexture.hpp"
3637

3738
using namespace std::literals;
3839

@@ -510,7 +511,6 @@ int main(int argc, char** argv) {
510511
metaforce::CVarManager cvarMgr{fileMgr};
511512
metaforce::CVarCommons cvarCmns{cvarMgr};
512513
cvarMgr.parseCommandLine(args);
513-
514514
if (!restart) {
515515
// TODO add clear loggers func to logvisor so we can recreate loggers on restart
516516
bool logging = IsClientLoggingEnabled(argc, argv);
@@ -560,6 +560,7 @@ int main(int argc, char** argv) {
560560
g_app->onImGuiAddTextures();
561561
g_app->onAppLaunched(info);
562562
g_app->onAppWindowResized(info.windowSize);
563+
metaforce::CTexture::SetMangleMips(cvarCmns.getMangleMipmaps());
563564
while (!cvarMgr.restartRequired()) {
564565
const auto* event = aurora_update();
565566
bool exiting = false;

Runtime/ConsoleVariables/CVarCommons.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
8989
m_debugToolDrawPlatformCollision =
9090
m_mgr.findOrMakeCVar("debugTool.drawPlatformCollision", "Draws the bounding boxes of platforms"sv, false,
9191
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
92+
m_debugToolMangleMipmaps = m_mgr.findOrMakeCVar(
93+
"debugTool.mangleMipmaps", "Sets each mipmap of a texture to a known color based on distance."sv, false,
94+
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly | CVar::EFlags::ModifyRestart);
9295
m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv,
9396
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart);
9497
m_lastDiscPath = m_mgr.findOrMakeCVar("lastDiscPath"sv, "Most recently loaded disc image path"sv, ""sv,

Runtime/ConsoleVariables/CVarCommons.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct CVarCommons {
5252
CVar* m_debugToolDrawCollisionActors = nullptr;
5353
CVar* m_debugToolDrawMazePath = nullptr;
5454
CVar* m_debugToolDrawPlatformCollision = nullptr;
55+
CVar* m_debugToolMangleMipmaps = nullptr;
5556
CVar* m_logFile = nullptr;
5657
CVar* m_lastDiscPath = nullptr;
5758

@@ -88,6 +89,9 @@ struct CVarCommons {
8889

8990
void setLogFile(std::string_view log) { m_logFile->fromLiteral(log); }
9091

92+
bool getMangleMipmaps() const { return m_debugToolMangleMipmaps->toBoolean(); }
93+
void setMangleMipmaps(bool b) { m_debugToolMangleMipmaps->fromBoolean(b); }
94+
9195
void serialize() { m_mgr.serialize(); }
9296

9397
static CVarCommons* instance();

Runtime/Graphics/CTexture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ u32 CTexture::TexelFormatBitsPerPixel(ETexelFormat fmt) {
347347
}
348348
}
349349

350-
bool CTexture::sMangleMips = true;
350+
bool CTexture::sMangleMips = false;
351351
u32 CTexture::sCurrentFrameCount = 0;
352352
u32 CTexture::sTotalAllocatedMemory = 0;
353353

0 commit comments

Comments
 (0)