diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-27 16:30:17 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-27 16:30:17 +0300 |
commit | 163f6a17e4fe60ce917715afc5bb5eae3d5ff07a (patch) | |
tree | f4ccaf95ae9ca893582805a5f433ab2ee1bec042 /source/blender/editors/space_info | |
parent | 08731d70bf667a7179a3ea4c29aa9d81b019d4ee (diff) |
Fix T96434: bad performance with viewport statistics and GPU subdivision
The subdivision is always recomputed on the CPU when displaying stats
if the mesh is animated which leads to bad performance.
This caches the subdivision topology counters from the draw code in the
mesh runtime and uses them for the viewport statistics.
Differential Revision: https://developer.blender.org/D14774
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/info_stats.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index 6f0d5c2dbe9..b817ff887ce 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -96,6 +96,12 @@ static bool stats_mesheval(const Mesh *me_eval, bool is_selected, SceneStats *st const SubdivCCG *subdiv_ccg = me_eval->runtime.subdiv_ccg; BKE_subdiv_ccg_topology_counters(subdiv_ccg, &totvert, &totedge, &totface, &totloop); } + else if (me_eval->runtime.subsurf_resolution != 0) { + totvert = me_eval->runtime.subsurf_totvert; + totedge = me_eval->runtime.subsurf_totedge; + totface = me_eval->runtime.subsurf_totpoly; + totloop = me_eval->runtime.subsurf_totloop; + } else { totvert = me_eval->totvert; totedge = me_eval->totedge; @@ -138,7 +144,7 @@ static void stats_object(Object *ob, switch (ob->type) { case OB_MESH: { /* we assume evaluated mesh is already built, this strictly does stats now. */ - const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); + const Mesh *me_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); if (!BLI_gset_add(objects_gset, (void *)me_eval)) { break; } |