From 7eda267df1a997c1525a0aa62ad2de2f1b77c6e5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 16 Jan 2019 10:15:25 +0100 Subject: Subdiv: Reset evaluator creation statistics Makes it more clear to see what was exactly happening at the last invocation of subsurf modifier. --- source/blender/blenkernel/BKE_subdiv.h | 2 ++ source/blender/blenkernel/intern/subdiv_eval.c | 7 +++---- source/blender/blenkernel/intern/subdiv_stats.c | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index d79ea1ca646..302616e4867 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -188,6 +188,8 @@ void BKE_subdiv_stats_init(SubdivStats *stats); void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value); void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value); +void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value); + void BKE_subdiv_stats_print(const SubdivStats *stats); /* ================================ SETTINGS ================================ */ diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c index 7043edc7fc9..acc121a55fa 100644 --- a/source/blender/blenkernel/intern/subdiv_eval.c +++ b/source/blender/blenkernel/intern/subdiv_eval.c @@ -46,10 +46,10 @@ bool BKE_subdiv_eval_begin(Subdiv *subdiv) { + BKE_subdiv_stats_reset(&subdiv->stats, SUBDIV_STATS_EVALUATOR_CREATE); if (subdiv->topology_refiner == NULL) { /* Happens on input mesh with just loose geometry, - * or when OpenSubdiv is disabled - */ + * or when OpenSubdiv is disabled */ return false; } else if (subdiv->evaluator == NULL) { @@ -76,8 +76,7 @@ static void set_coarse_positions(Subdiv *subdiv, const Mesh *mesh) /* Mark vertices which needs new coordinates. */ /* TODO(sergey): This is annoying to calculate this on every update, * maybe it's better to cache this mapping. Or make it possible to have - * OpenSubdiv's vertices match mesh ones? - */ + * OpenSubdiv's vertices match mesh ones? */ BLI_bitmap *vertex_used_map = BLI_BITMAP_NEW(mesh->totvert, "vert used map"); for (int poly_index = 0; poly_index < mesh->totpoly; poly_index++) { diff --git a/source/blender/blenkernel/intern/subdiv_stats.c b/source/blender/blenkernel/intern/subdiv_stats.c index 370aedad04f..dea536459b4 100644 --- a/source/blender/blenkernel/intern/subdiv_stats.c +++ b/source/blender/blenkernel/intern/subdiv_stats.c @@ -56,6 +56,11 @@ void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value) PIL_check_seconds_timer() - stats->begin_timestamp_[value]; } +void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value) +{ + stats->values_[value] = 0.0; +} + void BKE_subdiv_stats_print(const SubdivStats *stats) { #define STATS_PRINT_TIME(stats, value, description) \ -- cgit v1.2.3