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/draw | |
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/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_subdivision.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 8944388a5ac..4a39ca6dacb 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -1953,6 +1953,13 @@ static bool draw_subdiv_create_requested_buffers(const Scene *scene, draw_cache->optimal_display = optimal_display; draw_cache->num_subdiv_triangles = tris_count_from_number_of_loops(draw_cache->num_subdiv_loops); + /* Copy topology information for stats display. Use `mesh` directly, as `mesh_eval` could be the + * edit mesh. */ + mesh->runtime.subsurf_totvert = draw_cache->num_subdiv_verts; + mesh->runtime.subsurf_totedge = draw_cache->num_subdiv_edges; + mesh->runtime.subsurf_totpoly = draw_cache->num_subdiv_quads; + mesh->runtime.subsurf_totloop = draw_cache->num_subdiv_loops; + draw_cache->use_custom_loop_normals = (smd->flags & eSubsurfModifierFlag_UseCustomNormals) && (mesh_eval->flag & ME_AUTOSMOOTH) && CustomData_has_layer(&mesh_eval->ldata, |