summaryrefslogtreecommitdiff
path: root/Source/Core/Common/GL/GLInterface
diff options
context:
space:
mode:
authorJonathan Hamilton <jtrhamilton@gmail.com>2017-07-01 10:42:42 -0700
committerJonathan Hamilton <jtrhamilton@gmail.com>2017-07-26 19:26:36 -0700
commit0fbd0cab6ab2db250c0cbf6e48a1b73bc6bf9e0f (patch)
treecb34a575c9e5bbd28e50bb3a09e5f411d5d1d3ea /Source/Core/Common/GL/GLInterface
parent8292d378ea0dc91eca501f417409a5199a46bd18 (diff)
Add "PreferGLES" option to EGL GLInterface
This makes the EGL interface select OpenGL|ES contexts over "desktop" OpenGL ones. Possibly not useful for anyone outside my own debugging, but you never know
Diffstat (limited to 'Source/Core/Common/GL/GLInterface')
-rw-r--r--Source/Core/Common/GL/GLInterface/EGL.cpp48
1 files changed, 40 insertions, 8 deletions
diff --git a/Source/Core/Common/GL/GLInterface/EGL.cpp b/Source/Core/Common/GL/GLInterface/EGL.cpp
index 32cd705d73..dd3b4ebd72 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.