Skip to content

Commit

Permalink
Remove the SMP renderer feature
Browse files Browse the repository at this point in the history
  • Loading branch information
timangus committed Jan 24, 2013
1 parent 3f489fe commit 51df89a
Show file tree
Hide file tree
Showing 35 changed files with 160 additions and 839 deletions.
87 changes: 10 additions & 77 deletions Makefile
Expand Up @@ -32,9 +32,6 @@ endif
ifndef BUILD_CLIENT
BUILD_CLIENT =
endif
ifndef BUILD_CLIENT_SMP
BUILD_CLIENT_SMP =
endif
ifndef BUILD_SERVER
BUILD_SERVER =
endif
Expand All @@ -54,10 +51,6 @@ ifndef BUILD_RENDERER_REND2
BUILD_RENDERER_REND2=
endif

ifneq ($(PLATFORM),darwin)
BUILD_CLIENT_SMP = 0
endif

#############################################################################
#
# If you require a different configuration from the defaults below, create a
Expand Down Expand Up @@ -586,8 +579,6 @@ ifeq ($(PLATFORM),mingw32)
SDLDLL=SDL.dll
endif

BUILD_CLIENT_SMP = 0

else # ifeq mingw32

#############################################################################
Expand Down Expand Up @@ -861,26 +852,14 @@ endif
ifneq ($(BUILD_CLIENT),0)
ifneq ($(USE_RENDERER_DLOPEN),0)
TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME)
ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/renderer_opengl1_smp_$(SHLIBNAME)
endif
ifneq ($(BUILD_RENDERER_REND2), 0)
TARGETS += $(B)/renderer_rend2_$(SHLIBNAME)
ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/renderer_rend2_smp_$(SHLIBNAME)
endif
endif
else
TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT)
ifneq ($(BUILD_RENDERER_REND2), 0)
TARGETS += $(B)/$(CLIENTBIN)_rend2$(FULLBINEXT)
endif
ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/$(CLIENTBIN)-smp$(FULLBINEXT)
ifneq ($(BUILD_RENDERER_REND2), 0)
TARGETS += $(B)/$(CLIENTBIN)_rend2-smp$(FULLBINEXT)
endif
endif
endif
endif

Expand Down Expand Up @@ -1030,11 +1009,6 @@ $(Q)cat $< | sed 's/^/\"/;s/$$/\\n\"/' >> $@
$(Q)echo ";" >> $@
endef

define DO_SMP_CC
$(echo_cmd) "SMP_CC $<"
$(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -DSMP -o $@ -c $<
endef

define DO_BOT_CC
$(echo_cmd) "BOT_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) $(OPTIMIZE) -DBOTLIB -o $@ -c $<
Expand Down Expand Up @@ -1194,7 +1168,6 @@ makedirs:
@if [ ! -d $(B)/renderer ];then $(MKDIR) $(B)/renderer;fi
@if [ ! -d $(B)/rend2 ];then $(MKDIR) $(B)/rend2;fi
@if [ ! -d $(B)/rend2/glsl ];then $(MKDIR) $(B)/rend2/glsl;fi
@if [ ! -d $(B)/renderersmp ];then $(MKDIR) $(B)/renderersmp;fi
@if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi
@if [ ! -d $(B)/$(BASEGAME) ];then $(MKDIR) $(B)/$(BASEGAME);fi
@if [ ! -d $(B)/$(BASEGAME)/cgame ];then $(MKDIR) $(B)/$(BASEGAME)/cgame;fi
Expand Down Expand Up @@ -1599,14 +1572,9 @@ Q3ROBJ = \
$(B)/renderer/tr_surface.o \
$(B)/renderer/tr_world.o \
\
$(B)/renderer/sdl_gamma.o

Q3RPOBJ_UP = \
$(B)/renderer/sdl_gamma.o \
$(B)/renderer/sdl_glimp.o

Q3RPOBJ_SMP = \
$(B)/renderersmp/sdl_glimp.o

ifneq ($(USE_RENDERER_DLOPEN), 0)
Q3ROBJ += \
$(B)/renderer/q_shared.o \
Expand Down Expand Up @@ -1833,50 +1801,27 @@ $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN)
-o $@ $(Q3OBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)

$(B)/renderer_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(Q3RPOBJ_UP) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(Q3RPOBJ_UP) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)

$(B)/renderer_opengl1_smp_$(SHLIBNAME): $(Q3ROBJ) $(Q3RPOBJ_SMP) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(Q3RPOBJ_SMP) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)

$(B)/renderer_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_UP) $(JPGOBJ)
$(B)/renderer_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_UP) $(JPGOBJ) \
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)

$(B)/renderer_rend2_smp_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_SMP) $(JPGOBJ)
$(B)/renderer_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_SMP) $(J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
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_UP) $(JPGOBJ) \
-o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)

$(B)/$(CLIENTBIN)_rend2-smp$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_SMP) $(JPGOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(Q3RPOBJ_SMP) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
endif

ifneq ($(strip $(LIBSDLMAIN)),)
Expand Down Expand Up @@ -2390,9 +2335,6 @@ $(B)/client/%.o: $(ZDIR)/%.c
$(B)/client/%.o: $(SDLDIR)/%.c
$(DO_CC)

$(B)/renderersmp/%.o: $(SDLDIR)/%.c
$(DO_SMP_CC)

$(B)/client/%.o: $(SYSDIR)/%.c
$(DO_CC)

Expand Down Expand Up @@ -2548,7 +2490,7 @@ $(B)/$(MISSIONPACK)/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC)
# MISC
#############################################################################

OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3RPOBJ_UP) $(Q3RPOBJ_SMP) $(Q3DOBJ) $(JPGOBJ) \
OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) \
$(MPGOBJ) $(Q3GOBJ) $(Q3CGOBJ) $(MPCGOBJ) $(Q3UIOBJ) $(MPUIOBJ) \
$(MPGVMOBJ) $(Q3GVMOBJ) $(Q3CGVMOBJ) $(MPCGVMOBJ) $(Q3UIVMOBJ) $(MPUIVMOBJ)
TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ)
Expand Down Expand Up @@ -2576,15 +2518,6 @@ ifneq ($(BUILD_CLIENT),0)
endif
endif

# Don't copy the SMP until it's working together with SDL.
ifneq ($(BUILD_CLIENT_SMP),0)
ifneq ($(USE_RENDERER_DLOPEN),0)
$(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_smp_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_smp_$(SHLIBNAME)
else
$(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)-smp$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)-smp$(FULLBINEXT)
endif
endif

ifneq ($(BUILD_SERVER),0)
@if [ -f $(BR)/$(SERVERBIN)$(FULLBINEXT) ]; then \
$(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(SERVERBIN)$(FULLBINEXT) $(COPYBINDIR)/$(SERVERBIN)$(FULLBINEXT); \
Expand Down
5 changes: 0 additions & 5 deletions code/client/cl_cin.c
Expand Up @@ -1158,7 +1158,6 @@ static void RoQInterrupt(void)
if (cinTable[currentHandle].numQuads == -1) {
readQuadInfo( framedata );
setupQuad( 0, 0 );
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;
}
if (cinTable[currentHandle].numQuads != 1) cinTable[currentHandle].numQuads = 0;
Expand Down Expand Up @@ -1226,7 +1225,6 @@ static void RoQInterrupt(void)

static void RoQ_init( void )
{
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;

cinTable[currentHandle].RoQPlayed = 24;
Expand Down Expand Up @@ -1358,12 +1356,10 @@ e_status CIN_RunCinematic (int handle)
return cinTable[currentHandle].status;
}

// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
thisTime = CL_ScaledMilliseconds()*com_timescale->value;
if (cinTable[currentHandle].shader && (abs(thisTime - cinTable[currentHandle].lastTime))>100) {
cinTable[currentHandle].startTime += thisTime - cinTable[currentHandle].lastTime;
}
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value) - cinTable[currentHandle].startTime)*3)/100);

start = cinTable[currentHandle].startTime;
Expand All @@ -1372,7 +1368,6 @@ e_status CIN_RunCinematic (int handle)
{
RoQInterrupt();
if (start != cinTable[currentHandle].startTime) {
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value)
- cinTable[currentHandle].startTime)*3)/100);
start = cinTable[currentHandle].startTime;
Expand Down
45 changes: 4 additions & 41 deletions code/rend2/tr_backend.c
Expand Up @@ -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;


Expand Down Expand Up @@ -838,7 +838,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
/*
============================================================================
RENDER BACK END THREAD FUNCTIONS
RENDER BACK END FUNCTIONS
============================================================================
*/
Expand Down Expand Up @@ -913,7 +913,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();
Expand Down Expand Up @@ -1811,22 +1811,13 @@ const void *RB_PostProcess(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 ) {
int t1, t2;

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 *));

Expand Down Expand Up @@ -1866,39 +1857,11 @@ 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;
}
}

}


/*
================
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;
}
}


4 changes: 2 additions & 2 deletions code/rend2/tr_bsp.c
Expand Up @@ -218,7 +218,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
buf = fileBase + l->fileofs;

// we are about to upload textures
R_SyncRenderThread();
R_IssuePendingRenderCommands();

tr.lightmapSize = DEFAULT_LIGHTMAP_SIZE;
numLightmaps = len / (tr.lightmapSize * tr.lightmapSize * 3);
Expand Down Expand Up @@ -3185,7 +3185,7 @@ void R_MergeLeafSurfaces(void)
}

// finish up the ibo
R_SyncRenderThread();
R_IssuePendingRenderCommands();

qglGenBuffersARB(1, &ibo->indexesVBO);

Expand Down

0 comments on commit 51df89a

Please sign in to comment.