scummvm/graphics/renderer.cpp
Le Philousophe d9b4e457e8 ALL: Remove USE_GLES2 define
Replace it with USE_FORCED_GLES2
2022-01-18 16:49:03 +01:00

98 lines
2.5 KiB
C++

/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "graphics/renderer.h"
#include "common/translation.h"
namespace Graphics {
static const RendererTypeDescription rendererTypes[] = {
#if defined(USE_OPENGL_GAME)
{ "opengl", _s("OpenGL"), kRendererTypeOpenGL },
#endif
#if defined(USE_OPENGL_SHADERS)
{ "opengl_shaders", _s("OpenGL with shaders"), kRendererTypeOpenGLShaders },
#endif
#ifdef USE_TINYGL
{ "software", "Software", kRendererTypeTinyGL },
#endif
{ 0, 0, kRendererTypeDefault }
};
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("OpenGL with shaders", "lowres")
const RendererTypeDescription *listRendererTypes() {
return rendererTypes;
}
RendererType parseRendererTypeCode(const Common::String &code) {
const RendererTypeDescription *rt = listRendererTypes();
while (rt->code) {
if (rt->code == code) {
return rt->id;
}
rt++;
}
return kRendererTypeDefault;
}
Common::String getRendererTypeCode(RendererType type) {
const RendererTypeDescription *rt = listRendererTypes();
while (rt->code) {
if (rt->id == type) {
return rt->code;
}
rt++;
}
return "";
}
RendererType getBestMatchingAvailableRendererType(RendererType desired) {
if (desired == kRendererTypeDefault) {
desired = kRendererTypeOpenGLShaders;
}
#if !defined(USE_OPENGL_SHADERS)
if (desired == kRendererTypeOpenGLShaders) {
desired = kRendererTypeOpenGL;
}
#endif
#if (!defined(USE_OPENGL_GAME) && defined(USE_OPENGL_SHADERS))
if (desired == kRendererTypeOpenGL) {
desired = kRendererTypeOpenGLShaders;
}
#endif
#if !defined(USE_OPENGL_GAME) && !defined(USE_OPENGL_SHADERS)
if (desired == kRendererTypeOpenGL || desired == kRendererTypeOpenGLShaders) {
desired = kRendererTypeTinyGL;
}
#endif
return desired;
}
} // End of namespace Graphics