void RB_ExecuteBackEndCommands( const emptyCommand_t *cmds ) { // r_debugRenderToTexture int c_draw3d = 0, c_draw2d = 0, c_setBuffers = 0, c_swapBuffers = 0, c_copyRenders = 0; if ( cmds->commandId == RC_NOP && !cmds->next ) { return; } backEndStartTime = Sys_Milliseconds(); // needed for editor rendering RB_SetDefaultGLState(); // upload any image loads that have completed globalImages->CompleteBackgroundImageLoads(); for ( ; cmds ; cmds = (const emptyCommand_t *)cmds->next ) { switch ( cmds->commandId ) { case RC_NOP: break; case RC_DRAW_VIEW: RB_DrawView( cmds ); if ( ((const drawSurfsCommand_t *)cmds)->viewDef->viewEntitys ) { c_draw3d++; } else { c_draw2d++; } break; case RC_SET_BUFFER: RB_SetBuffer( cmds ); c_setBuffers++; break; case RC_SWAP_BUFFERS: RB_SwapBuffers( cmds ); c_swapBuffers++; break; case RC_COPY_RENDER: RB_CopyRender( cmds ); c_copyRenders++; break; default: common->Error( "RB_ExecuteBackEndCommands: bad commandId" ); break; } } // go back to the default texture so the editor doesn't mess up a bound image qglBindTexture( GL_TEXTURE_2D, 0 ); backEnd.glState.tmu[0].current2DMap = -1; // stop rendering on this thread backEndFinishTime = Sys_Milliseconds(); backEnd.pc.msec = backEndFinishTime - backEndStartTime; if ( r_debugRenderToTexture.GetInteger() == 1 ) { common->Printf( "3d: %i, 2d: %i, SetBuf: %i, SwpBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_swapBuffers, c_copyRenders, backEnd.c_copyFrameBuffer ); backEnd.c_copyFrameBuffer = 0; } }
/* ==================== RB_ExecuteRenderCommands This function will be called synchronously if running without smp extensions, or asynchronously by another thread. ==================== */ void RB_ExecuteRenderCommands( const void *data ) { int t1, t2; GLimp_LogComment( "--- RB_ExecuteRenderCommands ---\n" ); t1 = ri.Milliseconds(); if ( !r_smp->integer || data == backEndData[ 0 ]->commands.cmds ) { backEnd.smpFrame = 0; } else { backEnd.smpFrame = 1; } while ( 1 ) { switch ( * ( const int * ) data ) { case RC_SET_COLOR: data = RB_SetColor( data ); break; case RC_STRETCH_PIC: data = RB_StretchPic( data ); break; case RC_DRAW_VIEW: data = RB_DrawView( data ); break; case RC_DRAW_BUFFER: data = RB_DrawBuffer( data ); break; case RC_SWAP_BUFFERS: data = RB_SwapBuffers( data ); break; case RC_SCREENSHOT: data = RB_TakeScreenshotCmd( data ); break; case RC_VIDEOFRAME: data = RB_TakeVideoFrameCmd( data ); break; case RC_END_OF_LIST: default: // stop rendering on this thread t2 = ri.Milliseconds(); backEnd.pc.msec = t2 - t1; return; } } }