Merge remote-tracking branch 'DanielGibson/linux'

This commit is contained in:
Robert Beckebans 2012-12-14 12:06:40 +01:00
commit 776b1a2938
7 changed files with 61 additions and 14 deletions

View file

@ -32,7 +32,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_definitions(-DUSE_EXCEPTIONS)
#endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O1 -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0 -ggdb -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
#set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
#set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer -Wunknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch")

View file

@ -870,6 +870,10 @@ void R_InitOpenGL()
common->FatalError( "R_InitOpenGL called while active" );
}
// DG: make sure SDL has setup video so getting supported modes in R_SetNewMode() works
GLimp_PreInit();
// DG end
R_SetNewMode( true );

View file

@ -1052,6 +1052,10 @@ struct glimpParms_t
int multiSamples;
};
// DG: R_GetModeListForDisplay is called before GLimp_Init(), but SDL needs SDL_Init() first.
// So add PreInit for platforms that need it, others can just stub it.
void GLimp_PreInit();
bool GLimp_Init( glimpParms_t parms );
// If the desired mode can't be set satisfactorily, false will be returned.
// If succesful, sets glConfig.nativeScreenWidth, glConfig.nativeScreenHeight, and glConfig.pixelAspect

View file

@ -28,6 +28,17 @@ If you have questions concerning this license or the applicable additional terms
#pragma hdrstop
#include "../idlib/precompiled.h"
#include "PacketProcessor.h"
// DG: workaround for GCC bug
const int idPacketProcessor::RETURN_TYPE_NONE = 0;
const int idPacketProcessor::RETURN_TYPE_OOB = 1;
const int idPacketProcessor::RETURN_TYPE_INBAND = 2;
const int idPacketProcessor::FRAGMENT_START = 0;
const int idPacketProcessor::FRAGMENT_MIDDLE = 1;
const int idPacketProcessor::FRAGMENT_END = 2;
// DG end
idCVar net_maxRate( "net_maxRate", "50", CVAR_INTEGER, "max send rate in kilobytes per second" );

View file

@ -36,10 +36,11 @@ idPacketProcessor
class idPacketProcessor
{
public:
static const int RETURN_TYPE_NONE = 0;
static const int RETURN_TYPE_OOB = 1;
static const int RETURN_TYPE_INBAND = 2;
// DG: workaround for GCC bug (can't link when compiling with -O0): put definitions in PacketProcessor.cpp
static const int RETURN_TYPE_NONE; // = 0;
static const int RETURN_TYPE_OOB; // = 1;
static const int RETURN_TYPE_INBAND; // = 2;
// DG end
typedef uint16 sessionId_t;
static const int NUM_LOBBY_TYPE_BITS = 2;
@ -229,10 +230,13 @@ private:
static const int PACKET_TYPE_RELIABLE_ACK = 2; // Header type used to piggy-back on top of msgs to ack reliable msg's
static const int PACKET_TYPE_FRAGMENTED = 3; // The msg is fragmented, fragment type stored in the userData portion of header
// PACKET_TYPE_FRAGMENTED userData values
static const int FRAGMENT_START = 0;
static const int FRAGMENT_MIDDLE = 1;
static const int FRAGMENT_END = 2;
// DG: workaround for GCC bug (can't link when compiling with -O0): put definitions in PacketProcessor.cpp
static const int FRAGMENT_START; // = 0;
static const int FRAGMENT_MIDDLE; // = 1;
static const int FRAGMENT_END; // = 2;
// DG end
class idOuterPacketHeader
{

View file

@ -53,6 +53,25 @@ static SDL_Surface* window = NULL;
bool QGL_Init( const char* dllname );
void QGL_Shutdown();
/*
===================
GLimp_PreInit
R_GetModeListForDisplay is called before GLimp_Init(), but SDL needs SDL_Init() first.
So do that in GLimp_PreInit()
Calling that function more than once doesn't make a difference
===================
*/
void GLimp_PreInit() // DG: added this function for SDL compatibility
{
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
if( SDL_Init( SDL_INIT_VIDEO ) )
common->Error( "Error while initializing SDL: %s", SDL_GetError() );
}
}
/*
===================
GLimp_Init
@ -62,11 +81,7 @@ bool GLimp_Init( glimpParms_t parms )
{
common->Printf( "Initializing OpenGL subsystem\n" );
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
if( SDL_Init( SDL_INIT_VIDEO ) )
common->Error( "Error while initializing SDL: %s", SDL_GetError() );
}
GLimp_PreInit(); // DG: make sure SDL is initialized
Uint32 flags = SDL_WINDOW_OPENGL;
@ -376,8 +391,13 @@ bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>&
modeList.Clear();
bool verbose = false;
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
if( videoInfo == NULL )
{
// DG: yes, this can actually fail, e.g. if SDL_Init( SDL_INIT_VIDEO ) wasn't called
common->Error( "Can't get Video Info!\n" );
}
SDL_Rect** modes = SDL_ListModes( videoInfo->vfmt, SDL_OPENGL | SDL_FULLSCREEN );

View file

@ -1253,6 +1253,10 @@ static bool GLW_ChangeDislaySettingsIfNeeded( glimpParms_t parms )
return false;
}
void GLimp_PreInit() {
// DG: not needed on this platform, so just do nothing
}
/*
===================
GLimp_Init