Improve error messages when OpenGL video init fails
This commit is contained in:
@@ -95,8 +95,7 @@ bool RageDisplay::SetVideoMode( VideoModeParams p )
|
|||||||
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
|
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
|
||||||
return bNeedReloadTextures;
|
return bNeedReloadTextures;
|
||||||
|
|
||||||
RageException::ThrowNonfatal( "SetVideoMode failed: %s. Tried to fall back to other modes, but nothing worked.",
|
RageException::ThrowNonfatal( "SetVideoMode failed: %s", err.c_str() );
|
||||||
err.c_str() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::ProcessStatsOnFlip()
|
void RageDisplay::ProcessStatsOnFlip()
|
||||||
|
|||||||
@@ -538,8 +538,10 @@ void RageDisplay_OGL::ResolutionChanged()
|
|||||||
CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||||
{
|
{
|
||||||
// LOG->Trace( "RageDisplay_OGL::SetVideoMode( %d, %d, %d, %d, %d, %d )", windowed, width, height, bpp, rate, vsync );
|
// LOG->Trace( "RageDisplay_OGL::SetVideoMode( %d, %d, %d, %d, %d, %d )", windowed, width, height, bpp, rate, vsync );
|
||||||
if( !wind->TryVideoMode( p, bNewDeviceOut ) )
|
CString err;
|
||||||
return "wind->TryVideoMode() failed"; // failed to set video mode XXX: error message
|
err = wind->TryVideoMode( p, bNewDeviceOut );
|
||||||
|
if( err != "" )
|
||||||
|
return err; // failed to set video mode
|
||||||
|
|
||||||
if( bNewDeviceOut )
|
if( bNewDeviceOut )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ public:
|
|||||||
|
|
||||||
virtual void *GetProcAddress(CString s) = 0;
|
virtual void *GetProcAddress(CString s) = 0;
|
||||||
|
|
||||||
// Return true if mode change was successful.
|
// Return "" if mode change was successful, otherwise an error message.
|
||||||
// bNewDeviceOut is set true if a new device was created and textures
|
// bNewDeviceOut is set true if a new device was created and textures
|
||||||
// need to be reloaded.
|
// need to be reloaded.
|
||||||
virtual bool TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut ) = 0;
|
virtual CString TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut ) = 0;
|
||||||
|
|
||||||
virtual void SwapBuffers() = 0;
|
virtual void SwapBuffers() = 0;
|
||||||
virtual void Update(float fDeltaTime) { }
|
virtual void Update(float fDeltaTime) { }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void *LowLevelWindow_SDL::GetProcAddress(CString s)
|
|||||||
return SDL_GL_GetProcAddress(s);
|
return SDL_GL_GetProcAddress(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LowLevelWindow_SDL::TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut )
|
CString LowLevelWindow_SDL::TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut )
|
||||||
{
|
{
|
||||||
CurrentParams = p;
|
CurrentParams = p;
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ bool LowLevelWindow_SDL::TryVideoMode( RageDisplay::VideoModeParams p, bool &bNe
|
|||||||
if(!screen)
|
if(!screen)
|
||||||
{
|
{
|
||||||
LOG->Trace("SDL_SetVideoMode failed: %s", SDL_GetError());
|
LOG->Trace("SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||||
return false; // failed to set mode
|
return SDL_GetError(); // failed to set mode
|
||||||
}
|
}
|
||||||
|
|
||||||
bNewDeviceOut = true; // always a new context because we're resetting SDL_Video
|
bNewDeviceOut = true; // always a new context because we're resetting SDL_Video
|
||||||
@@ -152,7 +152,7 @@ bool LowLevelWindow_SDL::TryVideoMode( RageDisplay::VideoModeParams p, bool &bNe
|
|||||||
colorbits, r, g, b, a, depth, stencil);
|
colorbits, r, g, b, a, depth, stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // we set the video mode successfully
|
return ""; // we set the video mode successfully
|
||||||
}
|
}
|
||||||
|
|
||||||
void LowLevelWindow_SDL::SwapBuffers()
|
void LowLevelWindow_SDL::SwapBuffers()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public:
|
|||||||
LowLevelWindow_SDL();
|
LowLevelWindow_SDL();
|
||||||
~LowLevelWindow_SDL();
|
~LowLevelWindow_SDL();
|
||||||
void *GetProcAddress(CString s);
|
void *GetProcAddress(CString s);
|
||||||
bool TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut );
|
CString TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut );
|
||||||
void SwapBuffers();
|
void SwapBuffers();
|
||||||
void Update(float fDeltaTime);
|
void Update(float fDeltaTime);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user