From 28d7b585c9cc64f76998dc9bff555d7d994aa207 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:50:27 +0200 Subject: [PATCH] [macOS] Enable multithreaded OpenGL engine flag when using multithreaded VisualServer. --- platform/osx/os_osx.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 6517549283a..59f21d21e59 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1682,6 +1682,11 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a CGLSetParameter((CGLContextObj)[context CGLContextObj], kCGLCPSurfaceBackingSize, &dim[0]); CGLEnable((CGLContextObj)[context CGLContextObj], kCGLCESurfaceBackingSize); + if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { + CGLError err = CGLEnable((CGLContextObj)[context CGLContextObj], kCGLCEMPEngine); // Enable multithreading. + ERR_FAIL_COND_V(err != kCGLNoError, ERR_UNAVAILABLE); + } + set_use_vsync(p_desired.use_vsync); if (!is_no_window_mode_enabled()) {