diff options
Diffstat (limited to 'src/render/renderers.cpp')
-rw-r--r-- | src/render/renderers.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp index 97364f54a..dcabd0fbf 100644 --- a/src/render/renderers.cpp +++ b/src/render/renderers.cpp @@ -20,19 +20,43 @@ #include "render/renderers.h" -RenderType intToRenderType(const int mode) +static RenderType getDefault() { - if (mode < 0 || mode > RENDER_LAST) - { #ifdef USE_OPENGL #ifdef ANDROID - return RENDER_GLES_OPENGL; + return RENDER_GLES_OPENGL; #else - return RENDER_NORMAL_OPENGL; + return RENDER_NORMAL_OPENGL; #endif #else - return RENDER_SOFTWARE; + return RENDER_SOFTWARE; +#endif +} + +RenderType intToRenderType(const int mode) +{ + if (mode < 0 || mode >= RENDER_LAST) + return getDefault(); + + if (mode != RENDER_SOFTWARE +#if defined(USE_OPENGL) && defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif defined(USE_OPENGL) && defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL) +#elif defined(USE_OPENGL) && !defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && defined(USE_SDL2) + && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && !defined(USE_SDL2) + ) +#elif defined(USE_OPENGL) && !defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL) #endif + { + return getDefault(); } + return static_cast<RenderType>(mode); } |