Add epic hack so vsync can be toggled in run-time from script. Fixes #14458.

Call needs to be routed via visual server to reach the proper thread.
This commit is contained in:
Juan Linietsky
2017-12-16 17:09:25 -03:00
parent d03f35f1bc
commit 652c98a7be
14 changed files with 61 additions and 18 deletions
+10
View File
@@ -158,9 +158,19 @@ void VisualServerWrapMT::finish() {
canvas_occluder_polygon_free_cached_ids();
}
void VisualServerWrapMT::set_use_vsync_callback(bool p_enable) {
singleton_mt->call_set_use_vsync(p_enable);
}
VisualServerWrapMT *VisualServerWrapMT::singleton_mt = NULL;
VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_thread) :
command_queue(p_create_thread) {
singleton_mt = this;
OS::switch_vsync_function = set_use_vsync_callback; //as this goes to another thread, make sure it goes properly
visual_server = p_contained;
create_thread = p_create_thread;
thread = NULL;