Get rid of dead render thread code

The Windows backend had some preparing code for this feature,
but there is no support at all for this in renderer/.
This commit is contained in:
dhewg 2011-12-29 16:33:19 +01:00
parent 475f49dad2
commit 1afe61cc8d
6 changed files with 0 additions and 220 deletions

View file

@ -1103,14 +1103,8 @@ void GLimp_SetGamma( unsigned short red[256],
// of dacs with >8 bits of precision
bool GLimp_SpawnRenderThread( void (*function)( void ) );
// Returns false if the system only has a single processor
void * GLimp_BackEndSleep( void );
void GLimp_FrontEndSleep( void );
void GLimp_WakeBackEnd( void *data );
// these functions implement the dual processor syncronization
void GLimp_ActivateContext( void );
void GLimp_DeactivateContext( void );
// These are used for managing SMP handoffs of the OpenGL context

View file

@ -64,10 +64,6 @@ static bool vidmode_active = false;
static int save_rampsize = 0;
static unsigned short *save_red, *save_green, *save_blue;
void GLimp_WakeBackEnd(void *a) {
common->DPrintf("GLimp_WakeBackEnd stub\n");
}
void GLimp_EnableLogging(bool log) {
static bool logging;
if (log != logging)
@ -77,20 +73,6 @@ void GLimp_EnableLogging(bool log) {
}
}
void GLimp_FrontEndSleep() {
common->DPrintf("GLimp_FrontEndSleep stub\n");
}
void *GLimp_BackEndSleep() {
common->DPrintf("GLimp_BackEndSleep stub\n");
return 0;
}
bool GLimp_SpawnRenderThread(void (*a) ()) {
common->DPrintf("GLimp_SpawnRenderThread stub\n");
return false;
}
void GLimp_ActivateContext() {
assert( dpy );
assert( ctx );

View file

@ -1436,25 +1436,6 @@ bool Sys_Unhide() {
return true;
}
bool GLimp_SpawnRenderThread( void (*function)( void ) ) {
return false;
}
void *GLimp_RendererSleep(void) {
return NULL;
}
void GLimp_FrontEndSleep(void) { }
void GLimp_WakeRenderer( void *data ) { }
void *GLimp_BackEndSleep( void ) {
return NULL;
}
void GLimp_WakeBackEnd( void *data ) {
}
// enable / disable context is just for the r_skipRenderContext debug option
void GLimp_DeactivateContext( void ) {
[NSOpenGLContext clearCurrentContext];

View file

@ -377,12 +377,7 @@ void glVertex4sv(const GLshort *v){};
void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){};
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height){};
void GLimp_WakeBackEnd(void*a) {};
void GLimp_EnableLogging(bool) {};
void GLimp_FrontEndSleep() {};
void GLimp_ActivateContext() {};
void GLimp_DeactivateContext() {};
bool GLimp_SpawnRenderThread(void (*a)()) {return false;};
static void StubFunction( void ) {};
GLExtension_t GLimp_ExtensionPointer( const char *a) { return StubFunction; };
@ -391,4 +386,3 @@ bool GLimp_Init(glimpParms_t a) {return true;};
void GLimp_SetGamma(unsigned short*a, unsigned short*b, unsigned short*c) {};
void GLimp_Shutdown() {};
void GLimp_SwapBuffers() {};
void *GLimp_BackEndSleep() {return 0;};

View file

@ -981,13 +981,6 @@ void GLimp_Shutdown( void ) {
win32.cdsFullscreen = false;
}
// close the thread so the handle doesn't dangle
if ( win32.renderThreadHandle ) {
common->Printf( "...closing smp thread\n" );
CloseHandle( win32.renderThreadHandle );
win32.renderThreadHandle = NULL;
}
// restore gamma
GLimp_RestoreGamma();
@ -1061,163 +1054,6 @@ void GLimp_DeactivateContext( void ) {
}
/*
===================
GLimp_RenderThreadWrapper
===================
*/
static void GLimp_RenderThreadWrapper( void ) {
win32.glimpRenderThread();
// unbind the context before we die
qwglMakeCurrent( win32.hDC, NULL );
}
/*
=======================
GLimp_SpawnRenderThread
Returns false if the system only has a single processor
=======================
*/
bool GLimp_SpawnRenderThread( void (*function)( void ) ) {
SYSTEM_INFO info;
// check number of processors
GetSystemInfo( &info );
if ( info.dwNumberOfProcessors < 2 ) {
return false;
}
// create the IPC elements
win32.renderCommandsEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
win32.renderCompletedEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
win32.renderActiveEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
win32.glimpRenderThread = function;
win32.renderThreadHandle = CreateThread(
NULL, // LPSECURITY_ATTRIBUTES lpsa,
0, // DWORD cbStack,
(LPTHREAD_START_ROUTINE)GLimp_RenderThreadWrapper, // LPTHREAD_START_ROUTINE lpStartAddr,
0, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&win32.renderThreadId );
if ( !win32.renderThreadHandle ) {
common->Error( "GLimp_SpawnRenderThread: failed" );
}
SetThreadPriority( win32.renderThreadHandle, THREAD_PRIORITY_ABOVE_NORMAL );
#if 0
// make sure they always run on different processors
SetThreadAffinityMask( GetCurrentThread, 1 );
SetThreadAffinityMask( win32.renderThreadHandle, 2 );
#endif
return true;
}
//#define DEBUG_PRINTS
/*
===================
GLimp_BackEndSleep
===================
*/
void *GLimp_BackEndSleep( void ) {
void *data;
#ifdef DEBUG_PRINTS
OutputDebugString( "-->GLimp_BackEndSleep\n" );
#endif
ResetEvent( win32.renderActiveEvent );
// after this, the front end can exit GLimp_FrontEndSleep
SetEvent( win32.renderCompletedEvent );
WaitForSingleObject( win32.renderCommandsEvent, INFINITE );
ResetEvent( win32.renderCompletedEvent );
ResetEvent( win32.renderCommandsEvent );
data = win32.smpData;
// after this, the main thread can exit GLimp_WakeRenderer
SetEvent( win32.renderActiveEvent );
#ifdef DEBUG_PRINTS
OutputDebugString( "<--GLimp_BackEndSleep\n" );
#endif
return data;
}
/*
===================
GLimp_FrontEndSleep
===================
*/
void GLimp_FrontEndSleep( void ) {
#ifdef DEBUG_PRINTS
OutputDebugString( "-->GLimp_FrontEndSleep\n" );
#endif
WaitForSingleObject( win32.renderCompletedEvent, INFINITE );
#ifdef DEBUG_PRINTS
OutputDebugString( "<--GLimp_FrontEndSleep\n" );
#endif
}
volatile bool renderThreadActive;
/*
===================
GLimp_WakeBackEnd
===================
*/
void GLimp_WakeBackEnd( void *data ) {
int r;
#ifdef DEBUG_PRINTS
OutputDebugString( "-->GLimp_WakeBackEnd\n" );
#endif
win32.smpData = data;
if ( renderThreadActive ) {
common->FatalError( "GLimp_WakeBackEnd: already active" );
}
r = WaitForSingleObject( win32.renderActiveEvent, 0 );
if ( r == WAIT_OBJECT_0 ) {
common->FatalError( "GLimp_WakeBackEnd: already signaled" );
}
r = WaitForSingleObject( win32.renderCommandsEvent, 0 );
if ( r == WAIT_OBJECT_0 ) {
common->FatalError( "GLimp_WakeBackEnd: commands already signaled" );
}
// after this, the renderer can continue through GLimp_RendererSleep
SetEvent( win32.renderCommandsEvent );
r = WaitForSingleObject( win32.renderActiveEvent, 5000 );
if ( r == WAIT_TIMEOUT ) {
common->FatalError( "GLimp_WakeBackEnd: WAIT_TIMEOUT" );
}
#ifdef DEBUG_PRINTS
OutputDebugString( "<--GLimp_WakeBackEnd\n" );
#endif
}
//===================================================================
/*
===================
GLimp_ExtensionPointer

View file

@ -166,13 +166,6 @@ struct Win32Vars_t {
LPDIRECTINPUTDEVICE8 g_pMouse;
LPDIRECTINPUTDEVICE8 g_pKeyboard;
HANDLE renderCommandsEvent;
HANDLE renderCompletedEvent;
HANDLE renderActiveEvent;
HANDLE renderThreadHandle;
unsigned long renderThreadId;
void (*glimpRenderThread)( void );
void *smpData;
int wglErrors;
// SMP acceleration vars