diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 7 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/command_queue_mt.cpp | 2 | ||||
-rw-r--r-- | core/command_queue_mt.h | 63 | ||||
-rw-r--r-- | core/engine.h | 3 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 7 | ||||
-rw-r--r-- | core/script_debugger_remote.cpp | 2 |
7 files changed, 53 insertions, 33 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 185c2e670c..1c9eef3d16 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2534,11 +2534,6 @@ float _Engine::get_frames_per_second() const { return Engine::get_singleton()->get_frames_per_second(); } -String _Engine::get_custom_level() const { - - return Engine::get_singleton()->get_custom_level(); -} - void _Engine::set_time_scale(float p_scale) { Engine::get_singleton()->set_time_scale(p_scale); } @@ -2588,8 +2583,6 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &_Engine::set_time_scale); ClassDB::bind_method(D_METHOD("get_time_scale"), &_Engine::get_time_scale); - ClassDB::bind_method(D_METHOD("get_custom_level"), &_Engine::get_custom_level); - ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn); ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 71038cd5a6..d3314cc3b3 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -639,8 +639,6 @@ public: void set_time_scale(float p_scale); float get_time_scale(); - String get_custom_level() const; - MainLoop *get_main_loop() const; Dictionary get_version_info() const; diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp index 823494ff67..c9edd1d47b 100644 --- a/core/command_queue_mt.cpp +++ b/core/command_queue_mt.cpp @@ -55,6 +55,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() { while (true) { + lock(); for (int i = 0; i < SYNC_SEMAPHORES; i++) { if (!sync_sems[i].in_use) { @@ -63,6 +64,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() { break; } } + unlock(); if (idx == -1) { wait_for_flush(); diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h index 2e0c478108..c3e44f731f 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -911,12 +911,14 @@ public: template <class T, class M, class R> void push_and_ret(T *p_instance, M p_method, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet0<T, M, R> *cmd = allocate_and_lock<CommandRet0<T, M, R> >(); cmd->instance = p_instance; cmd->method = p_method; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -928,13 +930,15 @@ public: template <class T, class M, class P1, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet1<T, M, P1, R> *cmd = allocate_and_lock<CommandRet1<T, M, P1, R> >(); cmd->instance = p_instance; cmd->method = p_method; cmd->p1 = p1; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -946,6 +950,8 @@ public: template <class T, class M, class P1, class P2, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet2<T, M, P1, P2, R> *cmd = allocate_and_lock<CommandRet2<T, M, P1, P2, R> >(); cmd->instance = p_instance; @@ -953,7 +959,7 @@ public: cmd->p1 = p1; cmd->p2 = p2; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -965,6 +971,8 @@ public: template <class T, class M, class P1, class P2, class P3, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet3<T, M, P1, P2, P3, R> *cmd = allocate_and_lock<CommandRet3<T, M, P1, P2, P3, R> >(); cmd->instance = p_instance; @@ -973,7 +981,7 @@ public: cmd->p2 = p2; cmd->p3 = p3; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -985,6 +993,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet4<T, M, P1, P2, P3, P4, R> *cmd = allocate_and_lock<CommandRet4<T, M, P1, P2, P3, P4, R> >(); cmd->instance = p_instance; @@ -994,7 +1004,7 @@ public: cmd->p3 = p3; cmd->p4 = p4; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -1006,6 +1016,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet5<T, M, P1, P2, P3, P4, P5, R> *cmd = allocate_and_lock<CommandRet5<T, M, P1, P2, P3, P4, P5, R> >(); cmd->instance = p_instance; @@ -1016,7 +1028,7 @@ public: cmd->p4 = p4; cmd->p5 = p5; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -1028,6 +1040,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> *cmd = allocate_and_lock<CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> >(); cmd->instance = p_instance; @@ -1039,7 +1053,7 @@ public: cmd->p5 = p5; cmd->p6 = p6; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -1051,6 +1065,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> *cmd = allocate_and_lock<CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> >(); cmd->instance = p_instance; @@ -1063,7 +1079,7 @@ public: cmd->p6 = p6; cmd->p7 = p7; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -1075,6 +1091,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class R> void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, R *r_ret) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> *cmd = allocate_and_lock<CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> >(); cmd->instance = p_instance; @@ -1088,7 +1106,7 @@ public: cmd->p7 = p7; cmd->p8 = p8; cmd->ret = r_ret; - SyncSemaphore *ss = _alloc_sync_sem(); + cmd->sync = ss; unlock(); @@ -1100,12 +1118,13 @@ public: template <class T, class M> void push_and_sync(T *p_instance, M p_method) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync0<T, M> *cmd = allocate_and_lock<CommandSync0<T, M> >(); cmd->instance = p_instance; cmd->method = p_method; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1117,13 +1136,14 @@ public: template <class T, class M, class P1> void push_and_sync(T *p_instance, M p_method, P1 p1) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync1<T, M, P1> *cmd = allocate_and_lock<CommandSync1<T, M, P1> >(); cmd->instance = p_instance; cmd->method = p_method; cmd->p1 = p1; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1135,6 +1155,8 @@ public: template <class T, class M, class P1, class P2> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync2<T, M, P1, P2> *cmd = allocate_and_lock<CommandSync2<T, M, P1, P2> >(); cmd->instance = p_instance; @@ -1142,7 +1164,6 @@ public: cmd->p1 = p1; cmd->p2 = p2; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1154,6 +1175,8 @@ public: template <class T, class M, class P1, class P2, class P3> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync3<T, M, P1, P2, P3> *cmd = allocate_and_lock<CommandSync3<T, M, P1, P2, P3> >(); cmd->instance = p_instance; @@ -1162,7 +1185,6 @@ public: cmd->p2 = p2; cmd->p3 = p3; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1174,6 +1196,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync4<T, M, P1, P2, P3, P4> *cmd = allocate_and_lock<CommandSync4<T, M, P1, P2, P3, P4> >(); cmd->instance = p_instance; @@ -1183,7 +1207,6 @@ public: cmd->p3 = p3; cmd->p4 = p4; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1195,6 +1218,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync5<T, M, P1, P2, P3, P4, P5> *cmd = allocate_and_lock<CommandSync5<T, M, P1, P2, P3, P4, P5> >(); cmd->instance = p_instance; @@ -1205,7 +1230,6 @@ public: cmd->p4 = p4; cmd->p5 = p5; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1217,6 +1241,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync6<T, M, P1, P2, P3, P4, P5, P6> *cmd = allocate_and_lock<CommandSync6<T, M, P1, P2, P3, P4, P5, P6> >(); cmd->instance = p_instance; @@ -1228,7 +1254,6 @@ public: cmd->p5 = p5; cmd->p6 = p6; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1240,6 +1265,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> *cmd = allocate_and_lock<CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> >(); cmd->instance = p_instance; @@ -1252,7 +1279,6 @@ public: cmd->p6 = p6; cmd->p7 = p7; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); @@ -1264,6 +1290,8 @@ public: template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { + SyncSemaphore *ss = _alloc_sync_sem(); + CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> *cmd = allocate_and_lock<CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> >(); cmd->instance = p_instance; @@ -1277,7 +1305,6 @@ public: cmd->p7 = p7; cmd->p8 = p8; - SyncSemaphore *ss = _alloc_sync_sem(); cmd->sync = ss; unlock(); diff --git a/core/engine.h b/core/engine.h index 1a07f5d1df..c46ae1cb64 100644 --- a/core/engine.h +++ b/core/engine.h @@ -39,7 +39,6 @@ class Engine { friend class Main; - String _custom_level; uint64_t frames_drawn; uint32_t _frame_delay; uint64_t _frame_ticks; @@ -70,8 +69,6 @@ public: virtual float get_frames_per_second() const { return _fps; } - String get_custom_level() const { return _custom_level; } - uint64_t get_frames_drawn(); uint64_t get_fixed_frames() const { return _fixed_frames; } diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index c5d59f786d..e701a89c78 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -807,11 +807,16 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) { encode_uint32(utf8.length(), buf); buf += 4; copymem(buf, utf8.get_data(), utf8.length()); + buf += utf8.length(); } r_len += 4 + utf8.length(); - while (r_len % 4) + while (r_len % 4) { r_len++; //pad + if (buf) { + buf++; + } + } } Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 25f0044cc6..9e4f4380c9 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -142,8 +142,6 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) ERR_FAIL(); } - OS::get_singleton()->enable_for_stealing_focus(ProjectSettings::get_singleton()->get("editor_pid")); - packet_peer_stream->put_var("debug_enter"); packet_peer_stream->put_var(2); packet_peer_stream->put_var(p_can_continue); |