clray
diff src/rt.cc @ 58:3d13924b22e6
implementing polygon split
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 12 Sep 2010 00:19:04 +0100 |
parents | df239a52a091 |
children | 8c858e1a89e8 |
line diff
1.1 --- a/src/rt.cc Sat Sep 11 03:01:20 2010 +0100 1.2 +++ b/src/rt.cc Sun Sep 12 00:19:04 2010 +0100 1.3 @@ -1,6 +1,7 @@ 1.4 #include <stdio.h> 1.5 #include <string.h> 1.6 #include <math.h> 1.7 +#include <limits.h> 1.8 #include <assert.h> 1.9 #include "rt.h" 1.10 #include "ogl.h" 1.11 @@ -41,8 +42,6 @@ 1.12 static long timing_sample_sum; 1.13 static long num_timing_samples; 1.14 1.15 -extern bool dbg_frame_time; 1.16 - 1.17 1.18 bool init_renderer(int xsz, int ysz, Scene *scn, unsigned int tex) 1.19 { 1.20 @@ -137,9 +136,12 @@ 1.21 1.22 bool render() 1.23 { 1.24 - // XXX do we need to call glFinish ? 1.25 + long tm0 = get_msec(); 1.26 1.27 - long tm0 = get_msec(); 1.28 + // initialize render-stats 1.29 + memset(&rstat, 0, sizeof rstat); 1.30 + rstat.min_aabb_tests = rstat.min_triangle_tests = INT_MAX; 1.31 + rstat.max_aabb_tests = rstat.max_triangle_tests = 0; 1.32 1.33 #ifdef CLGL_INTEROP 1.34 cl_event ev; 1.35 @@ -180,13 +182,11 @@ 1.36 unmap_mem_buffer(mbuf); 1.37 #endif 1.38 1.39 - long msec = get_msec() - tm0; 1.40 - timing_sample_sum += msec; 1.41 + rstat.render_time = get_msec() - tm0; 1.42 + 1.43 + timing_sample_sum += rstat.render_time; 1.44 num_timing_samples++; 1.45 1.46 - if(dbg_frame_time) { 1.47 - printf("rendered in %ld msec\n", msec); 1.48 - } 1.49 return true; 1.50 } 1.51