[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54284] trunk/blender/source/blender/ editors/space_view3d/drawvolume.c: drawvolume was timing drawing unnecessarily,
Campbell Barton
ideasman42 at gmail.com
Mon Feb 4 01:02:29 CET 2013
Revision: 54284
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54284
Author: campbellbarton
Date: 2013-02-04 00:02:26 +0000 (Mon, 04 Feb 2013)
Log Message:
-----------
drawvolume was timing drawing unnecessarily,
replace local defined timing functions with calls to TIMEIT_* macros from PIL_time.h and disable by default.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/drawvolume.c
Modified: trunk/blender/source/blender/editors/space_view3d/drawvolume.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawvolume.c 2013-02-03 23:04:42 UTC (rev 54283)
+++ trunk/blender/source/blender/editors/space_view3d/drawvolume.c 2013-02-04 00:02:26 UTC (rev 54284)
@@ -74,61 +74,18 @@
#include "ED_mesh.h"
-
#include "BLF_api.h"
-
#include "view3d_intern.h" // own include
+struct GPUTexture;
-#ifdef _WIN32
-#include <time.h>
-#include <stdio.h>
-#include <conio.h>
-#include <windows.h>
+// #define DEBUG_DRAW_TIME
-static LARGE_INTEGER liFrequency;
-static LARGE_INTEGER liStartTime;
-static LARGE_INTEGER liCurrentTime;
-
-static void tstart(void)
-{
- QueryPerformanceFrequency(&liFrequency);
- QueryPerformanceCounter(&liStartTime);
-}
-static void tend(void)
-{
- QueryPerformanceCounter(&liCurrentTime);
-}
-static double tval(void)
-{
- return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart) * (double)1000.0 / (double)liFrequency.QuadPart));
-}
-#else
-#include <sys/time.h>
-static struct timeval _tstart, _tend;
-static struct timezone tz;
-static void tstart(void)
-{
- gettimeofday(&_tstart, &tz);
-}
-static void tend(void)
-{
- gettimeofday(&_tend, &tz);
-}
- #if 0
-static double tval()
-{
- double t1, t2;
- t1 = ( double ) _tstart.tv_sec * 1000 + ( double ) _tstart.tv_usec / (1000);
- t2 = ( double ) _tend.tv_sec * 1000 + ( double ) _tend.tv_usec / (1000);
- return t2 - t1;
-}
- #endif
+#ifdef DEBUG_DRAW_TIME
+# include "PIL_time.h"
#endif
-struct GPUTexture;
-
static int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
{
int i;
@@ -275,7 +232,10 @@
return;
}
- tstart();
+#ifdef DEBUG_DRAW_TIME
+ TIMEIT_START(draw);
+#endif
+
/* generate flame spectrum texture */
#define SPEC_WIDTH 256
#define FIRE_THRESH 7
@@ -522,8 +482,10 @@
n++;
}
- tend();
- // printf ( "Draw Time: %f\n",(float) tval() );
+#ifdef DEBUG_DRAW_TIME
+ printf("Draw Time: %f\n", (float)TIMEIT_VALUE(draw));
+ TIMEIT_END(draw);
+#endif
if (tex_shadow)
GPU_texture_unbind(tex_shadow);
More information about the Bf-blender-cvs
mailing list