From 6bf516f1effcae643013e014b423c23a0264605d Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:49:18 +0100 Subject: [PATCH] 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. --- src/materialsystem/cmaterialsystem.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/materialsystem/cmaterialsystem.cpp b/src/materialsystem/cmaterialsystem.cpp index 74237ae9..27b62eca 100644 --- a/src/materialsystem/cmaterialsystem.cpp +++ b/src/materialsystem/cmaterialsystem.cpp @@ -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 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 //---------------------------------------------------------------------------------