IssueRaiser

Add threading support to Scene Nodes

### Describe the project you are working on Godot ### Describe the problem or limitation you are having in your project Godot 4 does a lot of improvements on the threading side for performance, but this happens mostly in the servers. Scene node processing performance is unaffected and all processing is still single threaded. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation Allow scene nodes to, optionally, process on threads so processing can happen for many at the same time. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams Here is a proposed implementation: #### C++ API ```C++ // Enable thread processing void Node::set_thread_process(bool p_enable); void Node::set_thread_physics_process(bool p_enable); // Used to setup threading NOTIFICATION_THREAD_PROCESS_PREPARE - called as _thread_process_prepare(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS_PREPARE - called as _thread_pphysics_process_prepare(delta) // Runs in thread NOTIFICATION_THREAD_PROCESS - called as _thread_process(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS - called as _thread_physics_process(delta) // Runs after thread NOTIFICATION_THREAD_PROCESS_DONE - called as _thread_process_done(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS_DONE - called as _thread_physics_process_done(delta) // Control priority (as example, you know a skeleton may always need to process before animation) void Node::set_thread_process_depend

Posted by reduz on Jul 24, 2022, 10:24 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

support (Other)

Add threading support to Scene Nodes

reduzJul 24, 2022, 10:24 AM

### Describe the project you are working on Godot ### Describe the problem or limitation you are having in your project Godot 4 does a lot of improvements on the threading side for performance, but this happens mostly in the servers. Scene node processing performance is unaffected and all processing is still single threaded. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation Allow scene nodes to, optionally, process on threads so processing can happen for many at the same time. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams Here is a proposed implementation: #### C++ API ```C++ // Enable thread processing void Node::set_thread_process(bool p_enable); void Node::set_thread_physics_process(bool p_enable); // Used to setup threading NOTIFICATION_THREAD_PROCESS_PREPARE - called as _thread_process_prepare(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS_PREPARE - called as _thread_pphysics_process_prepare(delta) // Runs in thread NOTIFICATION_THREAD_PROCESS - called as _thread_process(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS - called as _thread_physics_process(delta) // Runs after thread NOTIFICATION_THREAD_PROCESS_DONE - called as _thread_process_done(delta) NOTIFICATION_THREAD_PHYSICS_PROCESS_DONE - called as _thread_physics_process_done(delta) // Control priority (as example, you know a skeleton may always need to process before animation) void Node::set_thread_process_depend

Comments (0)

No comments yet. Start the discussion.

Comment on this issue