mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Merge pull request #5826 from JonnyH/WIP/add-option-to-prefer-GLES-when-using-EGL
Add "PreferGLES" option to EGL GLInterface
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Common/GL/GLInterface/EGL.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
@ -47,6 +48,7 @@ void cInterfaceEGL::DetectMode()
|
||||
{
|
||||
if (s_opengl_mode != GLInterfaceMode::MODE_DETECT)
|
||||
return;
|
||||
bool preferGLES = Config::Get(Config::GFX_PREFER_GLES);
|
||||
|
||||
EGLint num_configs;
|
||||
bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false;
|
||||
@ -98,15 +100,45 @@ void cInterfaceEGL::DetectMode()
|
||||
delete[] config;
|
||||
}
|
||||
|
||||
if (supportsGL)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL;
|
||||
else if (supportsGLES3)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES3;
|
||||
else if (supportsGLES2)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
|
||||
if (preferGLES)
|
||||
{
|
||||
if (supportsGLES3)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES3;
|
||||
else if (supportsGLES2)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
|
||||
else if (supportsGL)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (supportsGL)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL;
|
||||
else if (supportsGLES3)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES3;
|
||||
else if (supportsGLES2)
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
|
||||
}
|
||||
|
||||
if (s_opengl_mode == GLInterfaceMode::MODE_DETECT) // Errored before we found a mode
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL; // Fall back to OpenGL
|
||||
if (s_opengl_mode == GLInterfaceMode::MODE_OPENGL)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Using OpenGL");
|
||||
}
|
||||
else if (s_opengl_mode == GLInterfaceMode::MODE_OPENGLES3)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Using OpenGL|ES 3");
|
||||
}
|
||||
else if (s_opengl_mode == GLInterfaceMode::MODE_OPENGLES2)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Using OpenGL|ES 2");
|
||||
}
|
||||
else if (s_opengl_mode == GLInterfaceMode::MODE_DETECT)
|
||||
{
|
||||
// Errored before we found a mode
|
||||
ERROR_LOG(VIDEO, "Error: Failed to detect OpenGL flavour, falling back to OpenGL");
|
||||
// This will fail to create a context, as it'll try to use the same attribs we just failed to
|
||||
// find a matching config with
|
||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
|
Reference in New Issue
Block a user