Skip to content

Commit

Permalink
excluding some code when --enable-smp is not set by #ifdef SMP refs #44
Browse files Browse the repository at this point in the history
  • Loading branch information
IR4T4 committed Aug 10, 2012
1 parent f985e8c commit 0f1edbd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderer/tr_cmds.c
Expand Up @@ -107,7 +107,8 @@ R_InitCommandBuffers
*/
void R_InitCommandBuffers(void)
{
glConfig.smpActive = qfalse;
glConfig.smpActive = qfalse; // do we still have to set this if smp is disabled?
#ifdef SMP
if (r_smp->integer)
{
ri.Printf(PRINT_ALL, "Trying SMP acceleration...\n");
Expand All @@ -121,6 +122,7 @@ void R_InitCommandBuffers(void)
ri.Printf(PRINT_ALL, "...failed.\n");
}
}
#endif
}

/*
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/tr_init.c
Expand Up @@ -1208,8 +1208,11 @@ void R_Register(void)
r_customPixelAspect = ri.Cvar_Get("r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH);
r_simpleMipMaps = ri.Cvar_Get("r_simpleMipMaps", "1", 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);
#ifdef SMP
r_smp = ri.Cvar_Get("r_smp", "0", CVAR_ARCHIVE | CVAR_LATCH);
#endif
r_stereoEnabled = ri.Cvar_Get("r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_ignoreFastPath = ri.Cvar_Get("r_ignoreFastPath", "0", CVAR_ARCHIVE | CVAR_LATCH); // ydnar: use fast path by default
r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH);
Expand Down Expand Up @@ -1423,6 +1426,7 @@ void R_Init(void)

backEndData[0] = ri.Hunk_Alloc(sizeof(*backEndData[0]) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low);

#ifdef SMP
if (r_smp->integer)
{
backEndData[1] = ri.Hunk_Alloc(sizeof(*backEndData[1]) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low);
Expand All @@ -1431,6 +1435,10 @@ void R_Init(void)
{
backEndData[1] = NULL;
}
#else
backEndData[1] = NULL;
#endif

R_ToggleSmpFrame();

InitOpenGL();
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/tr_scene.c
Expand Up @@ -68,6 +68,7 @@ R_ToggleSmpFrame
*/
void R_ToggleSmpFrame(void)
{
#ifdef SMP
if (r_smp->integer)
{
// use the other buffers next frame, because another CPU
Expand All @@ -78,6 +79,9 @@ void R_ToggleSmpFrame(void)
{
tr.smpFrame = 0;
}
#else
tr.smpFrame = 0;
#endif

backEndData[tr.smpFrame]->commands.used = 0;

Expand Down
4 changes: 4 additions & 0 deletions src/renderer/tr_shader.c
Expand Up @@ -3593,12 +3593,14 @@ shader_t *R_FindShader(const char *name, int lightmapIndex, qboolean mipRawImage
}
#endif

#ifdef SMP
// make sure the render thread is stopped, because we are probably
// going to have to upload an image
if (r_smp->integer)
{
R_SyncRenderThread();
}
#endif

// Ridah, check the cache
// assignment used as truth value
Expand Down Expand Up @@ -3723,12 +3725,14 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
}
}

#ifdef SMP
// make sure the render thread is stopped, because we are probably
// going to have to upload an image
if (r_smp->integer)
{
R_SyncRenderThread();
}
#endif

// clear the global shader
Com_Memset(&shader, 0, sizeof(shader));
Expand Down

0 comments on commit 0f1edbd

Please sign in to comment.