Remove the SMP renderer feature
This commit is contained in:
parent
3f489fe5f2
commit
51df89ab13
35 changed files with 160 additions and 839 deletions
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
#include "tr_local.h"
|
||||
|
||||
backEndData_t *backEndData[SMP_FRAMES];
|
||||
backEndData_t *backEndData;
|
||||
backEndState_t backEnd;
|
||||
|
||||
|
||||
|
@ -682,7 +682,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
/*
|
||||
============================================================================
|
||||
|
||||
RENDER BACK END THREAD FUNCTIONS
|
||||
RENDER BACK END FUNCTIONS
|
||||
|
||||
============================================================================
|
||||
*/
|
||||
|
@ -734,7 +734,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
// we definately want to sync every frame for the cinematics
|
||||
qglFinish();
|
||||
|
@ -1111,9 +1111,6 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
/*
|
||||
====================
|
||||
RB_ExecuteRenderCommands
|
||||
|
||||
This function will be called synchronously if running without
|
||||
smp extensions, or asynchronously by another thread.
|
||||
====================
|
||||
*/
|
||||
void RB_ExecuteRenderCommands( const void *data ) {
|
||||
|
@ -1121,12 +1118,6 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
|
||||
t1 = ri.Milliseconds ();
|
||||
|
||||
if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
|
||||
backEnd.smpFrame = 0;
|
||||
} else {
|
||||
backEnd.smpFrame = 1;
|
||||
}
|
||||
|
||||
while ( 1 ) {
|
||||
data = PADP(data, sizeof(void *));
|
||||
|
||||
|
@ -1160,7 +1151,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
break;
|
||||
case RC_END_OF_LIST:
|
||||
default:
|
||||
// stop rendering on this thread
|
||||
// stop rendering
|
||||
t2 = ri.Milliseconds ();
|
||||
backEnd.pc.msec = t2 - t1;
|
||||
return;
|
||||
|
@ -1168,30 +1159,3 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
RB_RenderThread
|
||||
================
|
||||
*/
|
||||
void RB_RenderThread( void ) {
|
||||
const void *data;
|
||||
|
||||
// wait for either a rendering command or a quit command
|
||||
while ( 1 ) {
|
||||
// sleep until we have work to do
|
||||
data = GLimp_RendererSleep();
|
||||
|
||||
if ( !data ) {
|
||||
return; // all done, renderer is shutting down
|
||||
}
|
||||
|
||||
renderThreadActive = qtrue;
|
||||
|
||||
RB_ExecuteRenderCommands( data );
|
||||
|
||||
renderThreadActive = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ static void R_LoadLightmaps( lump_t *l ) {
|
|||
buf = fileBase + l->fileofs;
|
||||
|
||||
// we are about to upload textures
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
// create all the lightmaps
|
||||
tr.numLightmaps = len / (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -356,8 +356,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
|
|||
pointSize = 12;
|
||||
}
|
||||
|
||||
// make sure the render thread is stopped
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
if (registeredFontCount >= MAX_FONTS) {
|
||||
ri.Printf(PRINT_WARNING, "RE_RegisterFont: Too many fonts registered already.\n");
|
||||
|
|
|
@ -1495,8 +1495,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
|||
Q_strncpyz( skin->name, name, sizeof( skin->name ) );
|
||||
skin->numSurfaces = 0;
|
||||
|
||||
// make sure the render thread is stopped
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
// If not a .skin file, load as a single shader
|
||||
if ( strcmp( name + strlen( name ) - 5, ".skin" ) ) {
|
||||
|
|
|
@ -55,8 +55,6 @@ cvar_t *r_znear;
|
|||
cvar_t *r_zproj;
|
||||
cvar_t *r_stereoSeparation;
|
||||
|
||||
cvar_t *r_smp;
|
||||
cvar_t *r_showSmp;
|
||||
cvar_t *r_skipBackEnd;
|
||||
|
||||
cvar_t *r_stereoEnabled;
|
||||
|
@ -211,9 +209,6 @@ static void InitOpenGL( void )
|
|||
}
|
||||
}
|
||||
|
||||
// init command buffers and SMP
|
||||
R_InitCommandBuffers();
|
||||
|
||||
// set default state
|
||||
GL_SetDefaultState();
|
||||
}
|
||||
|
@ -990,9 +985,6 @@ void GfxInfo_f( void )
|
|||
{
|
||||
ri.Printf( PRINT_ALL, "HACK: riva128 approximations\n" );
|
||||
}
|
||||
if ( glConfig.smpActive ) {
|
||||
ri.Printf( PRINT_ALL, "Using dual processor acceleration\n" );
|
||||
}
|
||||
if ( r_finish->integer ) {
|
||||
ri.Printf( PRINT_ALL, "Forcing glFinish\n" );
|
||||
}
|
||||
|
@ -1045,7 +1037,6 @@ void R_Register( void )
|
|||
r_vertexLight = ri.Cvar_Get( "r_vertexLight", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_uiFullScreen = ri.Cvar_Get( "r_uifullscreen", "0", 0);
|
||||
r_subdivisions = ri.Cvar_Get ("r_subdivisions", "4", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_smp = ri.Cvar_Get( "r_smp", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_stereoEnabled = ri.Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ignoreFastPath = ri.Cvar_Get( "r_ignoreFastPath", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
@ -1112,7 +1103,6 @@ void R_Register( void )
|
|||
r_flareFade = ri.Cvar_Get ("r_flareFade", "7", CVAR_CHEAT);
|
||||
r_flareCoeff = ri.Cvar_Get ("r_flareCoeff", FLARE_STDCOEFF, CVAR_CHEAT);
|
||||
|
||||
r_showSmp = ri.Cvar_Get ("r_showSmp", "0", CVAR_CHEAT);
|
||||
r_skipBackEnd = ri.Cvar_Get ("r_skipBackEnd", "0", CVAR_CHEAT);
|
||||
|
||||
r_measureOverdraw = ri.Cvar_Get( "r_measureOverdraw", "0", CVAR_CHEAT );
|
||||
|
@ -1228,19 +1218,11 @@ void R_Init( void ) {
|
|||
if (max_polyverts < MAX_POLYVERTS)
|
||||
max_polyverts = MAX_POLYVERTS;
|
||||
|
||||
ptr = ri.Hunk_Alloc( sizeof( *backEndData[0] ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low);
|
||||
backEndData[0] = (backEndData_t *) ptr;
|
||||
backEndData[0]->polys = (srfPoly_t *) ((char *) ptr + sizeof( *backEndData[0] ));
|
||||
backEndData[0]->polyVerts = (polyVert_t *) ((char *) ptr + sizeof( *backEndData[0] ) + sizeof(srfPoly_t) * max_polys);
|
||||
if ( r_smp->integer ) {
|
||||
ptr = ri.Hunk_Alloc( sizeof( *backEndData[1] ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low);
|
||||
backEndData[1] = (backEndData_t *) ptr;
|
||||
backEndData[1]->polys = (srfPoly_t *) ((char *) ptr + sizeof( *backEndData[1] ));
|
||||
backEndData[1]->polyVerts = (polyVert_t *) ((char *) ptr + sizeof( *backEndData[1] ) + sizeof(srfPoly_t) * max_polys);
|
||||
} else {
|
||||
backEndData[1] = NULL;
|
||||
}
|
||||
R_ToggleSmpFrame();
|
||||
ptr = ri.Hunk_Alloc( sizeof( *backEndData ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low);
|
||||
backEndData = (backEndData_t *) ptr;
|
||||
backEndData->polys = (srfPoly_t *) ((char *) ptr + sizeof( *backEndData ));
|
||||
backEndData->polyVerts = (polyVert_t *) ((char *) ptr + sizeof( *backEndData ) + sizeof(srfPoly_t) * max_polys);
|
||||
R_InitNextFrame();
|
||||
|
||||
InitOpenGL();
|
||||
|
||||
|
@ -1286,8 +1268,7 @@ void RE_Shutdown( qboolean destroyWindow ) {
|
|||
|
||||
|
||||
if ( tr.registered ) {
|
||||
R_SyncRenderThread();
|
||||
R_ShutdownCommandBuffers();
|
||||
R_IssuePendingRenderCommands();
|
||||
R_DeleteTextures();
|
||||
}
|
||||
|
||||
|
@ -1310,7 +1291,7 @@ Touch all images to make sure they are resident
|
|||
=============
|
||||
*/
|
||||
void RE_EndRegistration( void ) {
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
if (!ri.Sys_LowPhysicalMemory()) {
|
||||
RB_ShowImages();
|
||||
}
|
||||
|
|
|
@ -95,11 +95,11 @@ void R_DlightBmodel( bmodel_t *bmodel ) {
|
|||
surf = bmodel->firstSurface + i;
|
||||
|
||||
if ( *surf->data == SF_FACE ) {
|
||||
((srfSurfaceFace_t *)surf->data)->dlightBits[ tr.smpFrame ] = mask;
|
||||
((srfSurfaceFace_t *)surf->data)->dlightBits = mask;
|
||||
} else if ( *surf->data == SF_GRID ) {
|
||||
((srfGridMesh_t *)surf->data)->dlightBits[ tr.smpFrame ] = mask;
|
||||
((srfGridMesh_t *)surf->data)->dlightBits = mask;
|
||||
} else if ( *surf->data == SF_TRIANGLES ) {
|
||||
((srfTriangles_t *)surf->data)->dlightBits[ tr.smpFrame ] = mask;
|
||||
((srfTriangles_t *)surf->data)->dlightBits = mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,11 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define GL_INDEX_TYPE GL_UNSIGNED_INT
|
||||
typedef unsigned int glIndex_t;
|
||||
|
||||
// everything that is needed by the backend needs
|
||||
// to be double buffered to allow it to run in
|
||||
// parallel on a dual cpu machine
|
||||
#define SMP_FRAMES 2
|
||||
|
||||
// 14 bits
|
||||
// can't be increased without changing bit packing for drawsurfs
|
||||
// see QSORT_SHADERNUM_SHIFT
|
||||
|
@ -573,7 +568,7 @@ typedef struct srfGridMesh_s {
|
|||
surfaceType_t surfaceType;
|
||||
|
||||
// dynamic lighting information
|
||||
int dlightBits[SMP_FRAMES];
|
||||
int dlightBits;
|
||||
|
||||
// culling information
|
||||
vec3_t meshBounds[2];
|
||||
|
@ -603,7 +598,7 @@ typedef struct {
|
|||
cplane_t plane;
|
||||
|
||||
// dynamic lighting information
|
||||
int dlightBits[SMP_FRAMES];
|
||||
int dlightBits;
|
||||
|
||||
// triangle definitions (no normals at points)
|
||||
int numPoints;
|
||||
|
@ -619,7 +614,7 @@ typedef struct {
|
|||
surfaceType_t surfaceType;
|
||||
|
||||
// dynamic lighting information
|
||||
int dlightBits[SMP_FRAMES];
|
||||
int dlightBits;
|
||||
|
||||
// culling information (FIXME: use this!)
|
||||
vec3_t bounds[2];
|
||||
|
@ -891,7 +886,6 @@ typedef struct {
|
|||
// all state modified by the back end is seperated
|
||||
// from the front end state
|
||||
typedef struct {
|
||||
int smpFrame;
|
||||
trRefdef_t refdef;
|
||||
viewParms_t viewParms;
|
||||
orientationr_t or;
|
||||
|
@ -923,8 +917,6 @@ typedef struct {
|
|||
int viewCount; // incremented every view (twice a scene if portaled)
|
||||
// and every R_MarkFragments call
|
||||
|
||||
int smpFrame; // toggles from 0 to 1 every endFrame
|
||||
|
||||
int frameSceneNum; // zeroed at RE_BeginFrame
|
||||
|
||||
qboolean worldMapLoaded;
|
||||
|
@ -1122,8 +1114,6 @@ extern cvar_t *r_portalOnly;
|
|||
|
||||
extern cvar_t *r_subdivisions;
|
||||
extern cvar_t *r_lodCurveError;
|
||||
extern cvar_t *r_smp;
|
||||
extern cvar_t *r_showSmp;
|
||||
extern cvar_t *r_skipBackEnd;
|
||||
|
||||
extern cvar_t *r_stereoEnabled;
|
||||
|
@ -1300,11 +1290,6 @@ void GLimp_Init( void );
|
|||
void GLimp_Shutdown( void );
|
||||
void GLimp_EndFrame( void );
|
||||
|
||||
qboolean GLimp_SpawnRenderThread( void (*function)( void ) );
|
||||
void *GLimp_RendererSleep( void );
|
||||
void GLimp_FrontEndSleep( void );
|
||||
void GLimp_WakeRenderer( void *data );
|
||||
|
||||
void GLimp_LogComment( char *comment );
|
||||
void GLimp_Minimize(void);
|
||||
|
||||
|
@ -1480,7 +1465,7 @@ SCENE GENERATION
|
|||
============================================================
|
||||
*/
|
||||
|
||||
void R_ToggleSmpFrame( void );
|
||||
void R_InitNextFrame( void );
|
||||
|
||||
void RE_ClearScene( void );
|
||||
void RE_AddRefEntityToScene( const refEntity_t *ent );
|
||||
|
@ -1584,7 +1569,6 @@ RENDERER BACK END FUNCTIONS
|
|||
=============================================================
|
||||
*/
|
||||
|
||||
void RB_RenderThread( void );
|
||||
void RB_ExecuteRenderCommands( const void *data );
|
||||
|
||||
/*
|
||||
|
@ -1698,9 +1682,7 @@ typedef enum {
|
|||
#define MAX_POLYVERTS 3000
|
||||
|
||||
// all of the information needed by the back end must be
|
||||
// contained in a backEndData_t. This entire structure is
|
||||
// duplicated so the front and back end can run in parallel
|
||||
// on an SMP machine
|
||||
// contained in a backEndData_t
|
||||
typedef struct {
|
||||
drawSurf_t drawSurfs[MAX_DRAWSURFS];
|
||||
dlight_t dlights[MAX_DLIGHTS];
|
||||
|
@ -1713,20 +1695,15 @@ typedef struct {
|
|||
extern int max_polys;
|
||||
extern int max_polyverts;
|
||||
|
||||
extern backEndData_t *backEndData[SMP_FRAMES]; // the second one may not be allocated
|
||||
extern backEndData_t *backEndData; // the second one may not be allocated
|
||||
|
||||
extern volatile renderCommandList_t *renderCommandList;
|
||||
|
||||
extern volatile qboolean renderThreadActive;
|
||||
|
||||
|
||||
void *R_GetCommandBuffer( int bytes );
|
||||
void RB_ExecuteRenderCommands( const void *data );
|
||||
|
||||
void R_InitCommandBuffers( void );
|
||||
void R_ShutdownCommandBuffers( void );
|
||||
|
||||
void R_SyncRenderThread( void );
|
||||
void R_IssuePendingRenderCommands( void );
|
||||
|
||||
void R_AddDrawSurfCmd( drawSurf_t *drawSurfs, int numDrawSurfs );
|
||||
|
||||
|
|
|
@ -862,10 +862,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
|
|||
unsigned int pointOr = 0;
|
||||
unsigned int pointAnd = (unsigned int)~0;
|
||||
|
||||
if ( glConfig.smpActive ) { // FIXME! we can't do RB_BeginSurface/RB_EndSurface stuff with smp!
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
R_RotateForViewer();
|
||||
|
||||
R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum, &dlighted );
|
||||
|
@ -1352,8 +1348,7 @@ void R_DebugGraphics( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// the render thread can't make callbacks to the main thread
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
GL_Bind( tr.whiteImage);
|
||||
GL_Cull( CT_FRONT_SIDED );
|
||||
|
|
|
@ -306,8 +306,7 @@ qhandle_t RE_RegisterModel( const char *name ) {
|
|||
Q_strncpyz( mod->name, name, sizeof( mod->name ) );
|
||||
|
||||
|
||||
// make sure the render thread is stopped
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
mod->type = MOD_BAD;
|
||||
mod->numLods = 0;
|
||||
|
@ -1045,7 +1044,7 @@ void RE_BeginRegistration( glconfig_t *glconfigOut ) {
|
|||
|
||||
*glconfigOut = glConfig;
|
||||
|
||||
R_SyncRenderThread();
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
tr.viewCluster = -1; // force markleafs to regenerate
|
||||
R_ClearFlares();
|
||||
|
|
|
@ -38,20 +38,12 @@ int r_numpolyverts;
|
|||
|
||||
/*
|
||||
====================
|
||||
R_ToggleSmpFrame
|
||||
R_InitNextFrame
|
||||
|
||||
====================
|
||||
*/
|
||||
void R_ToggleSmpFrame( void ) {
|
||||
if ( r_smp->integer ) {
|
||||
// use the other buffers next frame, because another CPU
|
||||
// may still be rendering into the current ones
|
||||
tr.smpFrame ^= 1;
|
||||
} else {
|
||||
tr.smpFrame = 0;
|
||||
}
|
||||
|
||||
backEndData[tr.smpFrame]->commands.used = 0;
|
||||
void R_InitNextFrame( void ) {
|
||||
backEndData->commands.used = 0;
|
||||
|
||||
r_firstSceneDrawSurf = 0;
|
||||
|
||||
|
@ -143,11 +135,11 @@ void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts
|
|||
return;
|
||||
}
|
||||
|
||||
poly = &backEndData[tr.smpFrame]->polys[r_numpolys];
|
||||
poly = &backEndData->polys[r_numpolys];
|
||||
poly->surfaceType = SF_POLY;
|
||||
poly->hShader = hShader;
|
||||
poly->numVerts = numVerts;
|
||||
poly->verts = &backEndData[tr.smpFrame]->polyVerts[r_numpolyverts];
|
||||
poly->verts = &backEndData->polyVerts[r_numpolyverts];
|
||||
|
||||
Com_Memcpy( poly->verts, &verts[numVerts*j], numVerts * sizeof( *verts ) );
|
||||
|
||||
|
@ -224,8 +216,8 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
|
|||
ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType );
|
||||
}
|
||||
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].e = *ent;
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].lightingCalculated = qfalse;
|
||||
backEndData->entities[r_numentities].e = *ent;
|
||||
backEndData->entities[r_numentities].lightingCalculated = qfalse;
|
||||
|
||||
r_numentities++;
|
||||
}
|
||||
|
@ -253,7 +245,7 @@ void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, floa
|
|||
if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
|
||||
return;
|
||||
}
|
||||
dl = &backEndData[tr.smpFrame]->dlights[r_numdlights++];
|
||||
dl = &backEndData->dlights[r_numdlights++];
|
||||
VectorCopy (org, dl->origin);
|
||||
dl->radius = intensity;
|
||||
dl->color[0] = r;
|
||||
|
@ -355,16 +347,16 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
tr.refdef.floatTime = tr.refdef.time * 0.001f;
|
||||
|
||||
tr.refdef.numDrawSurfs = r_firstSceneDrawSurf;
|
||||
tr.refdef.drawSurfs = backEndData[tr.smpFrame]->drawSurfs;
|
||||
tr.refdef.drawSurfs = backEndData->drawSurfs;
|
||||
|
||||
tr.refdef.num_entities = r_numentities - r_firstSceneEntity;
|
||||
tr.refdef.entities = &backEndData[tr.smpFrame]->entities[r_firstSceneEntity];
|
||||
tr.refdef.entities = &backEndData->entities[r_firstSceneEntity];
|
||||
|
||||
tr.refdef.num_dlights = r_numdlights - r_firstSceneDlight;
|
||||
tr.refdef.dlights = &backEndData[tr.smpFrame]->dlights[r_firstSceneDlight];
|
||||
tr.refdef.dlights = &backEndData->dlights[r_firstSceneDlight];
|
||||
|
||||
tr.refdef.numPolys = r_numpolys - r_firstScenePoly;
|
||||
tr.refdef.polys = &backEndData[tr.smpFrame]->polys[r_firstScenePoly];
|
||||
tr.refdef.polys = &backEndData->polys[r_firstScenePoly];
|
||||
|
||||
// turn off dynamic lighting globally by clearing all the
|
||||
// dlights if it needs to be disabled or if vertex lighting is enabled
|
||||
|
|
|
@ -1872,7 +1872,7 @@ sortedIndex.
|
|||
==============
|
||||
*/
|
||||
static void FixRenderCommandList( int newShader ) {
|
||||
renderCommandList_t *cmdList = &backEndData[tr.smpFrame]->commands;
|
||||
renderCommandList_t *cmdList = &backEndData->commands;
|
||||
|
||||
if( cmdList ) {
|
||||
const void *curCmd = cmdList->cmds;
|
||||
|
@ -2473,12 +2473,6 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
|
|||
}
|
||||
}
|
||||
|
||||
// make sure the render thread is stopped, because we are probably
|
||||
// going to have to upload an image
|
||||
if (r_smp->integer) {
|
||||
R_SyncRenderThread();
|
||||
}
|
||||
|
||||
// clear the global shader
|
||||
Com_Memset( &shader, 0, sizeof( shader ) );
|
||||
Com_Memset( &stages, 0, sizeof( stages ) );
|
||||
|
@ -2609,12 +2603,6 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
|
|||
}
|
||||
}
|
||||
|
||||
// make sure the render thread is stopped, because we are probably
|
||||
// going to have to upload an image
|
||||
if (r_smp->integer) {
|
||||
R_SyncRenderThread();
|
||||
}
|
||||
|
||||
// clear the global shader
|
||||
Com_Memset( &shader, 0, sizeof( shader ) );
|
||||
Com_Memset( &stages, 0, sizeof( stages ) );
|
||||
|
|
|
@ -231,7 +231,7 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
|
|||
int dlightBits;
|
||||
qboolean needsNormal;
|
||||
|
||||
dlightBits = srf->dlightBits[backEnd.smpFrame];
|
||||
dlightBits = srf->dlightBits;
|
||||
tess.dlightBits |= dlightBits;
|
||||
|
||||
RB_CHECKOVERFLOW( srf->numVerts, srf->numIndexes );
|
||||
|
@ -915,7 +915,7 @@ static void RB_SurfaceFace( srfSurfaceFace_t *surf ) {
|
|||
|
||||
RB_CHECKOVERFLOW( surf->numPoints, surf->numIndices );
|
||||
|
||||
dlightBits = surf->dlightBits[backEnd.smpFrame];
|
||||
dlightBits = surf->dlightBits;
|
||||
tess.dlightBits |= dlightBits;
|
||||
|
||||
indices = ( unsigned * ) ( ( ( char * ) surf ) + surf->ofsIndices );
|
||||
|
@ -1007,7 +1007,7 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
|
|||
int *vDlightBits;
|
||||
qboolean needsNormal;
|
||||
|
||||
dlightBits = cv->dlightBits[backEnd.smpFrame];
|
||||
dlightBits = cv->dlightBits;
|
||||
tess.dlightBits |= dlightBits;
|
||||
|
||||
// determine the allowable discrepance
|
||||
|
|
|
@ -212,7 +212,7 @@ typedef struct {
|
|||
// used CDS.
|
||||
qboolean isFullscreen;
|
||||
qboolean stereoEnabled;
|
||||
qboolean smpActive; // dual processor
|
||||
qboolean smpActive; // UNUSED, present for compatibility
|
||||
} glconfig_t;
|
||||
|
||||
#endif // __TR_TYPES_H
|
||||
|
|
|
@ -180,7 +180,7 @@ static int R_DlightFace( srfSurfaceFace_t *face, int dlightBits ) {
|
|||
tr.pc.c_dlightSurfacesCulled++;
|
||||
}
|
||||
|
||||
face->dlightBits[ tr.smpFrame ] = dlightBits;
|
||||
face->dlightBits = dlightBits;
|
||||
return dlightBits;
|
||||
}
|
||||
|
||||
|
@ -208,14 +208,14 @@ static int R_DlightGrid( srfGridMesh_t *grid, int dlightBits ) {
|
|||
tr.pc.c_dlightSurfacesCulled++;
|
||||
}
|
||||
|
||||
grid->dlightBits[ tr.smpFrame ] = dlightBits;
|
||||
grid->dlightBits = dlightBits;
|
||||
return dlightBits;
|
||||
}
|
||||
|
||||
|
||||
static int R_DlightTrisurf( srfTriangles_t *surf, int dlightBits ) {
|
||||
// FIXME: more dlight culling to trisurfs...
|
||||
surf->dlightBits[ tr.smpFrame ] = dlightBits;
|
||||
surf->dlightBits = dlightBits;
|
||||
return dlightBits;
|
||||
#if 0
|
||||
int i;
|
||||
|
@ -241,7 +241,7 @@ static int R_DlightTrisurf( srfTriangles_t *surf, int dlightBits ) {
|
|||
tr.pc.c_dlightSurfacesCulled++;
|
||||
}
|
||||
|
||||
grid->dlightBits[ tr.smpFrame ] = dlightBits;
|
||||
grid->dlightBits = dlightBits;
|
||||
return dlightBits;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue