medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit c1a64b33a5d1a764656f44aabe0d4c62c6734f29
parent 1384baeb101cea9a61a3fc0b45338741b7dd035c
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Dec 26 00:56:10 +0200

Add some profiling blocks

Diffstat:
gpubtt.cc | 10++++++++--
hm.cc | 8+++++++-
terrain_manager.cc | 4++++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/gpubtt.cc b/gpubtt.cc @@ -4,6 +4,7 @@ #include "heightmap.h" #include "gpubtt.h" #include "linear_algebra.h" +#include "profiler.h" static u32 btt_count_leaves( const BTT * btt ) { if( btt->left ) { @@ -39,6 +40,8 @@ void gpubtt_init( MemoryArena * arena, GPUBTT * gpubtt, BTTs btts, const OffsetHeightmap * ohm, const v3 * normals, const float * horizons ) { + PROFILE_FUNCTION(); + MEMARENA_SCOPED_CHECKPOINT( arena ); const u32 num_leaves = btt_count_leaves( btts.left_root ) @@ -53,8 +56,11 @@ void gpubtt_init( const v2s32 tl( 0, ohm->hm.height - 1 ); const v2s32 tr( ohm->hm.width - 1, ohm->hm.height - 1 ); - gpubtt_build( verts, &num_vertices, ohm, btts.left_root, bl, tl, tr ); - gpubtt_build( verts, &num_vertices, ohm, btts.right_root, tr, br, bl ); + { + PROFILE_BLOCK( "gpubtt_build" ); + gpubtt_build( verts, &num_vertices, ohm, btts.left_root, bl, tl, tr ); + gpubtt_build( verts, &num_vertices, ohm, btts.right_root, tr, br, bl ); + } VB positions = renderer_new_vb( verts, num_vertices * sizeof( v3 ) ); diff --git a/hm.cc b/hm.cc @@ -14,6 +14,7 @@ #include "hashtable.h" #include "stream.h" #include "http.h" +#include "profiler.h" #include "platform_io.h" #include "platform_net.h" @@ -166,7 +167,12 @@ static Pool< Player, 1024 > players; static HashTable< Player *, 1024 * 2 > sid_to_player; extern "C" GAME_FRAME( game_frame ) { - renderer_begin_frame( CLEARCOLOUR_DONT ); + PROFILE_FUNCTION(); + + { + PROFILE_BLOCK( "renderer_begin_frame" ); + renderer_begin_frame( CLEARCOLOUR_DONT ); + } const int fb = input->keys[ KEY_W ] - input->keys[ KEY_S ]; const int lr = input->keys[ KEY_A ] - input->keys[ KEY_D ]; diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -11,6 +11,7 @@ #include "linear_algebra.h" #include "str.h" #include "nonblocking_fixed_mpsc_queue.h" +#include "profiler.h" #include "lz4.h" @@ -409,8 +410,11 @@ struct FSData { }; void terrain_render( TerrainManager * tm, const m4 & V, const m4 & P, float sun, double current_time ) { + PROFILE_FUNCTION(); + ReadyTile ready_tile; while( tm->ready_tiles.dequeue( &ready_tile ) ) { + PROFILE_BLOCK( "upload BTT" ); s32 tx = ready_tile.tx; s32 ty = ready_tile.ty;