Page MenuHome

Fix T96283: last disabled subsurf is used for GPU subdivision
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Mar 29 2022, 3:28 PM.

Details

Summary

When more than one, consecutive, subdivision modifier is used on a Mesh,
the last subsurf modifier is used for GPU subdivision even though it
might be disabled. This is because retrieving the last subsurf modifier
did not check whether the modifier was disabled or not.

To fix this, the session UUID of the modifier that delayed evaluation
to the GPU is now stored in the Mesh runtime and used at draw time
to retrieve the right modifier.

Diff Detail

Repository
rB Blender

Event Timeline

Kévin Dietrich (kevindietrich) requested review of this revision.Mar 29 2022, 3:28 PM
Kévin Dietrich (kevindietrich) created this revision.

I'm not sure why the mode needs to be cached. It is not possible to cache it in original Mesh, and for evaluated Mesh the mode matches the mode of the Dependency graph which owns the mesh. Dpeendnecy graph mode never changes.

source/blender/blenkernel/intern/object.cc
5558 ↗(On Diff #49839)
source/blender/makesrna/intern/rna_userdef.c
575 ↗(On Diff #49839)

I am not really sure why this works. The subsurf_required_mode is stored in evaluated mesh, and here you iterate over original objects, so seems they will not have subsurf_required_mode initialzied.

This is also quite weak to rely on evaluated state for RNA updates: the state is not guaranteed to be fully evaluated when the RNA update callback is called.

Store modifier session UUID and it to retrieve right modifier at draw time.

Sorry for the confusion about the RNA change in the previous, this is just
me changing some code based on API changes without thinking too much about
it.

  • Remove unrelated format changes
This revision is now accepted and ready to land.Apr 25 2022, 4:48 PM