From 789b5f52993e4074bb8fd0f883e8a852fe60c733 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 Dec 2015 20:37:25 +0300 Subject: Not allow select unsupported renderers in nacl. --- src/render/renderers.cpp | 14 ++++++++++++++ src/render/rendererslistsdl.h | 36 +++++++++++++++++++++++++++++++++++- src/render/rendererslistsdl2.h | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp index ce5174859..91a5680ae 100644 --- a/src/render/renderers.cpp +++ b/src/render/renderers.cpp @@ -56,6 +56,20 @@ RenderType intToRenderType(const int mode) #endif // defined(USE_SDL2) // with OpenGL + with ANDROID end +#elif defined(__native_client__) + +// with OpenGL + with nacl start +#if defined(USE_SDL2) + && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES2_OPENGL + && mode != RENDER_SDL2_DEFAULT) +#else // defined(USE_SDL2) + + && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES2_OPENGL) +#endif // defined(USE_SDL2) +// with OpenGL + with nacl end + #else // defined(ANDROID) // with OpenGL + without ANDROID start diff --git a/src/render/rendererslistsdl.h b/src/render/rendererslistsdl.h index 3c09b5dc8..c90315d4d 100644 --- a/src/render/rendererslistsdl.h +++ b/src/render/rendererslistsdl.h @@ -62,7 +62,41 @@ const int renderToIndex[] = 1 // RENDER_GLES2_OPENGL }; -#else // ANDROID +#elif defined(__native_client__) +// defined OPENGL nacl + +// map for index to RenderType +const RenderType indexToRender[] = +{ + RENDER_SOFTWARE, + RENDER_SAFE_OPENGL, + RENDER_GLES2_OPENGL +}; + +const char *OPENGL_NAME[] = +{ + // TRANSLATORS: draw backend + N_("Software"), + // TRANSLATORS: draw backend + N_("Safe OpenGL"), + // TRANSLATORS: draw backend + N_("Mobile OpenGL ES 2"), +}; + +const int renderModesListSize = 3; + +const int renderToIndex[] = +{ + 0, // RENDER_SOFTWARE + 2, // RENDER_NORMAL_OPENGL + 1, // RENDER_SAFE_OPENGL + 2, // RENDER_GLES_OPENGL + 0, // RENDER_SDL2_DEFAULT + 2, // RENDER_MODERN_OPENGL + 2 // RENDER_GLES2_OPENGL +}; + +#else // ANDROID or nacl // defined OPENGL // map for index to RenderType diff --git a/src/render/rendererslistsdl2.h b/src/render/rendererslistsdl2.h index d40b8617a..bd010ccec 100644 --- a/src/render/rendererslistsdl2.h +++ b/src/render/rendererslistsdl2.h @@ -60,7 +60,44 @@ const int renderToIndex[] = 2 // RENDER_GLES_OPENGL }; -#else // ANDROID +#elif defined(__native_client__) +// defined OPENGL nacl + +// map for index to RenderType +const RenderType indexToRender[] = +{ + RENDER_SOFTWARE, + RENDER_SDL2_DEFAULT, + RENDER_SAFE_OPENGL, + RENDER_GLES2_OPENGL +}; + +const char *OPENGL_NAME[] = +{ + // TRANSLATORS: draw backend + N_("Software"), + // TRANSLATORS: draw backend + N_("SDL2 default"), + // TRANSLATORS: draw backend + N_("Safe OpenGL"), + // TRANSLATORS: draw backend + N_("Mobile OpenGL ES 2") +}; + +const int renderModesListSize = 4; + +const int renderToIndex[] = +{ + 0, // RENDER_SOFTWARE + 3, // RENDER_NORMAL_OPENGL + 2, // RENDER_SAFE_OPENGL + 3, // RENDER_GLES_OPENGL + 1, // RENDER_SDL2_DEFAULT + 3, // RENDER_MODERN_OPENGL + 3 // RENDER_GLES2_OPENGL +}; + +#else // ANDROID or nacl // defined OPENGL // map for index to RenderType -- cgit v1.2.3-70-g09d2