@@ -409,6 +409,7 @@ static void ReadMaterialSystemConfigFromRegistry( MaterialSystem_Config_t &confi
409409 ReadVideoConfigInt ( " ScreenWidth" , &config.m_VideoMode .m_Width );
410410 ReadVideoConfigInt ( " ScreenHeight" , &config.m_VideoMode .m_Height );
411411 config.SetFlag ( MATSYS_VIDCFG_FLAGS_WINDOWED, ReadVideoConfigInt ( " ScreenWindowed" , 0 ) != 0 );
412+ config.SetFlag ( MATSYS_VIDCFG_FLAGS_BORDERLESS, ReadVideoConfigInt ( " ScreenNoBorder" , 0 ) != 0 );
412413#if defined( USE_SDL ) && !defined( SWDS )
413414 // Read the ScreenDisplayIndex and set sdl_displayindex if it's there.
414415 static ConVarRef conVar ( " sdl_displayindex" );
@@ -540,6 +541,7 @@ static void WriteMaterialSystemConfigToRegistry( const MaterialSystem_Config_t &
540541 WriteVideoConfigInt ( " ScreenWidth" , config.m_VideoMode .m_Width );
541542 WriteVideoConfigInt ( " ScreenHeight" , config.m_VideoMode .m_Height );
542543 WriteVideoConfigInt ( " ScreenWindowed" , config.Windowed () );
544+ WriteVideoConfigInt ( " ScreenNoBorder" , config.Borderless () );
543545 WriteVideoConfigInt ( " ScreenMSAA" , config.m_nAASamples );
544546 WriteVideoConfigInt ( " ScreenMSAAQuality" , config.m_nAAQuality );
545547 WriteVideoConfigInt ( " MotionBlur" , config.m_bMotionBlur ? 1 : 0 );
@@ -600,6 +602,12 @@ static void OverrideMaterialSystemConfigFromCommandLine( MaterialSystem_Config_t
600602 config.SetFlag ( MATSYS_VIDCFG_FLAGS_WINDOWED, false );
601603 }
602604
605+ // Check window is borderless
606+ if ( CommandLine ()->FindParm ( " -noborder" ) )
607+ {
608+ config.SetFlag ( MATSYS_VIDCFG_FLAGS_BORDERLESS, true );
609+ }
610+
603611 // Get width and height
604612 if ( CommandLine ()->FindParm ( " -width" ) || CommandLine ()->FindParm ( " -w" ) )
605613 {
@@ -859,6 +867,7 @@ void GetMaterialSystemConfigForBenchmarkUpload(KeyValues *dataToUpload)
859867 dataToUpload->SetInt ( " ShadowDepthTexture" , g_pMaterialSystemConfig->ShadowDepthTexture () );
860868 dataToUpload->SetInt ( " MotionBlur" , g_pMaterialSystemConfig->MotionBlur () );
861869 dataToUpload->SetInt ( " Windowed" , (g_pMaterialSystemConfig->m_Flags & MATSYS_VIDCFG_FLAGS_WINDOWED) ? 1 : 0 );
870+ dataToUpload->SetInt ( " Borderless" , (g_pMaterialSystemConfig->m_Flags & MATSYS_VIDCFG_FLAGS_BORDERLESS) ? 1 : 0 );
862871 dataToUpload->SetInt ( " Trilinear" , (g_pMaterialSystemConfig->m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR) ? 1 : 0 );
863872 dataToUpload->SetInt ( " ForceHWSync" , (g_pMaterialSystemConfig->m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC) ? 1 : 0 );
864873 dataToUpload->SetInt ( " NoWaitForVSync" , (g_pMaterialSystemConfig->m_Flags & MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC) ? 1 : 0 );
@@ -891,6 +900,7 @@ void PrintMaterialSystemConfig( const MaterialSystem_Config_t &config )
891900 Warning ( " dxSupportLevel: %d\n " , config.dxSupportLevel );
892901 Warning ( " monitorGamma: %f\n " , config.m_fMonitorGamma );
893902 Warning ( " MATSYS_VIDCFG_FLAGS_WINDOWED: %s\n " , ( config.m_Flags & MATSYS_VIDCFG_FLAGS_WINDOWED ) ? " true" : " false" );
903+ Warning ( " MATSYS_VIDCFG_FLAGS_BORDERLESS: %s\n " , ( config.m_Flags & MATSYS_VIDCFG_FLAGS_BORDERLESS ) ? " true" : " false" );
894904 Warning ( " MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR: %s\n " , ( config.m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR ) ? " true" : " false" );
895905 Warning ( " MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC: %s\n " , ( config.m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC ) ? " true" : " false" );
896906 Warning ( " MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR: %s\n " , ( config.m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR ) ? " true" : " false" );
@@ -913,16 +923,22 @@ CON_COMMAND( mat_configcurrent, "show the current video control panel config for
913923}
914924
915925#if !defined(SWDS) && !defined( _X360 )
916- CON_COMMAND ( mat_setvideomode, " sets the width, height, windowed state of the material system" )
926+ CON_COMMAND ( mat_setvideomode, " sets the width, height, windowed state and optional borderless state of the material system" )
917927{
918- if ( args.ArgC () != 4 )
928+ if ( args.ArgC () < 4 || args. ArgC () > 5 )
919929 return ;
920930
921931 int nWidth = Q_atoi ( args[1 ] );
922932 int nHeight = Q_atoi ( args[2 ] );
923- bool bWindowed = Q_atoi ( args[3 ] ) > 0 ? true : false ;
933+ bool bWindowed = Q_atoi ( args[3 ] ) > 0 ;
934+ bool bBorderless = args.ArgC () == 5 && Q_atoi ( args[4 ] ) > 0 ;
935+
936+ if ( !bWindowed && bBorderless )
937+ {
938+ Warning ( " Can't set borderless state when not windowed.\n " );
939+ }
924940
925- videomode->SetMode ( nWidth, nHeight, bWindowed );
941+ videomode->SetMode ( nWidth, nHeight, bWindowed, bBorderless );
926942}
927943#endif
928944
0 commit comments