コード例 #1
0
void R_IssueRenderCommands( qboolean runPerformanceCounters )
{
	renderCommandList_t *cmdList;

	cmdList = &backEndData[ tr.smpFrame ]->commands;
	assert( cmdList );  // bk001205
	// add an end-of-list command
	* ( int * )( cmdList->cmds + cmdList->used ) = RC_END_OF_LIST;

	// clear it out, in case this is a sync and not a buffer flip
	cmdList->used = 0;

	if ( glConfig.smpActive )
	{
		// if the render thread is not idle, wait for it
		if ( renderThreadActive )
		{
			c_blockedOnRender++;

			if ( r_showSmp->integer )
			{
				ri.Printf( PRINT_ALL, "R" );
			}
		}
		else
		{
			c_blockedOnMain++;

			if ( r_showSmp->integer )
			{
				ri.Printf( PRINT_ALL, "." );
			}
		}

		// sleep until the renderer has completed
		GLimp_FrontEndSleep();
	}

	// at this point, the back end thread is idle, so it is ok
	// to look at its performance counters
	if ( runPerformanceCounters )
	{
		R_PerformanceCounters();
	}

	// actually start the commands going
	if ( !r_skipBackEnd->integer )
	{
		// let it start on the new batch
		if ( !glConfig.smpActive )
		{
			RB_ExecuteRenderCommands( cmdList->cmds );
		}
		else
		{
			GLimp_WakeRenderer( cmdList->cmds );
		}
	}
}
コード例 #2
0
ファイル: tr_cmds.cpp プロジェクト: ChunHungLiu/Unvanquished
void R_IssueRenderCommands( bool runPerformanceCounters )
{
	renderCommandList_t *cmdList;

	cmdList = &backEndData[ tr.smpFrame ]->commands;
	ASSERT(cmdList != nullptr);
	// add an end-of-list command
	*reinterpret_cast<renderCommand_t*>(&cmdList->cmds[cmdList->used]) = renderCommand_t::RC_END_OF_LIST;

	// clear it out, in case this is a sync and not a buffer flip
	cmdList->used = 0;

	if ( glConfig.smpActive )
	{
		// if the render thread is not idle, wait for it
		if ( renderThreadActive )
		{
			c_blockedOnRender++;

			if ( r_showSmp->integer )
			{
				Log::Notice("R");
			}
		}
		else
		{
			c_blockedOnMain++;

			if ( r_showSmp->integer )
			{
				Log::Notice(".");
			}
		}

		// sleep until the renderer has completed
		GLimp_FrontEndSleep();
	}

	// at this point, the back end thread is idle, so it is ok
	// to look at its performance counters
	if ( runPerformanceCounters )
	{
		R_PerformanceCounters();
	}

	// actually start the commands going
	if ( !r_skipBackEnd->integer )
	{
		// let it start on the new batch
		if ( !glConfig.smpActive )
		{
			RB_ExecuteRenderCommands( cmdList->cmds );
		}
		else
		{
			GLimp_WakeRenderer( cmdList->cmds );
		}
	}
}
コード例 #3
0
ファイル: tr_cmds.c プロジェクト: entdark/q3mme
/*
====================
R_SyncRenderThread

Issue any pending commands and wait for them to complete.
After exiting, the render thread will have completed its work
and will remain idle and the main thread is free to issue
OpenGL calls until R_IssueRenderCommands is called.
====================
*/
void R_SyncRenderThread( void ) {
	if ( !tr.registered ) {
		return;
	}
	R_IssueRenderCommands( qfalse );

	if ( !glConfig.smpActive ) {
		return;
	}
	GLimp_FrontEndSleep();
}
コード例 #4
0
ファイル: sdl_glimp.c プロジェクト: LBoksha/RTCW-SP-linux
void GLimp_Shutdown( void ) {
	IN_Shutdown();

	if ( glConfig.smpActive && !signalcaught )
	{
		// may already be dead if called from signal handler
		GLimp_WakeRenderer( (void *)0xdead );
		// - and wait for it to return
		GLimp_FrontEndSleep();
	}
	if ( SDLvidscreen )
		SDL_VideoQuit();
	if ( SDL_WasInit(SDL_INIT_VIDEO) )
		SDL_QuitSubSystem(SDL_INIT_VIDEO);

	GLimp_ShutdownRenderThread();
	SDLvidscreen = NULL;
	memset( &glConfig, 0, sizeof( glConfig ) );
	memset( &glState, 0, sizeof( glState ) );
}
コード例 #5
0
ファイル: tr_cmds.c プロジェクト: entdark/q3mme
void R_IssueRenderCommands( qboolean runPerformanceCounters ) {

	R_GetCommandBuffer( RC_END_OF_LIST, 0 );
	// clear it out, in case this is a sync and not a buffer flip
	trScene.backEnd->used = 0;

	if ( glConfig.smpActive ) {
		// if the render thread is not idle, wait for it
		if ( renderThreadActive ) {
			c_blockedOnRender++;
			if ( r_showSmp->integer ) {
				ri.Printf( PRINT_ALL, "R" );
			}
		} else {
			c_blockedOnMain++;
			if ( r_showSmp->integer ) {
				ri.Printf( PRINT_ALL, "." );
			}
		}

		// sleep until the renderer has completed
		GLimp_FrontEndSleep();
	}

	// at this point, the back end thread is idle, so it is ok
	// to look at it's performance counters
	if ( runPerformanceCounters ) {
		R_PerformanceCounters();
	}

	// actually start the commands going
	if ( !r_skipBackEnd->integer ) {
		// let it start on the new batch
		if ( !glConfig.smpActive ) {
			RB_ExecuteRenderCommands( trScene.backEnd->data );
		} else {
			GLimp_WakeRenderer( trScene.backEnd->data );
		}
	}
}
コード例 #6
0
/*
===============
GLimp_SyncRenderThread
===============
*/
void GLimp_SyncRenderThread()
{
	GLimp_FrontEndSleep();

	GLimp_SetCurrentContext( true );
}