From a5a4f3714b9f8f374f3aa7feadd62178e98c9f74 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 2 Mar 2018 12:38:44 +0200 Subject: GLES2 renderer support on macOS. --- platform/osx/os_osx.h | 5 +++++ platform/osx/os_osx.mm | 29 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'platform') diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index aa8db8f300..04463a81f0 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -50,6 +50,11 @@ @author Juan Linietsky */ +enum VideoDriver { + VIDEO_DRIVER_GLES3, + VIDEO_DRIVER_GLES2 +}; + class OS_OSX : public OS_Unix { public: struct KeyEvent { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 6e42eb58bd..901232bc50 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -31,6 +31,7 @@ #include "os_osx.h" #include "dir_access_osx.h" +#include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "main/main.h" #include "os/keyboard.h" @@ -992,12 +993,19 @@ void OS_OSX::set_ime_position(const Point2 &p_pos) { } int OS_OSX::get_video_driver_count() const { - return 1; + + return 2; } const char *OS_OSX::get_video_driver_name(int p_driver) const { - return "GLES3"; + switch (p_driver) { + case VIDEO_DRIVER_GLES2: + return "GLES2"; + case VIDEO_DRIVER_GLES3: + default: + return "GLES3"; + } } void OS_OSX::initialize_core() { @@ -1111,8 +1119,12 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a ADD_ATTR(NSOpenGLPFADoubleBuffer); ADD_ATTR(NSOpenGLPFAClosestPolicy); - //we now need OpenGL 3 or better, maybe even change this to 3_3Core ? - ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); + if (p_video_driver == VIDEO_DRIVER_GLES2) { + ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy); + } else { + //we now need OpenGL 3 or better, maybe even change this to 3_3Core ? + ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); + } ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); @@ -1174,8 +1186,13 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a AudioDriverManager::add_driver(&audio_driver); // only opengl support here... - RasterizerGLES3::register_config(); - RasterizerGLES3::make_current(); + if (p_video_driver == VIDEO_DRIVER_GLES2) { + RasterizerGLES2::register_config(); + RasterizerGLES2::make_current(); + } else { + RasterizerGLES3::register_config(); + RasterizerGLES3::make_current(); + } visual_server = memnew(VisualServerRaster); if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { -- cgit v1.2.3