Subdivision Surface: add dependency graph tracking when CPU mesh is needed #104461

Open
Alexander Gavrilov wants to merge 1 commits from angavrilov/blender:pr-depsgraph-subdiv-cpu into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

1 Commits

Author SHA1 Message Date
Alexander Gavrilov 7d5a6e7caf Subdivision Surface: add dependency graph tracking when cpu mesh is needed.
After addition of GPU subdivision it is necessary to choose between
using CPU or GPU for a particular object when both ways are technically
possible. Choosing GPU when the mesh is also needed by CPU code would
cause subdivision to be run twice when the CPU mesh is requested by
other code.

This patch adds a simple way to track dependencies that need the CPU
mesh through dependency graph via an already existing mechanism.

Constraints targeting mesh vertex groups, as well as likely modifiers
now tag their targets with a dependency graph flag to notify that the
fully evaluated mesh is needed on the CPU. This is used to disable GPU
subdiv in those cases.

In addition, the evaluated mesh is used by sculpt and paint modes,
so GPU subdivision is disabled in that case too.
2023-03-20 13:18:54 +02:00