Page MenuHome

Fix T77867: Link Duplicate Object crashes during batch creation
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Jul 17 2020, 10:17 AM.

Details

Summary

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 introduces threading issues.

This patch fixes this by combining the surface and surface per material
batches. Most likely the surface per material batches are used and when
requested you will most likely need the surface batch for the depth
tests and overlays.

During tests it slightly improves performance as batches aren't thrown
away without using it.

After this patch we can add a quick path for meshes with one material
and two materials.

Alternative approaches that have been checked:

Diff Detail

Repository
rB Blender
Branch
T77867c (branched from master)
Build Status
Buildable 9065
Build 9065: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Jul 17 2020, 10:18 AM

Look much better than initial approach.

source/blender/draw/intern/draw_cache_extract_mesh.c
892

why remove this comment?

This revision is now accepted and ready to land.Jul 17 2020, 1:20 PM
source/blender/draw/intern/draw_cache_extract_mesh.c
892

I didn't find it a hack anymore. Extracting sub buffers we also do for loose lines. But I will leave the comment for now.