Add thread guard for force_draw and update relared doc
force_draw must be called from main thread
(cherry picked from commit b88b84ce18
)
This commit is contained in:
parent
032d96042d
commit
2ba4a7dd3d
|
@ -1370,7 +1370,7 @@
|
||||||
<param index="0" name="swap_buffers" type="bool" default="true" />
|
<param index="0" name="swap_buffers" type="bool" default="true" />
|
||||||
<param index="1" name="frame_step" type="float" default="0.0" />
|
<param index="1" name="frame_step" type="float" default="0.0" />
|
||||||
<description>
|
<description>
|
||||||
Forces redrawing of all viewports at once.
|
Forces redrawing of all viewports at once. Must be called from the main thread.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="force_sync">
|
<method name="force_sync">
|
||||||
|
|
|
@ -380,6 +380,7 @@ void RenderingServerDefault::sync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
|
void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
|
||||||
|
ERR_FAIL_COND_MSG(!Thread::is_main_thread(), "Manually triggering the draw function from the RenderingServer can only be done on the main thread. Call this function from the main thread or use call_deferred().");
|
||||||
if (create_thread) {
|
if (create_thread) {
|
||||||
command_queue.push(this, &RenderingServerDefault::_thread_draw, p_swap_buffers, frame_step);
|
command_queue.push(this, &RenderingServerDefault::_thread_draw, p_swap_buffers, frame_step);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue