Fix initialization of visual server in all platforms

Avoid leaking an extra instance when using threads. Also fix threaded
loading issues on Android and iOS.
This commit is contained in:
George Marques 2018-11-01 10:27:04 -03:00
parent aec8ea4f47
commit 4c9d734a75
7 changed files with 26 additions and 25 deletions

View File

@ -39,7 +39,7 @@
#include "file_access_android.h"
#include "main/main.h"
#include "servers/visual/visual_server_raster.h"
//#include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/visual_server_wrap_mt.h"
#ifdef ANDROID_NATIVE_ACTIVITY
#include "dir_access_android.h"
@ -182,11 +182,12 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
video_driver_index = p_video_driver;
visual_server = memnew(VisualServerRaster);
/* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
};*/
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();
// visual_server->cursor_set_visible(false, 0);

View File

@ -117,17 +117,16 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
#endif
visual_server = memnew(VisualServerRaster());
// FIXME: Reimplement threaded rendering? Or remove?
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
// TODO: enable multithreaded VS
/*
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
}
*/
video_driver_index = p_video_driver;
input = memnew(InputDefault);

View File

@ -34,7 +34,7 @@
#include "drivers/gles3/rasterizer_gles3.h"
#include "servers/visual/visual_server_raster.h"
//#include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
@ -107,13 +107,12 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
visual_server = memnew(VisualServerRaster());
/*
FIXME: Reimplement threaded rendering? Or remove?
// FIXME: Reimplement threaded rendering? Or remove?
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
};
*/
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();
//visual_server->cursor_set_visible(false, 0);

View File

@ -1383,10 +1383,11 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
video_driver_index = p_video_driver;
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();

View File

@ -294,14 +294,13 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
set_video_mode(vm);
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering? Or remove?
/*
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
*/
visual_server->init();
input = memnew(InputDefault);

View File

@ -1332,10 +1332,11 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
gl_context->set_use_vsync(video_mode.use_vsync);
#endif
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
/*

View File

@ -342,11 +342,12 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
context_gl->set_use_vsync(current_videomode.use_vsync);
#endif
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
if (current_videomode.maximized) {
current_videomode.maximized = false;