Subsurf: Remove OpenSubdiv options from modifier
There are following reasons to do so: - The plan is to replace it with some sort of object or viewport option, so we can apply OpenSubdiv subdivisions on top of modifier stack and keep modifier stack purely CPU side. This will solve issues when adding some relation in scene will force modifier to be evaluated on CPU. - With new upcoming OpenSubdiv based CPU modifier implementation we can cache topology similar to what GPU side was doing, which will already be reasonably faster. - OpenSubdiv GPU does not work since the OpenGL version bump, and is to be rewritten with all the adaptive refine options kept in mind. Since OpenSubdiv GPU was already broken and was only causing object to become invisible, there is no reason to keep having that option in the modifier. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D3598
This commit is contained in:
parent
e6827ad9a6
commit
3ee6b940df
|
@ -995,8 +995,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||
sub.prop(md, "uv_smooth", text="")
|
||||
|
||||
col.prop(md, "show_only_control_edges")
|
||||
if hasattr(md, "use_opensubdiv"):
|
||||
col.prop(md, "use_opensubdiv")
|
||||
|
||||
if show_adaptive_options and ob.cycles.use_adaptive_subdivision:
|
||||
col = layout.column(align=True)
|
||||
|
|
|
@ -2857,39 +2857,6 @@ static void editbmesh_calc_modifiers(
|
|||
MEM_freeN(deformedVerts);
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
/* The idea is to skip CPU-side ORCO calculation when
|
||||
* we'll be using GPU backend of OpenSubdiv. This is so
|
||||
* playback performance is kept as high as possible.
|
||||
*/
|
||||
static bool calc_modifiers_skip_orco(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
bool use_render_params)
|
||||
{
|
||||
ModifierData *last_md = ob->modifiers.last;
|
||||
const int required_mode = use_render_params ? eModifierMode_Render : eModifierMode_Realtime;
|
||||
if (last_md != NULL &&
|
||||
last_md->type == eModifierType_Subsurf &&
|
||||
modifier_isEnabled(scene, last_md, required_mode))
|
||||
{
|
||||
if (U.opensubdiv_compute_type == USER_OPENSUBDIV_COMPUTE_NONE) {
|
||||
return false;
|
||||
}
|
||||
else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) {
|
||||
return false;
|
||||
}
|
||||
else if ((DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) != 0) {
|
||||
return false;
|
||||
}
|
||||
SubsurfModifierData *smd = (SubsurfModifierData *)last_md;
|
||||
/* TODO(sergey): Deduplicate this with checks from subsurf_ccg.c. */
|
||||
return smd->use_opensubdiv != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mesh_finalize_eval(Object *object)
|
||||
{
|
||||
Mesh *mesh = (Mesh *)object->data;
|
||||
|
@ -2941,12 +2908,6 @@ static void mesh_build_data(
|
|||
BKE_object_free_derived_caches(ob);
|
||||
BKE_object_sculpt_modifiers_changed(ob);
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
if (calc_modifiers_skip_orco(depsgraph, scene, ob, false)) {
|
||||
dataMask &= ~(CD_MASK_ORCO | CD_MASK_PREVIEW_MCOL);
|
||||
}
|
||||
#endif
|
||||
|
||||
mesh_calc_modifiers(
|
||||
depsgraph, scene, ob, NULL, 1, need_mapping, dataMask, -1, true, build_shapekey_layers,
|
||||
true,
|
||||
|
@ -2988,12 +2949,6 @@ static void editbmesh_build_data(
|
|||
|
||||
BKE_editmesh_free_derivedmesh(em);
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
if (calc_modifiers_skip_orco(depsgraph, scene, obedit, false)) {
|
||||
dataMask &= ~(CD_MASK_ORCO | CD_MASK_PREVIEW_MCOL);
|
||||
}
|
||||
#endif
|
||||
|
||||
editbmesh_calc_modifiers(
|
||||
depsgraph, scene, obedit, em, dataMask,
|
||||
&em->derivedCage, &em->derivedFinal);
|
||||
|
|
|
@ -162,8 +162,7 @@ typedef struct SubsurfModifierData {
|
|||
|
||||
short subdivType, levels, renderLevels, flags;
|
||||
short uv_smooth;
|
||||
short use_opensubdiv;
|
||||
short pad[2];
|
||||
short pad[3];
|
||||
|
||||
void *emCache, *mCache;
|
||||
} SubsurfModifierData;
|
||||
|
|
|
@ -1249,13 +1249,6 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
|
|||
RNA_def_property_enum_items(prop, prop_uv_smooth_items);
|
||||
RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
prop = RNA_def_property(srna, "use_opensubdiv", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "use_opensubdiv", 1);
|
||||
RNA_def_property_ui_text(prop, "Use OpenSubdiv", "Use OpenSubdiv for the subdivisions (viewport only)");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rna_def_modifier_generic_map_info(StructRNA *srna)
|
||||
|
|
|
@ -113,9 +113,6 @@ static DerivedMesh *applyModifier(
|
|||
const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||
const bool isFinalCalc = (ctx->flag & MOD_APPLY_USECACHE) != 0;
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
const bool allow_gpu = (ctx->flag & MOD_APPLY_ALLOW_GPU) != 0;
|
||||
#endif
|
||||
bool do_cddm_convert = useRenderParams || !isFinalCalc;
|
||||
|
||||
if (useRenderParams)
|
||||
|
@ -125,31 +122,6 @@ static DerivedMesh *applyModifier(
|
|||
if (ctx->object->mode & OB_MODE_EDIT)
|
||||
subsurf_flags |= SUBSURF_IN_EDIT_MODE;
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
/* TODO(sergey): Not entirely correct, modifiers on top of subsurf
|
||||
* could be disabled.
|
||||
*/
|
||||
if (md->next == NULL &&
|
||||
allow_gpu &&
|
||||
do_cddm_convert == false &&
|
||||
smd->use_opensubdiv)
|
||||
{
|
||||
if (U.opensubdiv_compute_type == USER_OPENSUBDIV_COMPUTE_NONE) {
|
||||
modifier_setError(md, "OpenSubdiv is disabled in User Preferences");
|
||||
}
|
||||
else if ((ctx->object->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) {
|
||||
modifier_setError(md, "OpenSubdiv is not supported in paint modes");
|
||||
}
|
||||
else if ((DEG_get_eval_flags_for_id(ctx->depsgraph, &ctx->object->id) & DAG_EVAL_NEED_CPU) == 0) {
|
||||
subsurf_flags |= SUBSURF_USE_GPU_BACKEND;
|
||||
do_cddm_convert = false;
|
||||
}
|
||||
else {
|
||||
modifier_setError(md, "OpenSubdiv is disabled due to dependencies");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
result = subsurf_make_derived_from_derived(derivedData, smd, scene, NULL, subsurf_flags);
|
||||
result->cd_flag = derivedData->cd_flag;
|
||||
|
||||
|
@ -159,9 +131,7 @@ static DerivedMesh *applyModifier(
|
|||
result = cddm;
|
||||
}
|
||||
|
||||
#ifndef WITH_OPESUBDIV
|
||||
(void) do_cddm_convert;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -176,12 +146,6 @@ static DerivedMesh *applyModifierEM(
|
|||
DerivedMesh *result;
|
||||
/* 'orco' using editmode flags would cause cache to be used twice in editbmesh_calc_modifiers */
|
||||
SubsurfFlags ss_flags = (ctx->flag & MOD_APPLY_ORCO) ? 0 : (SUBSURF_FOR_EDIT_MODE | SUBSURF_IN_EDIT_MODE);
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
const bool allow_gpu = (ctx->flag & MOD_APPLY_ALLOW_GPU) != 0;
|
||||
if (md->next == NULL && allow_gpu && smd->use_opensubdiv) {
|
||||
modifier_setError(md, "OpenSubdiv is not supported in edit mode");
|
||||
}
|
||||
#endif
|
||||
|
||||
result = subsurf_make_derived_from_derived(derivedData, smd, scene, NULL, ss_flags);
|
||||
return result;
|
||||
|
@ -271,19 +235,6 @@ static Mesh *applyModifier_subdiv(ModifierData *md,
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool dependsOnNormals(ModifierData *md)
|
||||
{
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
SubsurfModifierData *smd = (SubsurfModifierData *) md;
|
||||
if (smd->use_opensubdiv && md->next == NULL) {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
UNUSED_VARS(md);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Subsurf = {
|
||||
/* name */ "Subsurf",
|
||||
/* structName */ "SubsurfModifierData",
|
||||
|
@ -321,7 +272,7 @@ ModifierTypeInfo modifierType_Subsurf = {
|
|||
/* isDisabled */ isDisabled,
|
||||
/* updateDepsgraph */ NULL,
|
||||
/* dependsOnTime */ NULL,
|
||||
/* dependsOnNormals */ dependsOnNormals,
|
||||
/* dependsOnNormals */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
|
|
Loading…
Reference in New Issue