//-----------------------------------------------------------------------------
// The application main loop
//-----------------------------------------------------------------------------
int CIHVTestApp::Main()
{
	SpewOutputFunc( IHVTestSpewFunc );
		    
	if ( !SetupStudioRender() )
	{
		return 0;
	}

	if ( !InitMaterialSystem( m_hWnd ) )
	{
		return 0;
	}

#if !defined( _X360 ) // X360TBD:
extern void Sys_InitFloatTime( void ); //garymcthack
	Sys_InitFloatTime();
#endif

	LoadModels();

#if USE_VTUNE
	VTResume();
#endif
#ifdef USE_VPROF
	g_VProfCurrentProfile.Start();
#endif

	bool m_bExitMainLoop = false;
	while (!m_bExitMainLoop && !g_BenchFinished)
	{
		AppPumpMessages();
		RenderFrame();
	}

#ifdef USE_VPROF
	g_VProfCurrentProfile.Stop();
#endif
	g_IHVTestFP = fopen( "ihvtest_vprof.txt", "w" );
#ifdef USE_VPROF
	SpewOutputFunc( IHVTestVProfSpewFunc );
	g_VProfCurrentProfile.OutputReport( VPRT_SUMMARY );
	g_VProfCurrentProfile.OutputReport( VPRT_HIERARCHY_TIME_PER_FRAME_AND_COUNT_ONLY );
	fclose( g_IHVTestFP );
	SpewOutputFunc( IHVTestSpewFunc );
#endif
#if USE_VTUNE
	VTPause();
#endif

    return 0;
}
	/** Pauses profiling. */
	virtual void ProfilerPauseFunction() override
	{
		VTPause();
	}