mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added a setting to define the OpenGL version to use.
This commit is contained in:
parent
ea2c4444b0
commit
008fa23d5f
|
@ -279,6 +279,7 @@ void Settings::setDefaults()
|
|||
//
|
||||
|
||||
mBoolMap["DebugSkipInputLogging"] = {false, false};
|
||||
mStringMap["OpenGLVersion"] = {"", ""};
|
||||
mStringMap["ROMDirectory"] = {"", ""};
|
||||
mStringMap["UIMode_passkey"] = {"uuddlrlrba", "uuddlrlrba"};
|
||||
mIntMap["LottieMaxFileCache"] = {150, 150};
|
||||
|
|
|
@ -28,6 +28,8 @@ RendererOpenGL::RendererOpenGL() noexcept
|
|||
, mBlurVerticalShader {nullptr}
|
||||
, mScanlinelShader {nullptr}
|
||||
, mLastShader {nullptr}
|
||||
, mMajorGLVersion {0}
|
||||
, mMinorGLVersion {0}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -128,16 +130,55 @@ GLenum RendererOpenGL::convertTextureType(const TextureType type)
|
|||
|
||||
void RendererOpenGL::setup()
|
||||
{
|
||||
std::string glVersion {Settings::getInstance()->getString("OpenGLVersion")};
|
||||
|
||||
#if defined(USE_OPENGLES)
|
||||
if (glVersion == "" || glVersion == "3.0") {
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 0;
|
||||
}
|
||||
else if (glVersion == "3.1") {
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 1;
|
||||
}
|
||||
else if (glVersion == "3.2") {
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 2;
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "Unsupported OpenGL ES version \"" << glVersion
|
||||
<< "\" requested, defaulting to 3.0 (valid versions are 3.0, 3.1 and 3.2)";
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 0;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#else
|
||||
if (glVersion == "" || glVersion == "3.3") {
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 3;
|
||||
}
|
||||
else if (glVersion == "4.2") {
|
||||
mMajorGLVersion = 4;
|
||||
mMinorGLVersion = 2;
|
||||
}
|
||||
else if (glVersion == "4.6") {
|
||||
mMajorGLVersion = 4;
|
||||
mMinorGLVersion = 6;
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "Unsupported OpenGL version \"" << glVersion
|
||||
<< "\" requested, defaulting to 3.3 (valid versions are 3.3, 4.2 and 4.6)";
|
||||
mMajorGLVersion = 3;
|
||||
mMinorGLVersion = 3;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
#endif
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, mMajorGLVersion);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, mMinorGLVersion);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
|
@ -170,12 +211,17 @@ bool RendererOpenGL::createContext()
|
|||
LOG(LogInfo) << "GL vendor: " << vendor;
|
||||
LOG(LogInfo) << "GL renderer: " << renderer;
|
||||
LOG(LogInfo) << "GL version: " << version;
|
||||
#if defined(_WIN64)
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL 3.3 with GLEW";
|
||||
#elif defined(USE_OPENGLES)
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL ES 3.0";
|
||||
#if defined(USE_OPENGLES)
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL ES " << mMajorGLVersion << "."
|
||||
<< mMinorGLVersion;
|
||||
#else
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL 3.3";
|
||||
#if defined(_WIN64)
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL " << mMajorGLVersion << "."
|
||||
<< mMinorGLVersion << " with GLEW";
|
||||
#else
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL " << mMajorGLVersion << "."
|
||||
<< mMinorGLVersion;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
GL_CHECK_ERROR(glClearColor(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
|
|
|
@ -87,6 +87,9 @@ private:
|
|||
ShaderOpenGL* mBlurVerticalShader;
|
||||
ShaderOpenGL* mScanlinelShader;
|
||||
ShaderOpenGL* mLastShader;
|
||||
|
||||
int mMajorGLVersion;
|
||||
int mMinorGLVersion;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_RENDERER_RENDERER_OPENGL_H
|
||||
|
|
Loading…
Reference in a new issue