diff --git a/m-tool.cc b/m-tool.cc index 9446270..9c9bbbe 100644 --- a/m-tool.cc +++ b/m-tool.cc @@ -175,14 +175,23 @@ void T_Main::makeUI( ) void T_Main::render( ) { if ( demo ) { - demo->render( ); + const bool hadReset = demo->render( ); + if ( hadReset ) { + UI::Profiler( ).clear( ); + UI::Profiler( ).startFrame( ); + UI::Profiler( ).start( "Full frame" ); + } - UI::Profiler( ).start( "Debug" ); + if ( !hadReset ) { + UI::Profiler( ).start( "Debug" ); + } T_Rendertarget::MainOutput( ); if ( UI::ODbg( ).isActive( ) ) { UI::ODbg( ).debugOutput( ); } - UI::Profiler( ).end( "Debug" ); + if ( !hadReset ) { + UI::Profiler( ).end( "Debug" ); + } } else { T_Rendertarget::MainOutput( ); diff --git a/ui-demo.cc b/ui-demo.cc index cfdcb5f..d18cbef 100644 --- a/ui-demo.cc +++ b/ui-demo.cc @@ -23,12 +23,14 @@ bool T_Demo::initialise( return program && runInit( *program ); } -void T_Demo::render( ) +bool T_Demo::render( ) { + bool rv = false; if ( Common::Ops( ).hasNewProgram( ) ) { auto nProgram{ Common::Ops( ).program( ) }; if ( runInit( *nProgram ) ) { program = std::move( nProgram ); + rv = true; } } @@ -44,6 +46,7 @@ void T_Demo::render( ) context->aborted = true; } } + return rv; } bool T_Demo::runInit( diff --git a/ui-demo.hh b/ui-demo.hh index e3ced13..76d766e 100644 --- a/ui-demo.hh +++ b/ui-demo.hh @@ -16,7 +16,7 @@ struct T_Demo bool initialise( const uint32_t width , const uint32_t height ); - void render( ); + bool render( ); // --------------------------------------------------------------------- diff --git a/ui-profiling.cc b/ui-profiling.cc index a937bcc..73a8ab1 100644 --- a/ui-profiling.cc +++ b/ui-profiling.cc @@ -94,6 +94,7 @@ void T_Profiler::start( parents_.add( Invalid ); } + assert( previous_ == Invalid || previous_ < pos ); chain_[ pos ] = previous_; if ( current_ != Invalid ) { parents_[ pos ] = current_;