Qt: Handle creation of ES contexts even when it wasn't specified

This commit is contained in:
Stenzek 2020-02-05 17:42:50 +09:00
parent edb6d7c97e
commit 93f85535eb
1 changed files with 3 additions and 3 deletions

View File

@ -224,7 +224,6 @@ bool OpenGLDisplayWindow::createDeviceContext(QThread* worker_thread, bool debug
surface_format.setSwapInterval(0); surface_format.setSwapInterval(0);
surface_format.setRenderableType(QSurfaceFormat::OpenGL); surface_format.setRenderableType(QSurfaceFormat::OpenGL);
surface_format.setProfile(QSurfaceFormat::CoreProfile); surface_format.setProfile(QSurfaceFormat::CoreProfile);
if (debug_device) if (debug_device)
surface_format.setOption(QSurfaceFormat::DebugContext); surface_format.setOption(QSurfaceFormat::DebugContext);
@ -234,14 +233,15 @@ bool OpenGLDisplayWindow::createDeviceContext(QThread* worker_thread, bool debug
m_gl_context->setFormat(surface_format); m_gl_context->setFormat(surface_format);
if (m_gl_context->create()) if (m_gl_context->create())
{ {
Log_InfoPrintf("Got a desktop OpenGL %d.%d context", major, minor); m_is_gles = m_gl_context->isOpenGLES();
Log_InfoPrintf("Got a %s %d.%d context", major, minor, m_is_gles ? "OpenGL ES" : "desktop OpenGL");
break; break;
} }
} }
if (!m_gl_context) if (!m_gl_context)
{ {
// try es // try forcing ES
surface_format.setRenderableType(QSurfaceFormat::OpenGLES); surface_format.setRenderableType(QSurfaceFormat::OpenGLES);
surface_format.setProfile(QSurfaceFormat::NoProfile); surface_format.setProfile(QSurfaceFormat::NoProfile);
if (debug_device) if (debug_device)