mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Make physics interpolation compatible with separate-thread rendering
This commit is contained in:
@@ -43,6 +43,10 @@ void VisualServerWrapMT::thread_draw(bool p_swap_buffers, double frame_step) {
|
||||
void VisualServerWrapMT::thread_flush() {
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::thread_halt() {
|
||||
thread_halt_semaphore.wait();
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::_thread_callback(void *_instance) {
|
||||
VisualServerWrapMT *vsmt = reinterpret_cast<VisualServerWrapMT *>(_instance);
|
||||
|
||||
@@ -102,6 +106,19 @@ void VisualServerWrapMT::sync() {
|
||||
}
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::sync_and_halt() {
|
||||
if (create_thread) {
|
||||
command_queue.push_and_sync(this, &VisualServerWrapMT::thread_flush);
|
||||
command_queue.push(this, &VisualServerWrapMT::thread_halt);
|
||||
}
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::thaw() {
|
||||
if (create_thread) {
|
||||
thread_halt_semaphore.post();
|
||||
}
|
||||
}
|
||||
|
||||
void VisualServerWrapMT::draw(bool p_swap_buffers, double frame_step) {
|
||||
if (create_thread) {
|
||||
command_queue.push(this, &VisualServerWrapMT::thread_draw, p_swap_buffers, frame_step);
|
||||
|
||||
Reference in New Issue
Block a user