Page MenuHome

Fix T96338: crash with GPU subdivision switching to UV editing tab
AbandonedPublic

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

Details

Summary

The crash happens because the draw code attempts to perform GPU subdivision
edit mode is entered when switching to the UV editing tab although
the subsurf modifier is not the last in the stack. As edit mode is entered,
the draw code looks up the last modifier by using the edit mode flag
(eModifierMode_Editmode), however it could be that the last actual enabled
modifier is not enabled in edit mode, so the subsurf modifier should not be
selected.

This adds a check for the eModifierMode_Editmode flag when looking up the
last enabled modifier for GPU subdivision, and only return true if the last
modifier is the same with and without the flag.

Diff Detail

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

Event Timeline

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

Seems very similar issue to D14488.

Shall it be solved in a different way, say, store session_uuid of the modifier which modifier stack "deferred" to GPU evaluation. That way we don't need to match logic between evaluation and visualization.
I theory can perhaps even store pointer to ModifierData which was deferred. Since it's all stored in runtime it could work OK. Although, need to be careful and add backup/restore logic in the copy-on-write backup/restore process (in deg_eval_runtime_backup_*).

source/blender/blenkernel/intern/subdiv_modifier.c
133

Not clear WHY this is needed. How's edit mode is different from any other mode?

Kévin Dietrich (kevindietrich) planned changes to this revision.Apr 1 2022, 11:45 AM

Using the session_uuid fixes the problem from D14488, so I think I can update that patch using session_uuid instead of caching required mode.

However, it did not fix this problem. When entering edit mode, the modifier stack is reevaluated, which asks for GPU subdivision as it is the last enabled in this mode (which would give sense to using eModifierMode_Editmode as in this patch, as it does not happen when modifier flags are different).

However, after some more investigation, it would appear that there is also some logic issue in the draw code where buffers are requested in the wrong place when GPU subdivision is enabled.

Tagging as planned changes until I make sense of all that.

Closing this as the issue was not about order of modifiers, but order in which data is requested by the draw code.