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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-08-11 16:39:09 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-08-13 15:30:47 +0300
commit2087158d5b5debd7f943fd1c83dd1e6254db2c2a (patch)
tree83ea066f5c512d6401bcf0423dfd9fe7e5cb17b4 /source
parent22872857d443f9251dfb474296601c2dfdc5da76 (diff)
DRW: Make Cache timing global and not per object.
This is to fix some performance bottleneck.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_manager.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 81aedfa07d0..7b46efd0566 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -360,6 +360,9 @@ static struct DRWGlobalState {
struct DRWTextStore **text_store_p;
ListBase enabled_engines; /* RenderEngineType */
+
+ /* Profiling */
+ double cache_time;
} DST = {NULL};
static struct DRWMatrixOveride {
@@ -2676,13 +2679,9 @@ static void DRW_engines_cache_init(void)
DST.text_store_p = &data->text_draw_cache;
}
- PROFILE_START(stime);
- data->cache_time = 0.0;
-
if (engine->cache_init) {
engine->cache_init(data);
}
- PROFILE_END_ACCUM(data->cache_time, stime);
}
}
@@ -2691,13 +2690,10 @@ static void DRW_engines_cache_populate(Object *ob)
for (LinkData *link = DST.enabled_engines.first; link; link = link->next) {
DrawEngineType *engine = link->data;
ViewportEngineData *data = DRW_viewport_engine_data_get(engine);
- PROFILE_START(stime);
if (engine->cache_populate) {
engine->cache_populate(data, ob);
}
-
- PROFILE_END_ACCUM(data->cache_time, stime);
}
}
@@ -2706,13 +2702,10 @@ static void DRW_engines_cache_finish(void)
for (LinkData *link = DST.enabled_engines.first; link; link = link->next) {
DrawEngineType *engine = link->data;
ViewportEngineData *data = DRW_viewport_engine_data_get(engine);
- PROFILE_START(stime);
if (engine->cache_finish) {
engine->cache_finish(data);
}
-
- PROFILE_END_ACCUM(data->cache_time, stime);
}
}
@@ -2988,7 +2981,7 @@ static void draw_stat(rcti *rect, int u, int v, const char *txt, const int size)
static void DRW_debug_cpu_stats(void)
{
int u, v;
- double cache_tot_time = 0.0, init_tot_time = 0.0, background_tot_time = 0.0, render_tot_time = 0.0, tot_time = 0.0;
+ double init_tot_time = 0.0, background_tot_time = 0.0, render_tot_time = 0.0, tot_time = 0.0;
/* local coordinate visible rect inside region, to accomodate overlapping ui */
rcti rect;
struct ARegion *ar = DST.draw_ctx.ar;
@@ -3002,8 +2995,6 @@ static void DRW_debug_cpu_stats(void)
char col_label[32];
sprintf(col_label, "Engine");
draw_stat(&rect, u++, v, col_label, sizeof(col_label));
- sprintf(col_label, "Cache");
- draw_stat(&rect, u++, v, col_label, sizeof(col_label));
sprintf(col_label, "Init");
draw_stat(&rect, u++, v, col_label, sizeof(col_label));
sprintf(col_label, "Background");
@@ -3023,10 +3014,6 @@ static void DRW_debug_cpu_stats(void)
draw_stat(&rect, u++, v, engine->idname, sizeof(engine->idname));
- cache_tot_time += data->cache_time;
- sprintf(time_to_txt, "%.2fms", data->cache_time);
- draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
-
init_tot_time += data->init_time;
sprintf(time_to_txt, "%.2fms", data->init_time);
draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
@@ -3049,8 +3036,6 @@ static void DRW_debug_cpu_stats(void)
u = 0;
sprintf(col_label, "Sub Total");
draw_stat(&rect, u++, v, col_label, sizeof(col_label));
- sprintf(time_to_txt, "%.2fms", cache_tot_time);
- draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
sprintf(time_to_txt, "%.2fms", init_tot_time);
draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
sprintf(time_to_txt, "%.2fms", background_tot_time);
@@ -3059,6 +3044,13 @@ static void DRW_debug_cpu_stats(void)
draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
sprintf(time_to_txt, "%.2fms", tot_time);
draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
+ v += 2;
+
+ u = 0;
+ sprintf(col_label, "Cache Time");
+ draw_stat(&rect, u++, v, col_label, sizeof(col_label));
+ sprintf(time_to_txt, "%.2fms", DST.cache_time);
+ draw_stat(&rect, u++, v, time_to_txt, sizeof(time_to_txt));
}
/* Display GPU time for each passes */
@@ -3071,7 +3063,7 @@ static void DRW_debug_gpu_stats(void)
UI_FontThemeColor(BLF_default(), TH_TEXT_HI);
- int v = BLI_listbase_count(&DST.enabled_engines) + 3;
+ int v = BLI_listbase_count(&DST.enabled_engines) + 5;
char stat_string[32];
@@ -3162,6 +3154,7 @@ void DRW_draw_render_loop_ex(
/* ideally only refresh when objects are added/removed */
/* or render properties / materials change */
if (cache_is_dirty) {
+ PROFILE_START(stime);
DRW_engines_cache_init();
DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL);
@@ -3173,6 +3166,7 @@ void DRW_draw_render_loop_ex(
DEG_OBJECT_ITER_END
DRW_engines_cache_finish();
+ PROFILE_END_ACCUM(DST.cache_time, stime);
}
DRW_stats_begin();