Simplify exception handling. Improve fallback if we can't set up an
OpenGL window.
This commit is contained in:
@@ -92,7 +92,7 @@ bool RageDisplay::SetVideoMode( VideoModeParams p )
|
||||
if( this->TryVideoMode(p,bNeedReloadTextures) )
|
||||
return bNeedReloadTextures;
|
||||
|
||||
RageException::Throw( "SetVideoMode failed. Tried to fall back to other modes, but nothing worked." );
|
||||
RageException::ThrowNonfatal( "SetVideoMode failed. Tried to fall back to other modes, but nothing worked." );
|
||||
}
|
||||
|
||||
void RageDisplay::ProcessStatsOnFlip()
|
||||
|
||||
@@ -232,7 +232,7 @@ static void FlushGLErrors()
|
||||
;
|
||||
}
|
||||
|
||||
RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p )
|
||||
RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p, bool bAllowUnacceleratedRenderer )
|
||||
{
|
||||
LOG->Trace( "RageDisplay_OGL::RageDisplay_OGL()" );
|
||||
LOG->MapLog("renderer", "Current renderer: OpenGL");
|
||||
@@ -241,15 +241,31 @@ RageDisplay_OGL::RageDisplay_OGL( VideoModeParams p )
|
||||
|
||||
wind = MakeLowLevelWindow();
|
||||
|
||||
SetVideoMode( p );
|
||||
try {
|
||||
SetVideoMode( p );
|
||||
} catch(...) {
|
||||
/* SetVideoMode can throw. */
|
||||
delete wind;
|
||||
throw;
|
||||
}
|
||||
|
||||
// Log driver details
|
||||
LOG->Info("OGL Vendor: %s", glGetString(GL_VENDOR));
|
||||
LOG->Info("OGL Renderer: %s", glGetString(GL_RENDERER));
|
||||
LOG->Info("OGL Version: %s", glGetString(GL_VERSION));
|
||||
LOG->Info("OGL Extensions: %s", glGetString(GL_EXTENSIONS));
|
||||
|
||||
if( IsSoftwareRenderer() )
|
||||
{
|
||||
if( !bAllowUnacceleratedRenderer )
|
||||
{
|
||||
delete wind;
|
||||
RageException::ThrowNonfatal(
|
||||
"Your system is reporting that OpenGL hardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n" );
|
||||
}
|
||||
LOG->Warn("This is a software renderer!");
|
||||
}
|
||||
|
||||
|
||||
/* Log this, so if people complain that the radar looks bad on their
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class RageDisplay_OGL: public RageDisplay
|
||||
{
|
||||
public:
|
||||
RageDisplay_OGL( VideoModeParams params );
|
||||
RageDisplay_OGL( VideoModeParams params, bool bAllowUnacceleratedRenderer );
|
||||
virtual ~RageDisplay_OGL();
|
||||
void Update(float fDeltaTime);
|
||||
|
||||
|
||||
@@ -378,17 +378,12 @@ RageDisplay *CreateDisplay()
|
||||
* SDL may throw, but that only happens with broken driver installations, and
|
||||
* we probably don't want to fall back on D3D in that case anyway.) */
|
||||
error += "Initializing OpenGL...\n";
|
||||
|
||||
RageDisplay *ret = new RageDisplay_OGL( params );
|
||||
|
||||
if( PREFSMAN->m_bAllowUnacceleratedRenderer || !ret->IsSoftwareRenderer() )
|
||||
return ret;
|
||||
else
|
||||
{
|
||||
error += "Your system is reporting that OpenGL hardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n";
|
||||
delete ret;
|
||||
}
|
||||
try {
|
||||
return new RageDisplay_OGL( params, PREFSMAN->m_bAllowUnacceleratedRenderer );
|
||||
} catch(RageException e) {
|
||||
error += CString(e.what()) + "\n";
|
||||
continue;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
else if( sRenderer.CompareNoCase("d3d")==0 )
|
||||
@@ -402,6 +397,8 @@ RageDisplay *CreateDisplay()
|
||||
} catch(RageException_D3DNoAcceleration e) {
|
||||
error += "Your system is reporting that Direct3D hardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n";
|
||||
} catch(RageException e) {
|
||||
error += CString(e.what()) + "\n";
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user