diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 2bf0dff35..e35f8987c 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -61,6 +61,11 @@ void Config::ReadValues() { Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30); Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); + // OpenGL + Settings::values.opengl_version_major = glfw_config->GetReal("OpenGL", "version_major", 2); + Settings::values.opengl_version_minor = glfw_config->GetReal("OpenGL", "version_minor", 1); + Settings::values.opengl_flavor = glfw_config->Get("OpenGL", "flavor", "compatibility"); + // Data Storage Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index ebe2e9767..91a411ad7 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -31,6 +31,12 @@ cpu_core = ## 0: Interpreter (default), 1: OldInterpreter (may work better, soon gpu_refresh_rate = ## 30 (default) frame_skip = ## 0: No frameskip (default), 1 : 2x frameskip, 2 : 4x frameskip, etc. +[OpenGL] +## Allowed values: 2.1 to 4.5 for compatibility, 3.1 to 4.5 for core and 2.0 to 3.1 for es (subject to driver restrictions) +version_major = +version_minor = +flavor = ## compatibility (default), core, gles + [Data Storage] use_virtual_sd = diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index a6282809b..d0b77ca69 100644 --- a/src/citra/emu_window/emu_window_glfw.cpp +++ b/src/citra/emu_window/emu_window_glfw.cpp @@ -67,11 +67,17 @@ EmuWindow_GLFW::EmuWindow_GLFW() { LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting..."); exit(1); } - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); - // GLFW on OSX requires these window hints to be set to create a 3.2+ GL context. - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, Settings::values.opengl_version_major); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, Settings::values.opengl_version_minor); + + // Set hints for OpenGL core and GLES support. + if (Settings::values.opengl_flavor == "core") { + // GLFW on OSX requires these window hints to be set to create a 3.2+ GL context. + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + } else if (Settings::values.opengl_flavor == "gles") { + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); + } // compatibility is assumed otherwise, and doesn't require any hint. std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth, diff --git a/src/core/settings.h b/src/core/settings.h index 4b8928847..d9bbf80bc 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -33,6 +33,11 @@ struct Values { int gpu_refresh_rate; int frame_skip; + // OpenGL + std::string opengl_flavor; + int opengl_version_major; + int opengl_version_minor; + // Data Storage bool use_virtual_sd;