Mesh: Parallelize extraction of UV maps #105793

Merged
Hans Goudey merged 4 commits from HooglyBoogly/blender:mesh-extract-uv-parallel into main 2023-03-19 16:18:30 +01:00

4 Commits

Author SHA1 Message Date
Hans Goudey 2b9822055f Remove timer 2023-03-18 20:02:07 -04:00
Hans Goudey bc4f12903c Remove nested timer mistake 2023-03-18 20:02:07 -04:00
Hans Goudey cd5cd004ae Capture spans by reference 2023-03-18 20:02:07 -04:00
Hans Goudey 4bdd1778b9 Mesh: Parallelize extraction of UV maps
Since UVs are now stored as 2D vectors in meshes, they can be copied
directly to the vertex buffers. Somewhat surprisingly, multithreading
the copying into the vertex buffer provides a good speedup on a CPU
with many cores at least.

Here is a test uploading two UV maps created in geometry
nodes with a 1 million quad mesh, with a Ryzen 7950x:
|         | Before  | After  | Speedup |
| Average | 24.3 ms | 7.5 ms | 3.2x    |
| Min     | 17.6 ms | 7.0 ms | 2.5x    |

I added the copying utilities to the array utils header, since the
need for them has come up in a few different places already, and the
existing function with a selection argument didn't make sense here.
2023-03-18 20:02:07 -04:00