mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
revert r962 and r963 (first attempt at multisampling)
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@965 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
e6c61b562b
commit
34bc355f9e
1 changed files with 12 additions and 92 deletions
|
@ -95,7 +95,6 @@ static cvar_t vid_width = {"vid_width", "800", CVAR_ARCHIVE}; // QuakeSpasm, wa
|
|||
static cvar_t vid_height = {"vid_height", "600", CVAR_ARCHIVE}; // QuakeSpasm, was 480
|
||||
static cvar_t vid_bpp = {"vid_bpp", "16", CVAR_ARCHIVE};
|
||||
static cvar_t vid_vsync = {"vid_vsync", "0", CVAR_ARCHIVE};
|
||||
static cvar_t vid_multisample = {"vid_multisample", "0", CVAR_ARCHIVE}; // QuakeSpasm
|
||||
//johnfitz
|
||||
|
||||
cvar_t vid_gamma = {"gamma", "1", CVAR_ARCHIVE}; //johnfitz -- moved here from view.c
|
||||
|
@ -256,7 +255,7 @@ static qboolean VID_ValidMode (int width, int height, int bpp, qboolean fullscre
|
|||
VID_SetMode
|
||||
================
|
||||
*/
|
||||
static int VID_SetMode (int width, int height, int bpp, int multisample, qboolean fullscreen)
|
||||
static int VID_SetMode (int width, int height, int bpp, qboolean fullscreen)
|
||||
{
|
||||
int temp;
|
||||
Uint32 flags = DEFAULT_SDL_FLAGS;
|
||||
|
@ -290,18 +289,7 @@ static int VID_SetMode (int width, int height, int bpp, int multisample, qboolea
|
|||
else depthbits = 24;
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthbits);
|
||||
|
||||
//
|
||||
// multisampling
|
||||
//
|
||||
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
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
draw_context = SDL_SetVideoMode(width, height, bpp, flags);
|
||||
}
|
||||
if (!draw_context) { // scale back SDL_GL_DEPTH_SIZE
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
draw_context = SDL_SetVideoMode(width, height, bpp, flags);
|
||||
|
@ -322,10 +310,6 @@ static int VID_SetMode (int width, int height, int bpp, int multisample, qboolea
|
|||
if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depthbits) == -1)
|
||||
depthbits = 0;
|
||||
|
||||
// read obtained multisample samples
|
||||
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &multisample) == -1)
|
||||
multisample = 0;
|
||||
|
||||
modestate = draw_context->flags & SDL_FULLSCREEN ? MS_FULLSCREEN : MS_WINDOWED;
|
||||
|
||||
CDAudio_Resume ();
|
||||
|
@ -335,12 +319,11 @@ static int VID_SetMode (int width, int height, int bpp, int multisample, qboolea
|
|||
// fix the leftover Alt from any Alt-Tab or the like that switched us away
|
||||
ClearAllStates ();
|
||||
|
||||
Con_SafePrintf ("Video mode %dx%dx%d (%d-bit z-buffer, %dx multisampling) initialized\n",
|
||||
Con_SafePrintf ("Video mode %dx%dx%d (%d-bit z-buffer) initialized\n",
|
||||
draw_context->w,
|
||||
draw_context->h,
|
||||
draw_context->format->BitsPerPixel,
|
||||
depthbits,
|
||||
multisample);
|
||||
depthbits);
|
||||
|
||||
vid.recalc_refdef = 1;
|
||||
|
||||
|
@ -367,7 +350,7 @@ VID_Restart -- johnfitz -- change video modes on the fly
|
|||
*/
|
||||
static void VID_Restart (void)
|
||||
{
|
||||
int width, height, bpp, multisample;
|
||||
int width, height, bpp;
|
||||
qboolean fullscreen;
|
||||
|
||||
if (vid_locked || !vid_changed)
|
||||
|
@ -377,7 +360,6 @@ static void VID_Restart (void)
|
|||
height = (int)vid_height.value;
|
||||
bpp = (int)vid_bpp.value;
|
||||
fullscreen = vid_fullscreen.value ? true : false;
|
||||
multisample = (int)vid_multisample.value;
|
||||
|
||||
//
|
||||
// validate new mode
|
||||
|
@ -392,7 +374,7 @@ static void VID_Restart (void)
|
|||
//
|
||||
// set new mode
|
||||
//
|
||||
VID_SetMode (width, height, bpp, multisample, fullscreen);
|
||||
VID_SetMode (width, height, bpp, fullscreen);
|
||||
|
||||
GL_Init ();
|
||||
TexMgr_ReloadImages ();
|
||||
|
@ -429,7 +411,7 @@ VID_Test -- johnfitz -- like vid_restart, but asks for confirmation after switch
|
|||
*/
|
||||
static void VID_Test (void)
|
||||
{
|
||||
int old_width, old_height, old_bpp, old_multisample, old_fullscreen;
|
||||
int old_width, old_height, old_bpp, old_fullscreen;
|
||||
|
||||
if (vid_locked || !vid_changed)
|
||||
return;
|
||||
|
@ -439,8 +421,6 @@ static void VID_Test (void)
|
|||
old_width = draw_context->w;
|
||||
old_height = draw_context->h;
|
||||
old_bpp = draw_context->format->BitsPerPixel;
|
||||
old_multisample = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &old_multisample);
|
||||
old_fullscreen = draw_context->flags & SDL_FULLSCREEN ? true : false;
|
||||
|
||||
VID_Restart ();
|
||||
|
@ -452,7 +432,6 @@ static void VID_Test (void)
|
|||
Cvar_SetValueQuick (&vid_width, old_width);
|
||||
Cvar_SetValueQuick (&vid_height, old_height);
|
||||
Cvar_SetValueQuick (&vid_bpp, old_bpp);
|
||||
Cvar_SetValueQuick (&vid_multisample, old_multisample);
|
||||
Cvar_SetQuick (&vid_fullscreen, old_fullscreen ? "1" : "0");
|
||||
VID_Restart ();
|
||||
}
|
||||
|
@ -956,14 +935,13 @@ void VID_Init (void)
|
|||
{
|
||||
static char vid_center[] = "SDL_VIDEO_CENTERED=center";
|
||||
const SDL_VideoInfo *info;
|
||||
int p, width, height, bpp, multisample;
|
||||
int width, height, bpp;
|
||||
qboolean fullscreen;
|
||||
const char *read_vars[] = { "vid_fullscreen",
|
||||
"vid_width",
|
||||
"vid_height",
|
||||
"vid_bpp",
|
||||
"vid_vsync",
|
||||
"vid_multisample" };
|
||||
"vid_vsync" };
|
||||
#define num_readvars ( sizeof(read_vars)/sizeof(read_vars[0]) )
|
||||
|
||||
Cvar_RegisterVariable (&vid_fullscreen); //johnfitz
|
||||
|
@ -971,13 +949,11 @@ void VID_Init (void)
|
|||
Cvar_RegisterVariable (&vid_height); //johnfitz
|
||||
Cvar_RegisterVariable (&vid_bpp); //johnfitz
|
||||
Cvar_RegisterVariable (&vid_vsync); //johnfitz
|
||||
Cvar_RegisterVariable (&vid_multisample); //QuakeSpasm
|
||||
Cvar_SetCallback (&vid_fullscreen, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_width, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_height, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_bpp, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_vsync, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_multisample, VID_Changed_f);
|
||||
|
||||
Cmd_AddCommand ("vid_unlock", VID_Unlock); //johnfitz
|
||||
Cmd_AddCommand ("vid_restart", VID_Restart); //johnfitz
|
||||
|
@ -1006,7 +982,6 @@ void VID_Init (void)
|
|||
height = (int)vid_height.value;
|
||||
bpp = (int)vid_bpp.value;
|
||||
fullscreen = (int)vid_fullscreen.value;
|
||||
multisample = (int)vid_multisample.value;
|
||||
|
||||
if (COM_CheckParm("-current"))
|
||||
{
|
||||
|
@ -1017,6 +992,8 @@ void VID_Init (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
int p;
|
||||
|
||||
p = COM_CheckParm("-width");
|
||||
if (p && p < com_argc-1)
|
||||
{
|
||||
|
@ -1045,10 +1022,6 @@ void VID_Init (void)
|
|||
fullscreen = true;
|
||||
}
|
||||
|
||||
p = COM_CheckParm ("-fsaa");
|
||||
if (p && p < com_argc-1)
|
||||
multisample = atoi(com_argv[p+1]);
|
||||
|
||||
if (!VID_ValidMode(width, height, bpp, fullscreen))
|
||||
{
|
||||
width = (int)vid_width.value;
|
||||
|
@ -1075,7 +1048,7 @@ void VID_Init (void)
|
|||
// set window icon
|
||||
PL_SetWindowIcon();
|
||||
|
||||
VID_SetMode (width, height, bpp, multisample, fullscreen);
|
||||
VID_SetMode (width, height, bpp, fullscreen);
|
||||
|
||||
GL_Init ();
|
||||
GL_SetupState ();
|
||||
|
@ -1138,7 +1111,7 @@ VID_SyncCvars -- johnfitz -- set vid cvars to match current video mode
|
|||
*/
|
||||
void VID_SyncCvars (void)
|
||||
{
|
||||
int swap_control, multisample;
|
||||
int swap_control;
|
||||
|
||||
if (draw_context)
|
||||
{
|
||||
|
@ -1149,9 +1122,6 @@ 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_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &multisample) == 0)
|
||||
Cvar_SetValueQuick (&vid_multisample, multisample);
|
||||
}
|
||||
|
||||
vid_changed = false;
|
||||
|
@ -1168,7 +1138,6 @@ enum {
|
|||
VID_OPT_BPP,
|
||||
VID_OPT_FULLSCREEN,
|
||||
VID_OPT_VSYNC,
|
||||
VID_OPT_MULTISAMPLE,
|
||||
VID_OPT_TEST,
|
||||
VID_OPT_APPLY,
|
||||
VIDEO_OPTIONS_ITEMS
|
||||
|
@ -1347,42 +1316,6 @@ static void VID_Menu_ChooseNextBpp (int dir)
|
|||
}
|
||||
}
|
||||
|
||||
static int vid_menu_multisamples[] = {0, 8, 4, 2};
|
||||
static int vid_menu_nummultisamples = sizeof(vid_menu_multisamples) / sizeof(int);
|
||||
|
||||
/*
|
||||
================
|
||||
VID_Menu_ChooseNextMultisample
|
||||
|
||||
chooses next antialiasing level in order, then updates the vid_samples cvar
|
||||
================
|
||||
*/
|
||||
static void VID_Menu_ChooseNextMultisample (int dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < vid_menu_nummultisamples; i++)
|
||||
{
|
||||
if (vid_menu_multisamples[i] == vid_multisample.value)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == vid_menu_nummultisamples) //can't find it in list
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i += dir;
|
||||
if (i >= vid_menu_nummultisamples)
|
||||
i = 0;
|
||||
else if (i < 0)
|
||||
i = vid_menu_nummultisamples-1;
|
||||
}
|
||||
|
||||
Cvar_SetValueQuick (&vid_multisample, (float)vid_menu_multisamples[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
VID_MenuKey
|
||||
|
@ -1422,9 +1355,6 @@ static void VID_MenuKey (int key)
|
|||
case VID_OPT_BPP:
|
||||
VID_Menu_ChooseNextBpp (1);
|
||||
break;
|
||||
case VID_OPT_MULTISAMPLE:
|
||||
VID_Menu_ChooseNextMultisample (1);
|
||||
break;
|
||||
case VID_OPT_FULLSCREEN:
|
||||
Cbuf_AddText ("toggle vid_fullscreen\n");
|
||||
break;
|
||||
|
@ -1446,9 +1376,6 @@ static void VID_MenuKey (int key)
|
|||
case VID_OPT_BPP:
|
||||
VID_Menu_ChooseNextBpp (-1);
|
||||
break;
|
||||
case VID_OPT_MULTISAMPLE:
|
||||
VID_Menu_ChooseNextMultisample (-1);
|
||||
break;
|
||||
case VID_OPT_FULLSCREEN:
|
||||
Cbuf_AddText ("toggle vid_fullscreen\n");
|
||||
break;
|
||||
|
@ -1470,9 +1397,6 @@ static void VID_MenuKey (int key)
|
|||
case VID_OPT_BPP:
|
||||
VID_Menu_ChooseNextBpp (1);
|
||||
break;
|
||||
case VID_OPT_MULTISAMPLE:
|
||||
VID_Menu_ChooseNextMultisample (1);
|
||||
break;
|
||||
case VID_OPT_FULLSCREEN:
|
||||
Cbuf_AddText ("toggle vid_fullscreen\n");
|
||||
break;
|
||||
|
@ -1540,10 +1464,6 @@ static void VID_MenuDraw (void)
|
|||
M_Print (16, y, " Color depth");
|
||||
M_Print (184, y, va("%i", (int)vid_bpp.value));
|
||||
break;
|
||||
case VID_OPT_MULTISAMPLE:
|
||||
M_Print (16, y, " Antialiasing");
|
||||
M_Print (184, y, va("%ix", (int)vid_multisample.value));
|
||||
break;
|
||||
case VID_OPT_FULLSCREEN:
|
||||
M_Print (16, y, " Fullscreen");
|
||||
M_DrawCheckbox (184, y, (int)vid_fullscreen.value);
|
||||
|
|
Loading…
Reference in a new issue