Page MenuHome

Mesh: Use parallel range to computate looptris
AbandonedPublic

Authored by Germano Cavalcante (mano-wii) on May 31 2021, 6:41 PM.
Tags
None
Subscribers
None
Tokens
"Like" token, awarded by erickblender."Burninate" token, awarded by kursadk."Mountain of Wealth" token, awarded by ace_dragon."Like" token, awarded by erik85.

Details

Summary

As we can see in this graph of the timeline of the threads inside the function
mesh_buffer_cache_create_requested, BKE_mesh_recalc_looptri has a
considerable effect on the total time spent:


(red indicates threads waiting for synchronization).

Inspired by the BKE_mesh_calc_normals_poly solution, this patch proposes to
calculate the meshes tessellation in multithreaded.
So the graph looks like this:

Profiling:
To compare performance, two files were used.

  • subdiv_mesh_final_only.blend and
  • looptri_test.blend.

The most important value to analyze is the time of iter, as the time of
BKE_mesh_calc_normals_poly is computed within this value.

These are the results:

MASTER:
subdiv_mesh_final_only:
- rdata 3ms iter 24ms (frame 154ms)
- Average: 6.182961 FPS

looptri_test:
- rdata 11ms iter 97ms (frame 270ms)
- Average: 3.472556 FPS

PATCH:
subdiv_mesh_final_only:
- rdata 3ms iter 21ms (frame 156ms)
- Average: 6.253956 FPS

looptri_test:
- rdata 11ms iter 38ms (frame 214ms)
- Average: 4.367576 FPS
Fac iter path/master:
subdiv_mesh_final_only: 0.87
looptri_test:           0.39

Operating system: Windows-10-10.0.18941 64 Bits
CPU: AMD Ryzen 7 1800x
Graphics card: Radeon (TM) RX 480 Graphics ATI Technologies Inc. 4.5.14760 Core Profile Context 20.45.37.01 27.20.14537.1001


Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 14878
Build 14878: arc lint + arc unit

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.May 31 2021, 6:41 PM
Germano Cavalcante (mano-wii) created this revision.
  • Split extracts initialization and finalization in multi-threads.

Still need tests.
This change can be easily reversed by comment out the defines.

I saw now that the patch did not match the description!
Fixed.

Committed a different solution.