mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
Handle failure of OpenGL context creation (#2172)
This commit is contained in:
parent
2d561a60c8
commit
2bf0eb7ead
@ -753,10 +753,8 @@ bool ScreenPanelGL::createContext()
|
|||||||
if (parentwin)
|
if (parentwin)
|
||||||
{
|
{
|
||||||
if (windowinfo.has_value())
|
if (windowinfo.has_value())
|
||||||
{
|
if (glContext = parentwin->getOGLContext()->CreateSharedContext(*windowinfo))
|
||||||
glContext = parentwin->getOGLContext()->CreateSharedContext(*windowinfo);
|
glContext->DoneCurrent();
|
||||||
glContext->DoneCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -764,10 +762,8 @@ bool ScreenPanelGL::createContext()
|
|||||||
GL::Context::Version{GL::Context::Profile::Core, 4, 3},
|
GL::Context::Version{GL::Context::Profile::Core, 4, 3},
|
||||||
GL::Context::Version{GL::Context::Profile::Core, 3, 2}};
|
GL::Context::Version{GL::Context::Profile::Core, 3, 2}};
|
||||||
if (windowinfo.has_value())
|
if (windowinfo.has_value())
|
||||||
{
|
if (glContext = GL::Context::Create(*windowinfo, versionsToTry))
|
||||||
glContext = GL::Context::Create(*windowinfo, versionsToTry);
|
glContext->DoneCurrent();
|
||||||
glContext->DoneCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return glContext != nullptr;
|
return glContext != nullptr;
|
||||||
|
@ -841,7 +841,15 @@ void MainWindow::createScreenPanel()
|
|||||||
|
|
||||||
panel = panelGL;
|
panel = panelGL;
|
||||||
|
|
||||||
panelGL->createContext();
|
// Check that creating the context hasn't failed
|
||||||
|
if (panelGL->createContext() == false)
|
||||||
|
{
|
||||||
|
Log(LogLevel::Error, "Failed to create OpenGL context, falling back to Software Renderer.\n");
|
||||||
|
hasOGL = false;
|
||||||
|
|
||||||
|
globalCfg.SetBool("Screen.UseGL", false);
|
||||||
|
globalCfg.SetInt("3D.Renderer", renderer3D_Software);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasOGL)
|
if (!hasOGL)
|
||||||
|
Loading…
Reference in New Issue
Block a user