saner fsaa mode searching

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1645 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-02-13 05:38:52 +00:00
parent 321a3ff289
commit 644fca4ddc
+10 -10
View File
@@ -59,7 +59,7 @@ VARF(scr_w, 0, 1024, 10000, initwarning());
VARF(scr_h, 0, 768, 10000, initwarning());
VARF(colorbits, 0, 0, 32, initwarning());
VARF(depthbits, 0, 0, 32, initwarning());
VARF(fsaa, 0, 0, 16, initwarning());
VARF(fsaa, -1, -1, 16, initwarning());
VARF(vsync, -1, -1, 1, initwarning());
void writeinitcfg()
@@ -202,22 +202,22 @@ void setupscreen(int &usedcolorbits, int &useddepthbits, int &usedfsaa)
0x2, 0x1, /* try disabling one at a time */
0 /* try disabling everything */
};
int config = 0, msaabufs = 0, msaasamples = 0;
if(screen)
int config = 0;
if(!fsaa)
{
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaabufs);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaasamples);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
}
loopi(sizeof(configs)/sizeof(configs[0]))
{
config = configs[i];
if(!depthbits && config&1) continue;
if(!fsaa && config&2) continue;
if(fsaa<=0 && config&2) continue;
if(depthbits) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, config&1 ? depthbits : 16);
if(fsaa)
if(fsaa>0)
{
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, config&2 ? 1 : msaabufs);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, config&2 ? fsaa : msaasamples);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, config&2 ? 1 : 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, config&2 ? fsaa : 0);
}
screen = SDL_SetVideoMode(scr_w, scr_h, hasbpp ? colorbits : 0, SDL_OPENGL|flags);
if(screen) break;
@@ -227,7 +227,7 @@ void setupscreen(int &usedcolorbits, int &useddepthbits, int &usedfsaa)
{
if(!hasbpp) conoutf("%d bit color buffer not supported - disabling", colorbits);
if(depthbits && (config&1)==0) conoutf("%d bit z-buffer not supported - disabling", depthbits);
if(fsaa && (config&2)==0) conoutf("%dx anti-aliasing not supported - disabling", fsaa);
if(fsaa>0 && (config&2)==0) conoutf("%dx anti-aliasing not supported - disabling", fsaa);
}
scr_w = screen->w;