Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-19 17:27:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-20 10:28:02 +0300
commit8a42b3909f33d90b065eec2b8eb342df0a1fb659 (patch)
treece18e2cf699243b657eb2c1f35a4b5eabdf29b9b /source/blender/blenkernel/BKE_subdiv.h
parent94722121e572bc8ac4863ae7cdaf26386695202d (diff)
Subsurf: Add basic statistics to help benchmarking
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv.h')
-rw-r--r--source/blender/blenkernel/BKE_subdiv.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h
index 45316e3cc91..a1792866255 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -53,6 +53,40 @@ typedef struct SubdivSettings {
eSubdivFVarLinearInterpolation fvar_linear_interpolation;
} SubdivSettings;
+/* NOTE: Order of enumerators MUST match order of values in SubdivStats. */
+typedef enum eSubdivStatsValue {
+ SUBDIV_STATS_TOPOLOGY_REFINER_CREATION_TIME = 0,
+ SUBDIV_STATS_SUBDIV_TO_MESH,
+ SUBDIV_STATS_EVALUATOR_CREATE,
+ SUBDIV_STATS_EVALUATOR_REFINE,
+
+ NUM_SUBDIV_STATS_VALUES,
+} eSubdivStatsValue;
+
+typedef struct SubdivStats {
+ union {
+ struct {
+ /* Time spend on creating topology refiner, which includes time
+ * spend on conversion from Blender data to OpenSubdiv data, and
+ * time spend on topology orientation on OpenSubdiv C-API side.
+ */
+ double topology_refiner_creation_time;
+ /* Total time spent in BKE_subdiv_to_mesh(). */
+ double subdiv_to_mesh_time;
+ /* Time spent on evaluator creation from topology refiner. */
+ double evaluator_creation_time;
+ /* Time spent on evaluator->refine(). */
+ double evaluator_refine_time;
+ };
+ double values_[NUM_SUBDIV_STATS_VALUES];
+ };
+
+ /* Per-value timestamp on when corresponding BKE_subdiv_stats_begin() was
+ * called.
+ */
+ double begin_timestamp_[NUM_SUBDIV_STATS_VALUES];
+} SubdivStats;
+
typedef struct Subdiv {
/* Settings this subdivision surface is created for.
*
@@ -88,8 +122,19 @@ typedef struct Subdiv {
/* CPU side evaluator. */
struct OpenSubdiv_Evaluator *evaluator;
+
+ SubdivStats stats;
} Subdiv;
+/* =============================== STATISTICS =============================== */
+
+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_print(const SubdivStats *stats);
+
/* ============================== CONSTRUCTION ============================== */
Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,