cleanup fsaa patch, from szo. removes sdl version checks because qs requires sdl >= 1.2.10

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@963 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2014-08-11 08:08:15 +00:00
parent 503db92edb
commit 5f7e61ecd4

View file

@ -41,13 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define DEFAULT_SDL_FLAGS SDL_OPENGL
/* multisampling was added to SDL beginning from v1.2.6 */
#define SDL_VER_WITH_MULTISAMPLING (SDL_VERSIONNUM(1,2,6))
#if SDL_COMPILEDVERSION < SDL_VER_WITH_MULTISAMPLING
#define SDL_GL_MULTISAMPLEBUFFERS (SDL_GL_ACCUM_ALPHA_SIZE+2)
#define SDL_GL_MULTISAMPLESAMPLES (SDL_GL_ACCUM_ALPHA_SIZE+3)
#endif /* SDL_VER_WITH_MULTISAMPLING */
typedef struct {
int width;
int height;
@ -126,7 +119,6 @@ static unsigned short vid_sysgamma_blue[256];
#endif
static qboolean gammaworks = false; // whether hw-gamma works
static qboolean sdl_has_multisample = false; // whether linked sdl version supports multisampling
/*
================
@ -301,16 +293,8 @@ static int VID_SetMode (int width, int height, int bpp, int multisample, qboolea
//
// multisampling
//
if (multisample && !sdl_has_multisample)
{
multisample = 0;
Con_SafePrintf ("SDL ver < %d, multisampling disabled\n", SDL_VER_WITH_MULTISAMPLING);
}
if (sdl_has_multisample)
{
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, multisample > 0 ? 1 : 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisample);
}
draw_context = SDL_SetVideoMode(width, height, bpp, flags);
if (!draw_context) { // scale back multisampling
@ -339,11 +323,8 @@ static int VID_SetMode (int width, int height, int bpp, int multisample, qboolea
depthbits = 0;
// read obtained multisample samples
if (sdl_has_multisample)
{
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &multisample) == -1)
multisample = 0;
}
modestate = draw_context->flags & SDL_FULLSCREEN ? MS_FULLSCREEN : MS_WINDOWED;
@ -459,7 +440,6 @@ static void VID_Test (void)
old_height = draw_context->h;
old_bpp = draw_context->format->BitsPerPixel;
old_multisample = 0;
if (sdl_has_multisample)
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &old_multisample);
old_fullscreen = draw_context->flags & SDL_FULLSCREEN ? true : false;
@ -976,8 +956,7 @@ void VID_Init (void)
{
static char vid_center[] = "SDL_VIDEO_CENTERED=center";
const SDL_VideoInfo *info;
const SDL_version *sdl_version;
int width, height, bpp, multisample;
int p, width, height, bpp, multisample;
qboolean fullscreen;
const char *read_vars[] = { "vid_fullscreen",
"vid_width",
@ -1006,11 +985,6 @@ void VID_Init (void)
Cmd_AddCommand ("vid_describecurrentmode", VID_DescribeCurrentMode_f);
Cmd_AddCommand ("vid_describemodes", VID_DescribeModes_f);
// see if the SDL version we linked to is multisampling-capable
sdl_version = SDL_Linked_Version();
if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_VER_WITH_MULTISAMPLING)
sdl_has_multisample = true;
putenv (vid_center); /* SDL_putenv is problematic in versions <= 1.2.9 */
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
@ -1043,8 +1017,6 @@ void VID_Init (void)
}
else
{
int p;
p = COM_CheckParm("-width");
if (p && p < com_argc-1)
{
@ -1073,13 +1045,9 @@ void VID_Init (void)
fullscreen = true;
}
{
int p;
p = COM_CheckParm ("-fsaa");
if (p && p < com_argc-1)
multisample = atoi(com_argv[p+1]);
}
if (!VID_ValidMode(width, height, bpp, fullscreen))
{
@ -1182,7 +1150,7 @@ void VID_SyncCvars (void)
if (SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &swap_control) == 0)
Cvar_SetQuick (&vid_vsync, (swap_control > 0)? "1" : "0");
if (sdl_has_multisample && SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &multisample) == 0)
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &multisample) == 0)
Cvar_SetValueQuick (&vid_multisample, multisample);
}