aboutsummaryrefslogtreecommitdiff
path: root/tests/raytrace.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-06-11 13:52:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-06-11 13:52:03 -0700
commit2418f58a297b6e3c84df9bd2ad247c8e13ce5858 (patch)
tree0eb561d80aba367783e62ad0cd420a00c0f740fa /tests/raytrace.cpp
parentecd0edf168fd1a2ff275f08b2daa7ea6926c623e (diff)
add comparison to native speed to benchmarks
Diffstat (limited to 'tests/raytrace.cpp')
-rw-r--r--tests/raytrace.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/raytrace.cpp b/tests/raytrace.cpp
index 27db4b72..36726839 100644
--- a/tests/raytrace.cpp
+++ b/tests/raytrace.cpp
@@ -6,7 +6,9 @@
#include <iostream> // compile with ie g++ -O2 -ffast-math sphereflake.cc
#include <stdlib.h>
-#include "emscripten.h"
+//#include "emscripten.h"
+
+static int outputLeft = 550; // limit output, so we do not benchmark speed of printing
#define GIMME_SHADOWS // usage: ./sphereflake [lvl=6] >pix.ppm
@@ -117,12 +119,18 @@ static void trace_rgss(const int width,const int height) {
ray.d=(scan+rgss[idx]).norm();
g+=ray_trace(pool,ray); /*trace*/
}
- std::cout << int(scale*g)<< " ";
+ if (outputLeft) {
+ std::cout << int(scale*g)<< " ";
+ outputLeft--;
+ }
scan.x+=1; /*next pixel*/
}
scan.x=0;scan.y-=1; /*next line*/
}
- std::cout << "\n"; // XXX Emscripten: std::endl crashes...
+ if (outputLeft) {
+ std::cout << "\n"; // XXX Emscripten: std::endl crashes...
+ outputLeft--;
+ }
}
struct basis_t{ /* bogus and compact, exactly what we need */