From dd4424821918f2e12d6e61dd265be11c669efeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 17 Mar 2018 04:47:26 +0100 Subject: DRW: Move cache time to GPUViewport for profiling This enables us to average this timer over time like the others. --- source/blender/draw/intern/draw_manager.c | 6 +++++- source/blender/draw/intern/draw_manager.h | 5 +---- source/blender/draw/intern/draw_manager_profiling.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3c21acd3a02..dbcfa02c555 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1143,7 +1143,11 @@ void DRW_draw_render_loop_ex( drw_engines_cache_finish(); DRW_render_instance_buffer_finish(); - PROFILE_END_ACCUM(DST.cache_time, stime); + +#ifdef USE_PROFILE + double *cache_time = GPU_viewport_cache_time_get(DST.viewport); + PROFILE_END_UPDATE(*cache_time, stime); +#endif } DRW_stats_begin(); diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 6d4eee08ad6..c7e9b3dc08d 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -52,7 +52,7 @@ #ifdef USE_PROFILE # include "PIL_time.h" -# define PROFILE_TIMER_FALLOFF 0.1 +# define PROFILE_TIMER_FALLOFF 0.04 # define PROFILE_START(time_start) \ double time_start = PIL_check_seconds_timer(); @@ -304,9 +304,6 @@ typedef struct DRWManager { bool buffer_finish_called; /* Avoid bad usage of DRW_render_instance_buffer_finish */ - /* Profiling */ - double cache_time; - /* View dependant uniforms. */ DRWMatrixState original_mat; /* Original rv3d matrices. */ int override_mat; /* Bitflag of which matrices are overriden. */ diff --git a/source/blender/draw/intern/draw_manager_profiling.c b/source/blender/draw/intern/draw_manager_profiling.c index 8e5f98b5a49..47769b1fb18 100644 --- a/source/blender/draw/intern/draw_manager_profiling.c +++ b/source/blender/draw/intern/draw_manager_profiling.c @@ -286,9 +286,10 @@ void DRW_stats_draw(rcti *rect) v += 2; u = 0; + double *cache_time = GPU_viewport_cache_time_get(DST.viewport); sprintf(col_label, "Cache Time"); draw_stat_5row(rect, u++, v, col_label, sizeof(col_label)); - sprintf(time_to_txt, "%.2fms", DST.cache_time); + sprintf(time_to_txt, "%.2fms", *cache_time); draw_stat_5row(rect, u++, v, time_to_txt, sizeof(time_to_txt)); v += 2; -- cgit v1.2.3