Remove the SMP renderer feature
This commit is contained in:
parent
3f489fe5f2
commit
51df89ab13
35 changed files with 160 additions and 839 deletions
|
@ -23,9 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
volatile renderCommandList_t *renderCommandList;
|
||||
|
||||
volatile qboolean renderThreadActive;
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
R_PerformanceCounters
|
||||
|
@ -75,49 +72,15 @@ void R_PerformanceCounters( void ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
R_InitCommandBuffers
|
||||
====================
|
||||
*/
|
||||
void R_InitCommandBuffers( void ) {
|
||||
glConfig.smpActive = qfalse;
|
||||
if ( r_smp->integer ) {
|
||||
ri.Printf( PRINT_ALL, "Trying SMP acceleration...\n" );
|
||||
if ( GLimp_SpawnRenderThread( RB_RenderThread ) ) {
|
||||
ri.Printf( PRINT_ALL, "...succeeded.\n" );
|
||||
glConfig.smpActive = qtrue;
|
||||
} else {
|
||||
ri.Printf( PRINT_ALL, "...failed.\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
R_ShutdownCommandBuffers
|
||||
====================
|
||||
*/
|
||||
void R_ShutdownCommandBuffers( void ) {
|
||||
// kill the rendering thread
|
||||
if ( glConfig.smpActive ) {
|
||||
GLimp_WakeRenderer( NULL );
|
||||
glConfig.smpActive = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
R_IssueRenderCommands
|
||||
====================
|
||||
*/
|
||||
int c_blockedOnRender;
|
||||
int c_blockedOnMain;
|
||||
|
||||
void R_IssueRenderCommands( qboolean runPerformanceCounters ) {
|
||||
renderCommandList_t *cmdList;
|
||||
|
||||
cmdList = &backEndData[tr.smpFrame]->commands;
|
||||
cmdList = &backEndData->commands;
|
||||
assert(cmdList);
|
||||
// add an end-of-list command
|
||||
*(int *)(cmdList->cmds + cmdList->used) = RC_END_OF_LIST;
|
||||
|
@ -125,26 +88,6 @@ void R_IssueRenderCommands( qboolean runPerformanceCounters ) {
|
|||
// 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();
|
||||
}
|
||||
|
@ -152,49 +95,36 @@ void R_IssueRenderCommands( qboolean runPerformanceCounters ) {
|
|||
// 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 );
|
||||
}
|
||||
RB_ExecuteRenderCommands( cmdList->cmds );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
R_SyncRenderThread
|
||||
R_IssuePendingRenderCommands
|
||||
|
||||
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 ) {
|
||||
void R_IssuePendingRenderCommands( void ) {
|
||||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
R_IssueRenderCommands( qfalse );
|
||||
|
||||
if ( !glConfig.smpActive ) {
|
||||
return;
|
||||
}
|
||||
GLimp_FrontEndSleep();
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
R_GetCommandBuffer
|
||||
|
||||
make sure there is enough command space, waiting on the
|
||||
render thread if needed.
|
||||
make sure there is enough command space
|
||||
============
|
||||
*/
|
||||
void *R_GetCommandBuffer( int bytes ) {
|
||||
renderCommandList_t *cmdList;
|
||||
|
||||
cmdList = &backEndData[tr.smpFrame]->commands;
|
||||
cmdList = &backEndData->commands;
|
||||
bytes = PAD(bytes, sizeof(void *));
|
||||
|
||||
// always leave room for the end of list command
|
||||
|
@ -377,7 +307,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
}
|
||||
else
|
||||
{
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
qglEnable( GL_STENCIL_TEST );
|
||||
qglStencilMask( ~0U );
|
||||
qglClearStencil( 0U );
|
||||
|
@ -390,7 +320,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
{
|
||||
// this is only reached if it was on and is now off
|
||||
if ( r_measureOverdraw->modified ) {
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
qglDisable( GL_STENCIL_TEST );
|
||||
}
|
||||
r_measureOverdraw->modified = qfalse;
|
||||
|
@ -400,7 +330,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
// texturemode stuff
|
||||
//
|
||||
if ( r_textureMode->modified ) {
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
GL_TextureMode( r_textureMode->string );
|
||||
r_textureMode->modified = qfalse;
|
||||
}
|
||||
|
@ -411,7 +341,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
if ( r_gamma->modified ) {
|
||||
r_gamma->modified = qfalse;
|
||||
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
R_SetColorMappings();
|
||||
}
|
||||
|
||||
|
@ -420,7 +350,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
{
|
||||
int err;
|
||||
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
if ((err = qglGetError()) != GL_NO_ERROR)
|
||||
ri.Error(ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!", err);
|
||||
}
|
||||
|
@ -534,9 +464,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
|
|||
|
||||
R_IssueRenderCommands( qtrue );
|
||||
|
||||
// use the other buffers next frame, because another CPU
|
||||
// may still be rendering into the current ones
|
||||
R_ToggleSmpFrame();
|
||||
R_InitNextFrame();
|
||||
|
||||
if ( frontEndMsec ) {
|
||||
*frontEndMsec = tr.frontEndMsec;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue