Blender V2.61 - r43446

rayobject_raycounter.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2009 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): André Pinto.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #include "rayobject.h"
00034 #include "raycounter.h"
00035 
00036 #ifdef RE_RAYCOUNTER
00037 
00038 void RE_RC_INFO(RayCounter *info)
00039 {
00040     printf("----------- Raycast counter --------\n");
00041     printf("Rays total: %llu\n", info->raycast.test );
00042     printf("Rays hit: %llu\n",   info->raycast.hit  );
00043     printf("\n");
00044     printf("BB tests: %llu\n", info->bb.test );
00045     printf("BB hits: %llu\n", info->bb.hit );
00046     printf("\n");   
00047     printf("SIMD BB tests: %llu\n", info->simd_bb.test );
00048     printf("SIMD BB hits: %llu\n", info->simd_bb.hit );
00049     printf("\n");   
00050     printf("Primitives tests: %llu\n", info->faces.test );
00051     printf("Primitives hits: %llu\n", info->faces.hit );
00052     printf("------------------------------------\n");
00053     printf("Shadow last-hit tests per ray: %f\n", info->rayshadow_last_hit.test / ((float)info->raycast.test) );
00054     printf("Shadow last-hit hits per ray: %f\n",  info->rayshadow_last_hit.hit  / ((float)info->raycast.test) );
00055     printf("\n");
00056     printf("Hint tests per ray: %f\n", info->raytrace_hint.test / ((float)info->raycast.test) );
00057     printf("Hint hits per ray: %f\n",  info->raytrace_hint.hit  / ((float)info->raycast.test) );
00058     printf("\n");
00059     printf("BB tests per ray: %f\n", info->bb.test / ((float)info->raycast.test) );
00060     printf("BB hits per ray: %f\n", info->bb.hit / ((float)info->raycast.test) );
00061     printf("\n");
00062     printf("SIMD tests per ray: %f\n", info->simd_bb.test / ((float)info->raycast.test) );
00063     printf("SIMD hits per ray: %f\n", info->simd_bb.hit / ((float)info->raycast.test) );
00064     printf("\n");
00065     printf("Primitives tests per ray: %f\n", info->faces.test / ((float)info->raycast.test) );
00066     printf("Primitives hits per ray: %f\n", info->faces.hit / ((float)info->raycast.test) );
00067     printf("------------------------------------\n");
00068 }
00069 
00070 void RE_RC_MERGE(RayCounter *dest, RayCounter *tmp)
00071 {
00072     dest->faces.test += tmp->faces.test;
00073     dest->faces.hit  += tmp->faces.hit;
00074 
00075     dest->bb.test += tmp->bb.test;
00076     dest->bb.hit  += tmp->bb.hit;
00077 
00078     dest->simd_bb.test += tmp->simd_bb.test;
00079     dest->simd_bb.hit  += tmp->simd_bb.hit;
00080 
00081     dest->raycast.test += tmp->raycast.test;
00082     dest->raycast.hit  += tmp->raycast.hit;
00083     
00084     dest->rayshadow_last_hit.test += tmp->rayshadow_last_hit.test;
00085     dest->rayshadow_last_hit.hit  += tmp->rayshadow_last_hit.hit;
00086 
00087     dest->raytrace_hint.test += tmp->raytrace_hint.test;
00088     dest->raytrace_hint.hit  += tmp->raytrace_hint.hit;
00089 }
00090 
00091 #endif