Add some rendering statistics to profiler
authorPerttu Ahola <celeron55@gmail.com>
Mon, 17 Oct 2011 14:06:28 +0000 (17:06 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 17 Oct 2011 14:06:28 +0000 (17:06 +0300)
src/game.cpp
src/map.cpp

index e666e084d6d20a8f9b85c696ac71a99a840939be..78962c18c545d19dafcb24680208fe21cb838c96 100644 (file)
@@ -1071,6 +1071,7 @@ void the_game(
                object_hit_delay_timer -= dtime;
 
                g_profiler->add("Elapsed time", dtime);
+               g_profiler->avg("FPS", 1./dtime);
 
                /*
                        Log frametime for visualization
index 63c6ad57c9035db8198c5bfd9a026c38ff195ce7..943d9772a6db7b1eb8d6867e5f858024d56b4218 100644 (file)
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #endif
 #include "settings.h"
 #include "log.h"
+#include "profiler.h"
 
 #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
 
@@ -3760,6 +3761,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        p_nodes_max.Z / MAP_BLOCKSIZE + 1);
        
        u32 vertex_count = 0;
+       u32 meshbuffer_count = 0;
        
        // For limiting number of mesh updates per frame
        u32 mesh_update_count = 0;
@@ -3909,6 +3911,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                                sector_blocks_drawn++;
 
                                u32 c = mesh->getMeshBufferCount();
+                               meshbuffer_count += c;
 
                                for(u32 i=0; i<c; i++)
                                {
@@ -3939,6 +3942,17 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                }
        }
        
+       if(pass == scene::ESNRP_SOLID){
+               g_profiler->avg("CM: blocks drawn on solid pass", blocks_drawn);
+               g_profiler->avg("CM: vertices drawn on solid pass", vertex_count);
+               if(blocks_drawn != 0)
+                       g_profiler->avg("CM: solid meshbuffers per block",
+                                       (float)meshbuffer_count / (float)blocks_drawn);
+       } else {
+               g_profiler->avg("CM: blocks drawn on transparent pass", blocks_drawn);
+               g_profiler->avg("CM: vertices drawn on transparent pass", vertex_count);
+       }
+       
        m_control.blocks_drawn = blocks_drawn;
        m_control.blocks_would_have_drawn = blocks_would_have_drawn;