summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLeo Lam <leolino.lam@gmail.com>2017-07-31 16:43:38 +0800
committerGitHub <noreply@github.com>2017-07-31 16:43:38 +0800
commitca49de80c55ea435a075e3dceb389a944ac15b09 (patch)
tree6633194972a7acba2bfdfe22f308c074d773f94a /Source/Core
parent141fb0f03ca4e0d05f7ccbf3e020997097f60dbe (diff)
parent0fbd0cab6ab2db250c0cbf6e48a1b73bc6bf9e0f (diff)
Merge pull request #5826 from JonnyH/WIP/add-option-to-prefer-GLES-when-using-EGL
Add "PreferGLES" option to EGL GLInterface
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/GL/GLInterface/EGL.cpp48
-rw-r--r--Source/Core/Core/Config/GraphicsSettings.cpp2
-rw-r--r--Source/Core/Core/Config/GraphicsSettings.h2
3 files changed, 44 insertions, 8 deletions
diff --git a/Source/Core/Common/GL/GLInterface/EGL.cpp b/Source/Core/Common/GL/GLInterface/EGL.cpp
index 8e85511fc7..9d1983190c 100644
--- a/Source/Core/Common/GL/GLInterface/EGL.cpp
+++ b/Source/Core/Common/GL/GLInterface/EGL.cpp
@@ -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.
diff --git a/Source/Core/Core/Config/GraphicsSettings.cpp b/Source/Core/Core/Config/GraphicsSettings.cpp
index e7c195a4cb..063bb7fca7 100644
--- a/Source/Core/Core/Config/GraphicsSettings.cpp
+++ b/Source/Core/Core/Config/GraphicsSettings.cpp
@@ -101,6 +101,8 @@ const ConfigInfo<bool> GFX_SW_DUMP_TEV_TEX_FETCHES{{System::GFX, "Settings", "SW
const ConfigInfo<int> GFX_SW_DRAW_START{{System::GFX, "Settings", "SWDrawStart"}, 0};
const ConfigInfo<int> GFX_SW_DRAW_END{{System::GFX, "Settings", "SWDrawEnd"}, 100000};
+const ConfigInfo<bool> GFX_PREFER_GLES{{System::GFX, "Settings", "PreferGLES"}, false};
+
// Graphics.Enhancements
const ConfigInfo<bool> GFX_ENHANCE_FORCE_FILTERING{{System::GFX, "Enhancements", "ForceFiltering"},
diff --git a/Source/Core/Core/Config/GraphicsSettings.h b/Source/Core/Core/Config/GraphicsSettings.h
index 3ec39f300f..a5624e8b5c 100644
--- a/Source/Core/Core/Config/GraphicsSettings.h
+++ b/Source/Core/Core/Config/GraphicsSettings.h
@@ -75,6 +75,8 @@ extern const ConfigInfo<bool> GFX_SW_DUMP_TEV_TEX_FETCHES;
extern const ConfigInfo<int> GFX_SW_DRAW_START;
extern const ConfigInfo<int> GFX_SW_DRAW_END;
+extern const ConfigInfo<bool> GFX_PREFER_GLES;
+
// Graphics.Enhancements
extern const ConfigInfo<bool> GFX_ENHANCE_FORCE_FILTERING;