Mesh::create_trimesh_shape() causing a frame duration spike when called from a thread #10881
nenad-jalsovec
started this conversation in
3D
Replies: 2 comments 5 replies
-
I'm providing a minimal example (tested in 4.3): extends Node
func thread():
var mesh = SphereMesh.new()
mesh.rings = 50000
CollisionShape3D.new().shape = mesh.create_trimesh_shape()
func _process(delta):
if Input.is_action_just_pressed("ui_accept"):
Thread.new().start(thread) Attach the script to a node, run the scene, start the profiler, press enter and observe the spike in the profiler. Can you guys verify this is indeed happening? If so, should it be reported as an issue? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Mesh data is stored on the GPU. Calling anything that needs to read mesh data needs to copy that data from the GPU back to the CPU stalling the entire rendering in the process. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure what to make of it. I expected I can create a bunch of concave colliders in a thread using
Mesh::create_trimesh_shape()
, but this call appears to be blocking the main thread. It causes a single frame spike visible in the profiler. The profiler attributes it to Physics Time. The more data there is in the mesh, the larger the spike. Couldn't find anything about it in the docs. Is this by design? Can it be improved or worked around?Beta Was this translation helpful? Give feedback.
All reactions