@@ -903,7 +903,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
903903 GfxInfo_f
904904 ================
905905 */
906- void GfxInfo_f ()
906+ static void GfxInfo_f ()
907907 {
908908 static const char fsstrings[][16 ] =
909909 {
@@ -1082,31 +1082,44 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
10821082 Log::Debug (" replaceMaterialMinDimensionIfPresentWithMaxDimension: %d" , r_replaceMaterialMinDimensionIfPresentWithMaxDimension->integer );
10831083 }
10841084
1085- static void GLSL_restart_f ()
1086- {
1087- // make sure the render thread is stopped
1088- R_SyncRenderThread ( );
1085+ // FIXME: uses regular logging not Print ()
1086+ static Cmd::LambdaCmd gfxInfoCmd (
1087+ " gfxinfo " , " dump graphics driver and configuration info " ,
1088+ []( const Cmd::Args & ) { GfxInfo_f (); } );
10891089
1090- GLSL_ShutdownGPUShaders ();
1091- GLSL_InitGPUShaders ();
1090+ class GlslRestartCmd : public Cmd ::StaticCmd
1091+ {
1092+ public:
1093+ GlslRestartCmd () : StaticCmd(
1094+ " glsl_restart" , " recompile GLSL shaders (useful when shaderpath is set)" ) {}
10921095
1093- for ( int i = 0 ; i < tr. numShaders ; i++ )
1096+ void Run ( const Cmd::Args & ) const override
10941097 {
1095- shader_t &shader = *tr.shaders [ i ];
1096- if ( shader.stages == shader.lastStage || shader.stages [ 0 ].deformIndex == 0 )
1097- {
1098- continue ;
1099- }
1098+ // make sure the render thread is stopped
1099+ R_SyncRenderThread ();
11001100
1101- int deformIndex =
1102- gl_shaderManager. getDeformShaderIndex ( shader. deforms , shader. numDeforms );
1101+ GLSL_ShutdownGPUShaders ();
1102+ GLSL_InitGPUShaders ( );
11031103
1104- for ( shaderStage_t *stage = shader. stages ; stage != shader. lastStage ; stage ++ )
1104+ for ( int i = 0 ; i < tr. numShaders ; i ++ )
11051105 {
1106- stage->deformIndex = deformIndex;
1106+ shader_t &shader = *tr.shaders [ i ];
1107+ if ( shader.stages == shader.lastStage || shader.stages [ 0 ].deformIndex == 0 )
1108+ {
1109+ continue ;
1110+ }
1111+
1112+ int deformIndex =
1113+ gl_shaderManager.getDeformShaderIndex ( shader.deforms , shader.numDeforms );
1114+
1115+ for ( shaderStage_t *stage = shader.stages ; stage != shader.lastStage ; stage++ )
1116+ {
1117+ stage->deformIndex = deformIndex;
1118+ }
11071119 }
11081120 }
1109- }
1121+ };
1122+ static GlslRestartCmd glslRestartCmdRegistration;
11101123
11111124 /*
11121125 ===============
@@ -1354,13 +1367,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
13541367 r_showParallelShadowSplits = Cvar_Get ( " r_showParallelShadowSplits" , " 0" , CVAR_CHEAT | CVAR_LATCH );
13551368
13561369 Cvar::Latch ( r_profilerRenderSubGroups );
1357-
1358- // make sure all the commands added here are also removed in R_Shutdown
1359- ri.Cmd_AddCommand ( " shaderexp" , R_ShaderExp_f );
1360- ri.Cmd_AddCommand ( " gfxinfo" , GfxInfo_f );
1361- ri.Cmd_AddCommand ( " buildcubemaps" , R_BuildCubeMaps );
1362-
1363- ri.Cmd_AddCommand ( " glsl_restart" , GLSL_restart_f );
13641370 }
13651371
13661372 /*
@@ -1533,12 +1539,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
15331539 {
15341540 Log::Debug (" RE_Shutdown( destroyWindow = %i )" , destroyWindow );
15351541
1536- ri.Cmd_RemoveCommand ( " shaderexp" );
1537- ri.Cmd_RemoveCommand ( " gfxinfo" );
1538- ri.Cmd_RemoveCommand ( " buildcubemaps" );
1539-
1540- ri.Cmd_RemoveCommand ( " glsl_restart" );
1541-
15421542 if ( tr.registered )
15431543 {
15441544 R_SyncRenderThread ();
0 commit comments