void DefRTsOnModeChanged() { // Causes a crash ingame, so only allow in main menu if( !engine->IsInGame() ) { InitDeferredRTs(); } }
bool CDeferredManagerClient::Init() { CopyDev(); AssertMsg( g_pCurrentViewRender == NULL, "viewrender already allocated?!" ); const bool bForceDeferred = CommandLine() && CommandLine()->FindParm("-forcedeferred") != 0; bool bSM30 = g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95; if ( !bSM30 ) { Warning( "The engine doesn't recognize your GPU to support SM3.0, running deferred anyway...\n" ); bSM30 = true; } if ( bSM30 || bForceDeferred ) { bool bGotDefShaderDll = ConnectDeferredExt(); if ( bGotDefShaderDll ) { g_pOldMatSystem = materials; g_DeferredMaterialSystem.InitPassThru( materials ); materials = &g_DeferredMaterialSystem; engine->Mat_Stub( &g_DeferredMaterialSystem ); m_bDefRenderingEnabled = true; GetDeferredExt()->EnableDeferredLighting(); g_pCurrentViewRender = new CDeferredViewRender(); ConVarRef r_shadows( "r_shadows" ); r_shadows.SetValue( "0" ); InitDeferredRTs( true ); materials->AddModeChangeCallBack( &DefRTsOnModeChanged ); InitializeDeferredMaterials(); } } if ( !m_bDefRenderingEnabled ) { Assert( g_pCurrentViewRender == NULL ); Warning( "Your hardware does not seem to support shader model 3.0. If you think that this is an error (hybrid GPUs), add -forcedeferred as start parameter.\n" ); g_pCurrentViewRender = new CViewRender(); } else { #define VENDOR_NVIDIA 0x10DE #define VENDOR_INTEL 0x8086 #define VENDOR_ATI 0x1002 #define VENDOR_AMD 0x1022 #ifndef SHADOWMAPPING_USE_COLOR MaterialAdapterInfo_t info; materials->GetDisplayAdapterInfo( materials->GetCurrentAdapter(), info ); if ( info.m_VendorID == VENDOR_ATI || info.m_VendorID == VENDOR_AMD ) { vgui::MessageBox *pATIWarning = new vgui::MessageBox("UNSUPPORTED HARDWARE", VarArgs( "AMD/ATI IS NOT YET SUPPORTED IN HARDWARE FILTERING MODE\n" "(cdeferred_manager_client.cpp #%i).", __LINE__ ) ); pATIWarning->InvalidateLayout(); pATIWarning->DoModal(); } #endif } return true; }
bool CDeferredManagerClient::Init() { AssertMsg( g_pCurrentViewRender == NULL, "viewrender already allocated?!" ); // Make sure deferred lighting setting is read out at this point ReadVideoCfgExt(); const bool bLowPerfSystem = GetGPULevel() <= GPU_LEVEL_LOW || GetGPUMemLevel() <= GPU_MEM_LEVEL_LOW || GetCPULevel() <= CPU_LEVEL_LOW; const int iDeferredLevel = CommandLine() ? CommandLine()->ParmValue("-deferred", 1) : 1; const bool bAllowDeferred = deferred_lighting_enabled.GetBool() && !bLowPerfSystem && (!CommandLine() || CommandLine()->FindParm("-disabledeferred") == 0); const bool bForceDeferred = CommandLine() && CommandLine()->FindParm("-forcedeferred") != 0; bool bSM30 = g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95; if ( !bSM30 ) { Warning( "The engine doesn't recognize your GPU to support SM3.0, running deferred anyway...\n" ); bSM30 = true; } if ( bAllowDeferred && (bSM30 || bForceDeferred) ) { bool bGotDefShaderDll = ConnectDeferredExt(); if ( bGotDefShaderDll ) { m_bDefRenderingEnabled = true; GetDeferredExt()->EnableDeferredLighting(); if( iDeferredLevel > 1 ) g_pCurrentViewRender = new CDeferredViewRender(); else g_pCurrentViewRender = new CViewRender(); ConVarRef r_shadows( "r_shadows" ); r_shadows.SetValue( "0" ); InitDeferredRTs( true ); materials->AddModeChangeCallBack( &DefRTsOnModeChanged ); InitializeDeferredMaterials(); } } if ( !m_bDefRenderingEnabled ) { Assert( g_pCurrentViewRender == NULL ); if( bAllowDeferred ) Warning( "Your hardware does not seem to support shader model 3.0. If you think that this is an error (hybrid GPUs), add -forcedeferred as start parameter.\n" ); g_pCurrentViewRender = new CViewRender(); } else { #define VENDOR_NVIDIA 0x10DE #define VENDOR_INTEL 0x8086 #define VENDOR_ATI 0x1002 #define VENDOR_AMD 0x1022 #ifndef SHADOWMAPPING_USE_COLOR MaterialAdapterInfo_t info; materials->GetDisplayAdapterInfo( materials->GetCurrentAdapter(), info ); if ( info.m_VendorID == VENDOR_ATI || info.m_VendorID == VENDOR_AMD ) { vgui::MessageBox *pATIWarning = new vgui::MessageBox("UNSUPPORTED HARDWARE", VarArgs( "AMD/ATI IS NOT YET SUPPORTED IN HARDWARE FILTERING MODE\n" "(cdeferred_manager_client.cpp #%i).", __LINE__ ) ); pATIWarning->InvalidateLayout(); pATIWarning->DoModal(); } #endif } return true; }
void DefRTsOnModeChanged() { InitDeferredRTs(); }