When using link duplicated objects it could happen that one object is
calculating the GPUBuffers and the second object is marking these
buffers invalid. This leads to threading issues.
This patch fixes this by separating the preparation extraction part from
the execution part. The preparation is done on the main thread. And the
execution part is done after all the objects have been handled.
In the future we could optimize this for huge scenes if we are able to
detect if a mesh is used multiple times. If not we could already
schedule the extraction during the preparation loop and making the
execution loop smaller. This patch adds a mechanism for it, but doesn't
use it yet.
Alternative approaches have been checked
- sync extraction per object: reduced performance to much (-15%)
- post checks: reduced the threading issues, but didn't solve it.