mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Better handling of bad GL drivers
git-svn-id: https://svn.eduke32.com/eduke32@1036 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f814485606
commit
b38cbec5c8
4 changed files with 45 additions and 9 deletions
|
@ -7781,6 +7781,11 @@ int setgamemode(char davidoption, int daxdim, int daydim, int dabpp)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
#if defined(USE_OPENGL) && defined(POLYMOST)
|
||||||
|
extern char nogl;
|
||||||
|
|
||||||
|
if (nogl) dabpp = 8;
|
||||||
|
#endif
|
||||||
if ((qsetmode == 200) && (videomodereset == 0) &&
|
if ((qsetmode == 200) && (videomodereset == 0) &&
|
||||||
(davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp))
|
(davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp))
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -7792,6 +7797,7 @@ int setgamemode(char davidoption, int daxdim, int daydim, int dabpp)
|
||||||
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1);
|
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1);
|
||||||
|
|
||||||
//bytesperline is set in this function
|
//bytesperline is set in this function
|
||||||
|
|
||||||
j = bpp;
|
j = bpp;
|
||||||
if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return(-1);
|
if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return(-1);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static unsigned short sysgamma[3][256];
|
||||||
extern int curbrightness, gammabrightness;
|
extern int curbrightness, gammabrightness;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
// OpenGL stuff
|
// OpenGL stuff
|
||||||
static char nogl=0;
|
char nogl=0;
|
||||||
#endif
|
#endif
|
||||||
int vsync=0;
|
int vsync=0;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ extern int curbrightness, gammabrightness;
|
||||||
// OpenGL stuff
|
// OpenGL stuff
|
||||||
static HGLRC hGLRC = 0;
|
static HGLRC hGLRC = 0;
|
||||||
char nofog=0;
|
char nofog=0;
|
||||||
static char nogl=0;
|
char nogl=0;
|
||||||
|
char forcegl=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static LPTSTR GetWindowsErrorMsg(DWORD code);
|
static LPTSTR GetWindowsErrorMsg(DWORD code);
|
||||||
|
@ -382,6 +383,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||||
#if defined(USE_OPENGL) && defined(POLYMOST)
|
#if defined(USE_OPENGL) && defined(POLYMOST)
|
||||||
if ((argp = Bgetenv("BUILD_NOFOG")) != NULL)
|
if ((argp = Bgetenv("BUILD_NOFOG")) != NULL)
|
||||||
nofog = Batol(argp);
|
nofog = Batol(argp);
|
||||||
|
if (Bgetenv("BUILD_FORCEGL") != NULL)
|
||||||
|
forcegl = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// install signal handlers
|
// install signal handlers
|
||||||
|
@ -1402,7 +1405,7 @@ static void GetKeyNames(void)
|
||||||
tbuf[0] = 0;
|
tbuf[0] = 0;
|
||||||
GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(keynames[i])-1);
|
GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(keynames[i])-1);
|
||||||
// initprintf("%d %15s %15s\n",i,keynames[i],tbuf);
|
// initprintf("%d %15s %15s\n",i,keynames[i],tbuf);
|
||||||
if(*tbuf)strncpy((char *)keynames[i], tbuf, sizeof(keynames[i])-1);
|
if(*tbuf)strncpy(&keynames[i][0], tbuf, sizeof(keynames[i])-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2248,7 +2251,8 @@ void getvalidmodes(void)
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
#if defined(USE_OPENGL) && defined(POLYMOST)
|
#if defined(USE_OPENGL) && defined(POLYMOST)
|
||||||
if (desktopbpp > 8) cdepths[1] = desktopbpp;
|
if (desktopbpp > 8 && !nogl) cdepths[1] = desktopbpp;
|
||||||
|
else cdepths[1] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (modeschecked) return;
|
if (modeschecked) return;
|
||||||
|
@ -3257,12 +3261,31 @@ static int SetupOpenGL(int width, int height, int bitspp)
|
||||||
|
|
||||||
{
|
{
|
||||||
GLubyte *p,*p2,*p3;
|
GLubyte *p,*p2,*p3;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
glinfo.vendor = (char *)bglGetString(GL_VENDOR);
|
glinfo.vendor = (char *)bglGetString(GL_VENDOR);
|
||||||
glinfo.renderer = (char *)bglGetString(GL_RENDERER);
|
glinfo.renderer = (char *)bglGetString(GL_RENDERER);
|
||||||
glinfo.version = (char *)bglGetString(GL_VERSION);
|
glinfo.version = (char *)bglGetString(GL_VERSION);
|
||||||
glinfo.extensions = (char *)bglGetString(GL_EXTENSIONS);
|
glinfo.extensions = (char *)bglGetString(GL_EXTENSIONS);
|
||||||
|
|
||||||
|
// GL driver blacklist
|
||||||
|
if (!forcegl)
|
||||||
|
{
|
||||||
|
if (!Bstrcmp(glinfo.vendor,"Microsoft Corporation")) err = 1;
|
||||||
|
else if (!Bstrcmp(glinfo.vendor,"SiS")) err = 1;
|
||||||
|
else if (!Bstrcmp(glinfo.vendor,"3Dfx Interactive Inc.")) err = 1;
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
OSD_Printf("Unsupported OpenGL driver. GL modes will be unavailable.\n");
|
||||||
|
ReleaseOpenGL();
|
||||||
|
nogl = 1;
|
||||||
|
modeschecked = 0;
|
||||||
|
getvalidmodes();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glinfo.maxanisotropy = 1.0;
|
glinfo.maxanisotropy = 1.0;
|
||||||
glinfo.bgra = 0;
|
glinfo.bgra = 0;
|
||||||
glinfo.texcompr = 0;
|
glinfo.texcompr = 0;
|
||||||
|
|
|
@ -10990,19 +10990,26 @@ void app_main(int argc,const char **argv)
|
||||||
|
|
||||||
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
|
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0, j = 0;
|
||||||
int xres[] = {800,640,320};
|
int xres[] = {ud.config.ScreenWidth,800,640,320};
|
||||||
int yres[] = {600,480,240};
|
int yres[] = {ud.config.ScreenHeight,600,480,240};
|
||||||
int bpp[] = {32,16,8};
|
int bpp[] = {32,16,8};
|
||||||
|
|
||||||
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
|
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
|
||||||
ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed");
|
ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed");
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
while (setgamemode(0,xres[i],yres[i],bpp[i]) < 0)
|
while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0)
|
||||||
{
|
{
|
||||||
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]);
|
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]);
|
||||||
|
j++;
|
||||||
|
if (j == 3)
|
||||||
|
{
|
||||||
i++;
|
i++;
|
||||||
|
j = 0;
|
||||||
|
}
|
||||||
|
if (i == 4)
|
||||||
|
gameexit("Unable to set failsafe video mode!");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while (setgamemode(0,xres[i],yres[i],8) < 0)
|
while (setgamemode(0,xres[i],yres[i],8) < 0)
|
||||||
|
|
Loading…
Reference in a new issue