MaterialSystem: implement stream info dump command

Implement the ability to dump the entire texture streaming debug info to the console. This will also log it to the log file.
This commit is contained in:
Kawe Mazidjatari 2025-01-01 22:49:18 +01:00
parent b75655c101
commit 6bf516f1ef

View File

@ -121,6 +121,29 @@ void StreamDB_Init(const char* pszLevelName)
v_StreamDB_Init(pszLevelName);
}
static ConVar stream_overlay_memory("stream_overlay_memory", "524288", FCVAR_DEVELOPMENTONLY, "Total string memory to allocate for the texture streaming debug overlay.");
/*
=====================
Mat_DumpStreamInfo_f
Prints the stream info to the console.
=====================
*/
static void Mat_DumpStreamInfo_f(const CCommand& args)
{
const int stringMem = stream_overlay_memory.GetInt();
std::unique_ptr<char[]> stringBuf(new char[stringMem]);
const char* const mode = args.ArgC() >= 2 ? args.Arg(1) : stream_overlay_mode->GetString();
char* const scratch = stringBuf.get();
CMaterialSystem__GetStreamOverlay(mode, scratch, stringMem);
Msg(eDLL_T::MS, "%s\n", scratch);
}
static ConCommand stream_dumpinfo("stream_dumpinfo", Mat_DumpStreamInfo_f, "Dump texture streaming debug info to the console", FCVAR_DEVELOPMENTONLY, nullptr, "tex mtl bsp short");
//---------------------------------------------------------------------------------
// Purpose: draw frame
//---------------------------------------------------------------------------------